Remove obsolete file.
[connman] / gdbus / gdbus.h
1 /*
2  *
3  *  D-Bus helper library
4  *
5  *  Copyright (C) 2004-2009  Marcel Holtmann <marcel@holtmann.org>
6  *
7  *
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.
12  *
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.
17  *
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
21  *
22  */
23
24 #ifndef __GDBUS_H
25 #define __GDBUS_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #include <dbus/dbus.h>
32 #include <glib.h>
33
34 typedef void (* GDBusWatchFunction) (DBusConnection *connection,
35                                                         void *user_data);
36
37 typedef gboolean (* GDBusSignalFunction) (DBusConnection *connection,
38                                         DBusMessage *message, void *user_data);
39
40 DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name,
41                                                         DBusError *error);
42
43 gboolean g_dbus_request_name(DBusConnection *connection, const char *name,
44                                                         DBusError *error);
45
46 gboolean g_dbus_check_service(DBusConnection *connection, const char *name);
47
48 gboolean g_dbus_set_disconnect_function(DBusConnection *connection,
49                                 GDBusWatchFunction function,
50                                 void *user_data, DBusFreeFunction destroy);
51
52 typedef void (* GDBusDestroyFunction) (void *user_data);
53
54 typedef DBusMessage * (* GDBusMethodFunction) (DBusConnection *connection,
55                                         DBusMessage *message, void *user_data);
56
57 typedef enum {
58         G_DBUS_METHOD_FLAG_DEPRECATED = (1 << 0),
59         G_DBUS_METHOD_FLAG_NOREPLY    = (1 << 1),
60         G_DBUS_METHOD_FLAG_ASYNC      = (1 << 2),
61 } GDBusMethodFlags;
62
63 typedef enum {
64         G_DBUS_SIGNAL_FLAG_DEPRECATED = (1 << 0),
65 } GDBusSignalFlags;
66
67 typedef enum {
68         G_DBUS_PROPERTY_FLAG_DEPRECATED = (1 << 0),
69 } GDBusPropertyFlags;
70
71 typedef struct {
72         const char *name;
73         const char *signature;
74         const char *reply;
75         GDBusMethodFunction function;
76         GDBusMethodFlags flags;
77 } GDBusMethodTable;
78
79 typedef struct {
80         const char *name;
81         const char *signature;
82         GDBusSignalFlags flags;
83 } GDBusSignalTable;
84
85 typedef struct {
86         const char *name;
87         const char *type;
88         GDBusPropertyFlags flags;
89 } GDBusPropertyTable;
90
91 gboolean g_dbus_register_interface(DBusConnection *connection,
92                                         const char *path, const char *name,
93                                         GDBusMethodTable *methods,
94                                         GDBusSignalTable *signals,
95                                         GDBusPropertyTable *properties,
96                                         void *user_data,
97                                         GDBusDestroyFunction destroy);
98 gboolean g_dbus_unregister_interface(DBusConnection *connection,
99                                         const char *path, const char *name);
100
101 DBusMessage *g_dbus_create_error(DBusMessage *message, const char *name,
102                                                 const char *format, ...);
103 DBusMessage *g_dbus_create_error_valist(DBusMessage *message, const char *name,
104                                         const char *format, va_list args);
105 DBusMessage *g_dbus_create_reply(DBusMessage *message, int type, ...);
106 DBusMessage *g_dbus_create_reply_valist(DBusMessage *message,
107                                                 int type, va_list args);
108
109 gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message);
110 gboolean g_dbus_send_reply(DBusConnection *connection,
111                                 DBusMessage *message, int type, ...);
112 gboolean g_dbus_send_reply_valist(DBusConnection *connection,
113                                 DBusMessage *message, int type, va_list args);
114
115 gboolean g_dbus_emit_signal(DBusConnection *connection,
116                                 const char *path, const char *interface,
117                                 const char *name, int type, ...);
118 gboolean g_dbus_emit_signal_valist(DBusConnection *connection,
119                                 const char *path, const char *interface,
120                                 const char *name, int type, va_list args);
121
122 guint g_dbus_add_service_watch(DBusConnection *connection, const char *name,
123                                 GDBusWatchFunction connect,
124                                 GDBusWatchFunction disconnect,
125                                 void *user_data, GDBusDestroyFunction destroy);
126 guint g_dbus_add_disconnect_watch(DBusConnection *connection, const char *name,
127                                 GDBusWatchFunction function,
128                                 void *user_data, GDBusDestroyFunction destroy);
129 guint g_dbus_add_signal_watch(DBusConnection *connection,
130                                 const char *rule, GDBusSignalFunction function,
131                                 void *user_data, GDBusDestroyFunction destroy);
132 gboolean g_dbus_remove_watch(DBusConnection *connection, guint tag);
133 void g_dbus_remove_all_watches(DBusConnection *connection);
134
135 #ifdef __cplusplus
136 }
137 #endif
138
139 #endif /* __GDBUS_H */