blob: 3264494ad90bf7648443ee86febe8583bb9d2481 (
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#ifndef GNUNET_DBUS_LIB_OBJECT_H
#define GNUNET_DBUS_LIB_OBJECT_H
/**
* Represents a DBus object advertised on a DBus service. Objects are named and
* exist in a tree. For example, the object at the path
* /org/freedesktop/PolicyKit1/Authority is named Authority and sits in a
* heirarchy below four other objects including the service's root object. Each
* object has a set of interfaces and can be associated with an arbitrary piece
* of data.
*/
struct GNUNET_DBUS_Object;
#include "gnunet_dbus_lib_interface.h"
/**
* An iterable, doubly-linked-list of GNUNET_DBUS_Object.
*/
struct GNUNET_DBUS_ObjectIterator
{
/* linked list */
struct GNUNET_DBUS_ObjectIterator *next;
struct GNUNET_DBUS_ObjectIterator *prev;
struct GNUNET_DBUS_Object *object;
};
/**
* Create a new GNUNET_DBUS_Object with the given name and associated data. For
* example, the object that exists at the path
* /org/freedesktop/PolicyKit1/Authority has the name Authority and sits below
* four other objects including the service's root object.
*/
struct GNUNET_DBUS_Object *
GNUNET_DBUS_object_create (
const char *name,
void *data);
/**
* Increase the reference count of this GNUNET_DBUS_Object by one.
*/
void
GNUNET_DBUS_object_ref (
struct GNUNET_DBUS_Object *object);
/**
* Decrease the reference count of this GNUNET_DBUS_Object by one. Will free
* the GNUNET_DBUS_Object if the reference count reaches zero.
*/
void
GNUNET_DBUS_object_unref (
struct GNUNET_DBUS_Object *object);
/**
* Get the name of this GNUNET_DBUS_Object.
*/
const char *
GNUNET_DBUS_object_get_name (
const struct GNUNET_DBUS_Object *object);
/**
* Add an interface to this GNUNET_DBUS_Object.
*/
void
GNUNET_DBUS_object_add_interface (
struct GNUNET_DBUS_Object *object,
struct GNUNET_DBUS_Interface *interface);
/**
* Iterate over the interfaces of this GNUNET_DBUS_Object.
*/
const struct GNUNET_DBUS_InterfaceIterator *
GNUNET_DBUS_object_iterate_interfaces (
struct GNUNET_DBUS_Object *object);
/**
* Get the data associated with this GNUNET_DBUS_Object.
*/
void *
GNUNET_DBUS_object_get_data (
struct GNUNET_DBUS_Object *object);
/**
* Create an object with a randomly generated name, associate data with it, and
* add it as a child to the given object. Returns the newly created object.
*/
struct GNUNET_DBUS_Object *
GNUNET_DBUS_object_create_uniquely_named_subobject (
struct GNUNET_DBUS_Object *object,
void *data);
/**
* Add subobject as a child of object.
*/
void
GNUNET_DBUS_object_add_subobject (
struct GNUNET_DBUS_Object *object,
struct GNUNET_DBUS_Object *subobject);
/**
* Remove the object pointed to by subobject_it as a child from object.
*/
void
GNUNET_DBUS_object_remove_subobject (
struct GNUNET_DBUS_Object *object,
struct GNUNET_DBUS_ObjectIterator *subobject_it);
/**
* Iterate over an object's child objects.
*/
struct GNUNET_DBUS_ObjectIterator *
GNUNET_DBUS_object_iterate_subobjects (
const struct GNUNET_DBUS_Object *object);
/**
* Search the given linked list of GNUNET_DBUS_Object for an object with the
* given name and return an iterator to it.
*/
const struct GNUNET_DBUS_ObjectIterator *
GNUNET_DBUS_object_find (
const struct GNUNET_DBUS_ObjectIterator *object_it,
const char *name);
#endif
|