1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include <stdbool.h>
5 #include <stdio.h>
6 
7 #include "sd-bus.h"
8 
9 typedef struct BusObjectImplementation BusObjectImplementation;
10 
11 typedef struct BusObjectVtablePair {
12         const sd_bus_vtable *vtable;
13         sd_bus_object_find_t object_find;
14 } BusObjectVtablePair;
15 
16 struct BusObjectImplementation {
17         const char *path;
18         const char *interface;
19         const sd_bus_vtable **vtables;
20         const BusObjectVtablePair *fallback_vtables;
21         sd_bus_node_enumerator_t node_enumerator;
22         bool manager;
23         const BusObjectImplementation **children;
24 };
25 
26 #define BUS_VTABLES(...) ((const sd_bus_vtable* []){ __VA_ARGS__, NULL })
27 #define BUS_FALLBACK_VTABLES(...) ((const BusObjectVtablePair[]) { __VA_ARGS__, {} })
28 #define BUS_IMPLEMENTATIONS(...) ((const BusObjectImplementation* []) { __VA_ARGS__, NULL })
29 
30 int bus_add_implementation(sd_bus *bus, const BusObjectImplementation *impl, void *userdata);
31 int bus_introspect_implementations(
32                 FILE *out,
33                 const char *pattern,
34                 const BusObjectImplementation* const* bus_objects);
35