1 /*#############################################################################
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2023 IPFire Network Development Team #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 #############################################################################*/
21 #ifndef NETWORKD_BUS_H
22 #define NETWORKD_BUS_H
24 #define NETWORKD_BUS_DESCRIPTION "networkd"
26 #define DEFAULT_SYSTEM_BUS_ADDRESS "unix:path=/run/dbus/system_bus_socket"
28 #include <systemd/sd-bus.h>
29 #include <systemd/sd-event.h>
33 int nw_bus_connect(sd_bus
** bus
, sd_event
* loop
, nw_daemon
* daemon
);
35 struct nw_bus_vtable_pair
{
36 const sd_bus_vtable
* vtable
;
37 sd_bus_object_find_t object_find
;
40 typedef struct nw_bus_implementation
{
42 const char* interface
;
43 const sd_bus_vtable
** vtables
;
44 const struct nw_bus_vtable_pair
* fallback_vtables
;
45 sd_bus_node_enumerator_t node_enumerator
;
46 const struct nw_bus_implementation
** children
;
47 } nw_bus_implementation
;
49 #define BUS_FALLBACK_VTABLES(...) ((const struct nw_bus_vtable_pair[]) { __VA_ARGS__, {} })
50 #define BUS_IMPLEMENTATIONS(...) ((const nw_bus_implementation* []) { __VA_ARGS__, NULL })
51 #define BUS_VTABLES(...) ((const sd_bus_vtable* []){ __VA_ARGS__, NULL })
53 int nw_bus_register_implementation(sd_bus
* bus
,
54 const nw_bus_implementation
* impl
, void* data
);
56 #endif /* NETWORKD_BUS_H */