5 * Copyright (C) 2004-2009 Marcel Holtmann <marcel@holtmann.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 #include <dbus/dbus.h>
34 typedef void (* GDBusWatchFunction) (DBusConnection *connection,
37 typedef gboolean (* GDBusSignalFunction) (DBusConnection *connection,
38 DBusMessage *message, void *user_data);
40 DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name,
43 gboolean g_dbus_request_name(DBusConnection *connection, const char *name,
46 gboolean g_dbus_set_disconnect_function(DBusConnection *connection,
47 GDBusWatchFunction function,
48 void *user_data, DBusFreeFunction destroy);
50 typedef void (* GDBusDestroyFunction) (void *user_data);
52 typedef DBusMessage * (* GDBusMethodFunction) (DBusConnection *connection,
53 DBusMessage *message, void *user_data);
56 G_DBUS_METHOD_FLAG_DEPRECATED = (1 << 0),
57 G_DBUS_METHOD_FLAG_NOREPLY = (1 << 1),
58 G_DBUS_METHOD_FLAG_ASYNC = (1 << 2),
62 G_DBUS_SIGNAL_FLAG_DEPRECATED = (1 << 0),
66 G_DBUS_PROPERTY_FLAG_DEPRECATED = (1 << 0),
71 const char *signature;
73 GDBusMethodFunction function;
74 GDBusMethodFlags flags;
79 const char *signature;
80 GDBusSignalFlags flags;
86 GDBusPropertyFlags flags;
89 gboolean g_dbus_register_interface(DBusConnection *connection,
90 const char *path, const char *name,
91 GDBusMethodTable *methods,
92 GDBusSignalTable *signals,
93 GDBusPropertyTable *properties,
95 GDBusDestroyFunction destroy);
96 gboolean g_dbus_unregister_interface(DBusConnection *connection,
97 const char *path, const char *name);
99 DBusMessage *g_dbus_create_error(DBusMessage *message, const char *name,
100 const char *format, ...);
101 DBusMessage *g_dbus_create_error_valist(DBusMessage *message, const char *name,
102 const char *format, va_list args);
103 DBusMessage *g_dbus_create_reply(DBusMessage *message, int type, ...);
104 DBusMessage *g_dbus_create_reply_valist(DBusMessage *message,
105 int type, va_list args);
107 gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message);
108 gboolean g_dbus_send_reply(DBusConnection *connection,
109 DBusMessage *message, int type, ...);
110 gboolean g_dbus_send_reply_valist(DBusConnection *connection,
111 DBusMessage *message, int type, va_list args);
113 gboolean g_dbus_emit_signal(DBusConnection *connection,
114 const char *path, const char *interface,
115 const char *name, int type, ...);
116 gboolean g_dbus_emit_signal_valist(DBusConnection *connection,
117 const char *path, const char *interface,
118 const char *name, int type, va_list args);
120 guint g_dbus_add_service_watch(DBusConnection *connection, const char *name,
121 GDBusWatchFunction connect,
122 GDBusWatchFunction disconnect,
123 void *user_data, GDBusDestroyFunction destroy);
124 guint g_dbus_add_disconnect_watch(DBusConnection *connection, const char *name,
125 GDBusWatchFunction function,
126 void *user_data, GDBusDestroyFunction destroy);
127 guint g_dbus_add_signal_watch(DBusConnection *connection,
128 const char *sender, const char *path,
129 const char *interface, const char *member,
130 GDBusSignalFunction function, void *user_data,
131 GDBusDestroyFunction destroy);
132 gboolean g_dbus_remove_watch(DBusConnection *connection, guint tag);
133 void g_dbus_remove_all_watches(DBusConnection *connection);
139 #endif /* __GDBUS_H */