diff options
Diffstat (limited to 'src/lib/include/gnunet_dbus_lib_service.h')
-rw-r--r-- | src/lib/include/gnunet_dbus_lib_service.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/lib/include/gnunet_dbus_lib_service.h b/src/lib/include/gnunet_dbus_lib_service.h new file mode 100644 index 0000000..4d88079 --- /dev/null +++ b/src/lib/include/gnunet_dbus_lib_service.h | |||
@@ -0,0 +1,87 @@ | |||
1 | #ifndef GNUNET_DBUS_LIB_SERVICE_H | ||
2 | #define GNUNET_DBUS_LIB_SERVICE_H | ||
3 | |||
4 | #include <gnunet/platform.h> | ||
5 | #include <gnunet/gnunet_common.h> | ||
6 | #include <gnunet/gnunet_configuration_lib.h> | ||
7 | |||
8 | /** | ||
9 | * Represents a DBus service that we are running. | ||
10 | */ | ||
11 | struct GNUNET_DBUS_Service; | ||
12 | |||
13 | #include "gnunet_dbus_lib_object.h" | ||
14 | #include "gnunet_dbus_lib_client.h" | ||
15 | |||
16 | /** | ||
17 | * The type of callbacks used to handle newly-connecting clients. | ||
18 | */ | ||
19 | typedef void (*GNUNET_DBUS_ClientConnectsHandler)( | ||
20 | struct GNUNET_DBUS_Service *service, | ||
21 | struct GNUNET_DBUS_Client *client); | ||
22 | |||
23 | /** | ||
24 | * The type of callbacks used to handle clients disconnecting. | ||
25 | */ | ||
26 | typedef void (*GNUNET_DBUS_ClientDisconnectsHandler)( | ||
27 | struct GNUNET_DBUS_Service *service, | ||
28 | struct GNUNET_DBUS_Client *client); | ||
29 | |||
30 | /** | ||
31 | * Create a service with the given name and configuration. The service will | ||
32 | * start running immediately in GNUnet's scheduler. | ||
33 | */ | ||
34 | struct GNUNET_DBUS_Service * | ||
35 | GNUNET_DBUS_service_create ( | ||
36 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
37 | const char *name); | ||
38 | |||
39 | /** | ||
40 | * Increase the reference count of this GNUNET_DBUS_Service by one. | ||
41 | */ | ||
42 | void | ||
43 | GNUNET_DBUS_service_ref ( | ||
44 | struct GNUNET_DBUS_Service *service); | ||
45 | |||
46 | /** | ||
47 | * Decrease the reference count of this GNUNET_DBUS_Service by one. Will free | ||
48 | * the service if the reference count reaches zero. | ||
49 | */ | ||
50 | void | ||
51 | GNUNET_DBUS_service_unref ( | ||
52 | struct GNUNET_DBUS_Service *service); | ||
53 | |||
54 | /** | ||
55 | * Get a reference to this GNUNET_DBUS_Service's configuration. | ||
56 | */ | ||
57 | const struct GNUNET_CONFIGURATION_Handle * | ||
58 | GNUNET_DBUS_service_get_config ( | ||
59 | struct GNUNET_DBUS_Service *service); | ||
60 | |||
61 | /** | ||
62 | * Send an arbitrary message from this service. | ||
63 | */ | ||
64 | void | ||
65 | GNUNET_DBUS_service_send ( | ||
66 | struct GNUNET_DBUS_Service *service, | ||
67 | DBusMessage *dbus_message); | ||
68 | |||
69 | /** | ||
70 | * Set the callbacks used by this service to handle clients connecting and | ||
71 | * disconnecting. | ||
72 | */ | ||
73 | void | ||
74 | GNUNET_DBUS_service_set_client_handlers ( | ||
75 | struct GNUNET_DBUS_Service *service, | ||
76 | GNUNET_DBUS_ClientConnectsHandler client_connects, | ||
77 | GNUNET_DBUS_ClientDisconnectsHandler client_disconnects); | ||
78 | |||
79 | /** | ||
80 | * Get this GNUNET_DBUS_Service's root object (a.k.a. '/') | ||
81 | */ | ||
82 | struct GNUNET_DBUS_Object * | ||
83 | GNUNET_DBUS_service_get_root_object ( | ||
84 | struct GNUNET_DBUS_Service *service); | ||
85 | |||
86 | #endif | ||
87 | |||