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