#include <systemd/sd-bus.h>
sd_bus_add_node_enumerator()
callback is called with the path and userdata pointer registered with sd_bus_add_node_enumerator(). When called, it should store all the child object paths of the given path prefix in ret_nodes and return the number of child objects under the given prefix. If an error occurs, it can either return a negative integer, set ret_error to a non-empty error or do both. Any errors returned by the callback are encoded as D-Bus errors and sent back to the caller. Errors in ret_error take priority over negative return values.
Note that a node enumerator callback will only ever be called for a single path prefix and hence, for normal operation, prefix can be ignored. Also, a node enumerator is only used to enumerate the available child objects under a given prefix. To install a handler for a set of dynamic child objects, use sd_bus_add_fallback_vtable(3).
When sd_bus_add_node_enumerator() succeeds, a slot is created internally. If the output parameter slot is NULL, a "floating" slot object is created, see sd_bus_slot_set_floating(3). Otherwise, a pointer to the slot object is returned. In that case, the reference to the slot object should be dropped when the node enumerator is not needed anymore, see sd_bus_slot_unref(3).
On success, sd_bus_add_node_enumerator() returns a non-negative integer. On failure, it returns a negative errno-style error code.
Returned errors may indicate the following problems:
-EINVAL
-ENOPKG
-ECHILD
-ENOMEM
These APIs are implemented as a shared library, which can be compiled and linked to with the libsystemd pkg-config(1) file.
sd-bus(3), busctl(1), sd_bus_add_fallback_vtable(3), sd_bus_slot_unref(3)