1SD_BUS_ADD_NODE_ENUMERATOR(s3d)_bus_add_node_enumeratSoDr_BUS_ADD_NODE_ENUMERATOR(3)
2
3
4

NAME

6       sd_bus_add_node_enumerator - Add a node enumerator for a D-Bus object
7       path prefix
8

SYNOPSIS

10       #include <systemd/sd-bus.h>
11
12       typedef int (*sd_bus_node_enumerator_t)(sd_bus *bus,
13                                               const char *prefix,
14                                               void *userdata,
15                                               char ***ret_nodes,
16                                               sd_bus_error *ret_error);
17
18       int sd_bus_add_node_enumerator(sd_bus *bus, sd_bus_slot **slot,
19                                      const char *path,
20                                      sd_bus_node_enumerator_t callback,
21                                      void *userdata);
22

DESCRIPTION

24       sd_bus_add_node_enumerator() adds a D-Bus node enumerator for the given
25       path prefix. The given callback is called to enumerate all the
26       available objects with the given path prefix when required (e.g. when
27       org.freedesktop.DBus.Introspectable.Introspect or
28       org.freedesktop.DBus.ObjectManager.GetManagedObjects are called on a
29       D-Bus service managed by sd-bus).
30
31       callback is called with the path and userdata pointer registered with
32       sd_bus_add_node_enumerator(). When called, it should store all the
33       child object paths of the given path prefix in ret_nodes with a NULL
34       terminator item. The callback should return a non-negative value on
35       success. If an error occurs, it can either return a negative integer,
36       set ret_error to a non-empty error or do both. Any errors returned by
37       the callback are encoded as D-Bus errors and sent back to the caller.
38       Errors in ret_error take priority over negative return values.
39
40       Note that a node enumerator callback will only ever be called for a
41       single path prefix and hence, for normal operation, prefix can be
42       ignored. Also, a node enumerator is only used to enumerate the
43       available child objects under a given prefix. To install a handler for
44       a set of dynamic child objects, use sd_bus_add_fallback_vtable(3).
45
46       When sd_bus_add_node_enumerator() succeeds, a slot is created
47       internally. If the output parameter slot is NULL, a "floating" slot
48       object is created, see sd_bus_slot_set_floating(3). Otherwise, a
49       pointer to the slot object is returned. In that case, the reference to
50       the slot object should be dropped when the node enumerator is not
51       needed anymore, see sd_bus_slot_unref(3).
52

RETURN VALUE

54       On success, sd_bus_add_node_enumerator() returns a non-negative
55       integer. On failure, it returns a negative errno-style error code.
56
57   Errors
58       Returned errors may indicate the following problems:
59
60       -EINVAL
61           One of the required parameters is NULL or path is not a valid
62           object path.
63
64       -ENOPKG
65           The bus cannot be resolved.
66
67       -ECHILD
68           The bus was created in a different process.
69
70       -ENOMEM
71           Memory allocation failed.
72

NOTES

74       These APIs are implemented as a shared library, which can be compiled
75       and linked to with the libsystemd pkg-config(1) file.
76

SEE ALSO

78       sd-bus(3), busctl(1), sd_bus_add_fallback_vtable(3),
79       sd_bus_slot_unref(3)
80
81
82
83systemd 250                                      SD_BUS_ADD_NODE_ENUMERATOR(3)
Impressum