aboutsummaryrefslogtreecommitdiff
path: root/src/lib/include/gnunet_dbus_lib_client.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/include/gnunet_dbus_lib_client.h')
-rw-r--r--src/lib/include/gnunet_dbus_lib_client.h105
1 files changed, 105 insertions, 0 deletions
diff --git a/src/lib/include/gnunet_dbus_lib_client.h b/src/lib/include/gnunet_dbus_lib_client.h
new file mode 100644
index 0000000..413a0c3
--- /dev/null
+++ b/src/lib/include/gnunet_dbus_lib_client.h
@@ -0,0 +1,105 @@
1#ifndef GNUNET_DBUS_CLIENT_H
2#define GNUNET_DBUS_CLIENT_H
3
4#include <stdbool.h>
5
6/**
7 * Used by services to keep track of connected clients. Can associate an
8 * arbitrary piece of data with each client.
9 */
10struct GNUNET_DBUS_Client;
11
12/**
13 * An iterable, double-linked-list of GNUNET_DBUS_Client
14 */
15struct GNUNET_DBUS_ClientIterator
16{
17 struct GNUNET_DBUS_ClientIterator *next;
18 struct GNUNET_DBUS_ClientIterator *prev;
19
20 struct GNUNET_DBUS_Client *client;
21};
22
23/**
24 * Create a GNUNET_DBUS_Client with the given DBus unique name (eg. "1:23").
25 */
26struct GNUNET_DBUS_Client *
27GNUNET_DBUS_client_create (
28 const char *unique_name);
29
30/**
31 * Increase the reference count of this GNUNET_DBUS_Client by one.
32 */
33void
34GNUNET_DBUS_client_ref (
35 struct GNUNET_DBUS_Client *client);
36
37/**
38 * Decrease the reference count of this GNUNET_DBUS_Client by one. Will free
39 * the GNUNET_DBUS_Client if the reference count reaches zero.
40 */
41void
42GNUNET_DBUS_client_unref (
43 struct GNUNET_DBUS_Client *client);
44
45/*
46 * Get the DBus unique name of this client (eg. "1:23").
47 */
48const char *
49GNUNET_DBUS_client_get_unique_name (
50 const struct GNUNET_DBUS_Client *client);
51
52/**
53 * Set the arbitrary piece of data associated with the client.
54 */
55void
56GNUNET_DBUS_client_set_data (
57 struct GNUNET_DBUS_Client *client,
58 void *data);
59
60/**
61 * Get the arbitrary piece of data associated with the client.
62 */
63void *
64GNUNET_DBUS_client_get_data (
65 const struct GNUNET_DBUS_Client *client);
66/**
67 * Set whether this client prefers data to be pretty-encoded for transmission
68 * over DBus. For example, the enum variant GNUNET_BLOCK_TYPE_DHT_HELLO will be
69 * sent over-the-wire to this client as a DBus uint32 or as a the DBus string
70 * "dht_hello" depending on this flag.
71 */
72void
73GNUNET_DBUS_client_set_prefers_pretty_encodings (
74 struct GNUNET_DBUS_Client *client,
75 bool prefers_pretty_encodings);
76
77/**
78 * Get whether this client prefers data to be pretty-encoded for transmission
79 * over DBus. For example, the enum variant GNUNET_BLOCK_TYPE_DHT_HELLO will be
80 * sent over-the-wire to this client as a DBus uint32 or as a the DBus string
81 * "dht_hello" depending on this flag.
82 */
83bool
84GNUNET_DBUS_client_get_prefers_pretty_encodings (
85 const struct GNUNET_DBUS_Client *client);
86
87DBusMessage *
88GNUNET_DBUS_client_create_method_call (
89 struct GNUNET_DBUS_Client *client,
90 const char *object_path,
91 const char *interface,
92 const char *method,
93 bool pretty,
94 void (*return_callback)(DBusMessage *message));
95
96DBusMessage *
97GNUNET_DBUS_client_create_unicast_signal (
98 struct GNUNET_DBUS_Client *client,
99 const char *object_path,
100 const char *interface,
101 const char *signal,
102 bool pretty);
103
104#endif
105