]> git.ipfire.org Git - people/ms/network.git/blob - src/networkd/daemon.h
networkd: Save configuration when the daemon exits
[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 <systemd/sd-netlink.h>
25
26 typedef struct nw_daemon nw_daemon;
27
28 #include "link.h"
29 #include "links.h"
30 #include "port.h"
31 #include "ports.h"
32 #include "zone.h"
33 #include "zones.h"
34
35 int nw_daemon_create(nw_daemon** daemon);
36
37 nw_daemon* nw_daemon_ref(nw_daemon* daemon);
38 nw_daemon* nw_daemon_unref(nw_daemon* daemon);
39
40 int nw_daemon_run(nw_daemon* daemon);
41
42 int nw_daemon_reload(nw_daemon* daemon);
43
44 int nw_daemon_save(nw_daemon* daemon);
45
46 /*
47 Netlink
48 */
49 sd_netlink* nw_daemon_get_rtnl(nw_daemon* daemon);
50
51 /*
52 Links
53 */
54 nw_links* nw_daemon_links(nw_daemon* daemon);
55 void nw_daemon_drop_link(nw_daemon* daemon, nw_link* link);
56 nw_link* nw_daemon_get_link_by_ifindex(nw_daemon* daemon, int ifindex);
57 nw_link* nw_daemon_get_link_by_name(nw_daemon* daemon, const char* name);
58
59 /*
60 Ports
61 */
62 nw_ports* nw_daemon_ports(nw_daemon* daemon);
63 nw_port* nw_daemon_get_port_by_name(nw_daemon* daemon, const char* name);
64
65 /*
66 Zones
67 */
68 nw_zones* nw_daemon_zones(nw_daemon* daemon);
69 nw_zone* nw_daemon_get_zone_by_name(nw_daemon* daemon, const char* name);
70
71 #endif /* NETWORKD_DAEMON_H */