]> git.ipfire.org Git - network.git/blob - src/networkd/bus.h
55e65b817300e182b9d49539ba17eb9f988438be
[network.git] / src / networkd / bus.h
1 /*#############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2023 IPFire Network Development Team #
5 # #
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. #
10 # #
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. #
15 # #
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/>. #
18 # #
19 #############################################################################*/
20
21 #ifndef NETWORKD_BUS_H
22 #define NETWORKD_BUS_H
23
24 #define NETWORKD_BUS_DESCRIPTION "networkd"
25
26 #define DEFAULT_SYSTEM_BUS_ADDRESS "unix:path=/run/dbus/system_bus_socket"
27
28 #include <systemd/sd-bus.h>
29 #include <systemd/sd-event.h>
30
31 #include "daemon.h"
32
33 int nw_bus_connect(sd_bus* bus, sd_event* loop, struct nw_daemon* daemon);
34
35 struct nw_bus_implementation {
36 const char* path;
37 const char* interface;
38
39 const sd_bus_vtable** vtables;
40 };
41
42 #define BUS_VTABLES(...) ((const sd_bus_vtable* []){ __VA_ARGS__, NULL })
43
44 int nw_bus_register_implementation(sd_bus* bus,
45 const struct nw_bus_implementation* impl, void* data);
46
47 #endif /* NETWORKD_BUS_H */