]> git.ipfire.org Git - people/ms/network.git/blob - src/networkd/daemon.h
Makefile: Fix typo in localstatedir
[people/ms/network.git] / src / networkd / daemon.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_DAEMON_H
22 #define NETWORKD_DAEMON_H
23
24 #include <dirent.h>
25 #include <stdio.h>
26
27 #include <systemd/sd-bus.h>
28 #include <systemd/sd-netlink.h>
29
30 typedef struct nw_daemon nw_daemon;
31
32 #include "config.h"
33 #include "link.h"
34 #include "links.h"
35 #include "port.h"
36 #include "ports.h"
37 #include "zone.h"
38 #include "zones.h"
39
40 int nw_daemon_create(nw_daemon** daemon, int argc, char* argv[]);
41
42 nw_daemon* nw_daemon_ref(nw_daemon* daemon);
43 nw_daemon* nw_daemon_unref(nw_daemon* daemon);
44
45 int nw_daemon_run(nw_daemon* daemon);
46
47 int nw_daemon_reload(nw_daemon* daemon);
48
49 int nw_daemon_save(nw_daemon* daemon);
50
51 nw_configd* nw_daemon_configd(nw_daemon* daemon, const char* path);
52
53 /*
54 Bus
55 */
56 sd_bus* nw_daemon_get_bus(nw_daemon* daemon);
57
58 /*
59 Netlink
60 */
61 sd_netlink* nw_daemon_get_rtnl(nw_daemon* daemon);
62
63 /*
64 Links
65 */
66 nw_links* nw_daemon_links(nw_daemon* daemon);
67 void nw_daemon_drop_link(nw_daemon* daemon, nw_link* link);
68 nw_link* nw_daemon_get_link_by_ifindex(nw_daemon* daemon, int ifindex);
69 nw_link* nw_daemon_get_link_by_name(nw_daemon* daemon, const char* name);
70
71 /*
72 Ports
73 */
74 nw_ports* nw_daemon_ports(nw_daemon* daemon);
75 int nw_daemon_ports_walk(nw_daemon* daemon, nw_ports_walk_callback callback, void* data);
76 nw_port* nw_daemon_get_port_by_name(nw_daemon* daemon, const char* name);
77
78 /*
79 Zones
80 */
81 nw_zones* nw_daemon_zones(nw_daemon* daemon);
82 int nw_daemon_zones_walk(nw_daemon* daemon, nw_zones_walk_callback callback, void* data);
83 nw_zone* nw_daemon_get_zone_by_name(nw_daemon* daemon, const char* name);
84
85 #endif /* NETWORKD_DAEMON_H */