1
/* NetworkManager -- Network link manager
3
* Ray Strode <rstrode@redhat.com>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
* (C) Copyright 2005 Red Hat, Inc.
27
#include <dbus/dbus.h>
29
#define nm_print_backtrace() \
32
void *_call_stack[512]; \
33
int _call_stack_size; \
35
_call_stack_size = backtrace (_call_stack, \
36
G_N_ELEMENTS (_call_stack)); \
37
_symbols = backtrace_symbols (_call_stack, _call_stack_size); \
38
if (_symbols != NULL) \
42
g_critical ("traceback:\n"); \
43
while (_i < _call_stack_size) \
45
g_critical ("\t%s\n", _symbols[_i]); \
53
#define nm_get_timestamp(timestamp) \
57
g_get_current_time (&_tv); \
58
*timestamp = (_tv.tv_sec * (1.0 * G_USEC_PER_SEC) + \
59
_tv.tv_usec) / G_USEC_PER_SEC; \
63
#define nm_info(fmt, args...) \
66
g_message ("<info> " fmt "\n", ##args); \
69
#define nm_info_str(fmt_str, args...) \
72
g_message ("<info> %s\n", fmt_str, ##args); \
75
#define nm_debug(fmt, args...) \
79
nm_get_timestamp (&_timestamp); \
80
g_debug ("<debug> [%f] %s(): " fmt "\n", _timestamp, \
84
#define nm_debug_str(fmt_str, args...) \
88
nm_get_timestamp (&_timestamp); \
89
g_debug ("<debug> [%f] %s(): %s\n", _timestamp, \
90
G_STRFUNC, fmt_str, ##args); \
93
#define nm_warning(fmt, args...) \
96
g_warning ("<WARN> %s(): " fmt "\n", \
100
#define nm_warning_str(fmt_str, args...) \
103
g_warning ("<WARN> %s(): %s\n", \
104
G_STRFUNC, fmt_str, ##args); \
107
#define nm_error(fmt, args...) \
110
gdouble _timestamp; \
111
nm_get_timestamp (&_timestamp); \
112
g_critical ("<ERROR>\t[%f] %s (): " fmt "\n", _timestamp, \
113
G_STRFUNC, ##args); \
114
nm_print_backtrace (); \
118
#define nm_error_str(fmt_str, args...) \
121
gdouble _timestamp; \
122
nm_get_timestamp (&_timestamp); \
123
g_critical ("<ERROR>\t[%f] %s (): %s\n", _timestamp, \
124
G_STRFUNC, fmt_str, ##args); \
125
nm_print_backtrace (); \
129
gchar *nm_dbus_escape_object_path (const gchar *utf8_string);
130
gchar *nm_dbus_unescape_object_path (const gchar *object_path);
132
char *nm_utils_essid_to_utf8 (const char *orig_essid);
134
/* #define DBUS_PENDING_CALL_DEBUG */
136
DBusPendingCall * nm_dbus_send_with_callback (DBusConnection *connection,
138
DBusPendingCallNotifyFunction func,
140
DBusFreeFunction free_func,
142
void nm_dbus_send_with_callback_replied (DBusPendingCall *pcall,
145
#endif /* NM_UTILS_H */