aboutsummaryrefslogtreecommitdiff
path: root/src/lib/include/gnunet_dbus_lib_object.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/include/gnunet_dbus_lib_object.h')
-rw-r--r--src/lib/include/gnunet_dbus_lib_object.h125
1 files changed, 125 insertions, 0 deletions
diff --git a/src/lib/include/gnunet_dbus_lib_object.h b/src/lib/include/gnunet_dbus_lib_object.h
new file mode 100644
index 0000000..3264494
--- /dev/null
+++ b/src/lib/include/gnunet_dbus_lib_object.h
@@ -0,0 +1,125 @@
1#ifndef GNUNET_DBUS_LIB_OBJECT_H
2#define GNUNET_DBUS_LIB_OBJECT_H
3
4/**
5 * Represents a DBus object advertised on a DBus service. Objects are named and
6 * exist in a tree. For example, the object at the path
7 * /org/freedesktop/PolicyKit1/Authority is named Authority and sits in a
8 * heirarchy below four other objects including the service's root object. Each
9 * object has a set of interfaces and can be associated with an arbitrary piece
10 * of data.
11 */
12struct GNUNET_DBUS_Object;
13
14#include "gnunet_dbus_lib_interface.h"
15
16/**
17 * An iterable, doubly-linked-list of GNUNET_DBUS_Object.
18 */
19struct GNUNET_DBUS_ObjectIterator
20{
21 /* linked list */
22 struct GNUNET_DBUS_ObjectIterator *next;
23 struct GNUNET_DBUS_ObjectIterator *prev;
24
25 struct GNUNET_DBUS_Object *object;
26};
27
28/**
29 * Create a new GNUNET_DBUS_Object with the given name and associated data. For
30 * example, the object that exists at the path
31 * /org/freedesktop/PolicyKit1/Authority has the name Authority and sits below
32 * four other objects including the service's root object.
33 */
34struct GNUNET_DBUS_Object *
35GNUNET_DBUS_object_create (
36 const char *name,
37 void *data);
38
39/**
40 * Increase the reference count of this GNUNET_DBUS_Object by one.
41 */
42void
43GNUNET_DBUS_object_ref (
44 struct GNUNET_DBUS_Object *object);
45
46/**
47 * Decrease the reference count of this GNUNET_DBUS_Object by one. Will free
48 * the GNUNET_DBUS_Object if the reference count reaches zero.
49 */
50void
51GNUNET_DBUS_object_unref (
52 struct GNUNET_DBUS_Object *object);
53
54/**
55 * Get the name of this GNUNET_DBUS_Object.
56 */
57const char *
58GNUNET_DBUS_object_get_name (
59 const struct GNUNET_DBUS_Object *object);
60
61/**
62 * Add an interface to this GNUNET_DBUS_Object.
63 */
64void
65GNUNET_DBUS_object_add_interface (
66 struct GNUNET_DBUS_Object *object,
67 struct GNUNET_DBUS_Interface *interface);
68
69/**
70 * Iterate over the interfaces of this GNUNET_DBUS_Object.
71 */
72const struct GNUNET_DBUS_InterfaceIterator *
73GNUNET_DBUS_object_iterate_interfaces (
74 struct GNUNET_DBUS_Object *object);
75
76/**
77 * Get the data associated with this GNUNET_DBUS_Object.
78 */
79void *
80GNUNET_DBUS_object_get_data (
81 struct GNUNET_DBUS_Object *object);
82
83/**
84 * Create an object with a randomly generated name, associate data with it, and
85 * add it as a child to the given object. Returns the newly created object.
86 */
87struct GNUNET_DBUS_Object *
88GNUNET_DBUS_object_create_uniquely_named_subobject (
89 struct GNUNET_DBUS_Object *object,
90 void *data);
91
92/**
93 * Add subobject as a child of object.
94 */
95void
96GNUNET_DBUS_object_add_subobject (
97 struct GNUNET_DBUS_Object *object,
98 struct GNUNET_DBUS_Object *subobject);
99
100/**
101 * Remove the object pointed to by subobject_it as a child from object.
102 */
103void
104GNUNET_DBUS_object_remove_subobject (
105 struct GNUNET_DBUS_Object *object,
106 struct GNUNET_DBUS_ObjectIterator *subobject_it);
107
108/**
109 * Iterate over an object's child objects.
110 */
111struct GNUNET_DBUS_ObjectIterator *
112GNUNET_DBUS_object_iterate_subobjects (
113 const struct GNUNET_DBUS_Object *object);
114
115/**
116 * Search the given linked list of GNUNET_DBUS_Object for an object with the
117 * given name and return an iterator to it.
118 */
119const struct GNUNET_DBUS_ObjectIterator *
120GNUNET_DBUS_object_find (
121 const struct GNUNET_DBUS_ObjectIterator *object_it,
122 const char *name);
123
124#endif
125