]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/network/networkd-manager.h
build-sys: check for lz4 in the old and new numbering scheme (#4717)
[thirdparty/systemd.git] / src / network / networkd-manager.h
CommitLineData
0ef6f454
LP
1#pragma once
2
f579559b
TG
3/***
4 This file is part of systemd.
5
6 Copyright 2013 Tom Gundersen <teg@jklm.no>
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20***/
21
f579559b 22#include <arpa/inet.h>
f579559b 23
71d35b6b 24#include "sd-bus.h"
f579559b 25#include "sd-event.h"
1c4baffc 26#include "sd-netlink.h"
634f0f98 27#include "udev.h"
f579559b 28
634f0f98 29#include "dhcp-identifier.h"
f579559b
TG
30#include "hashmap.h"
31#include "list.h"
32
fc2f9534
LP
33#include "networkd-address-pool.h"
34#include "networkd-link.h"
71d35b6b 35#include "networkd-network.h"
11bf3cce 36
634f0f98
ZJS
37extern const char* const network_dirs[];
38
f579559b 39struct Manager {
1c4baffc 40 sd_netlink *rtnl;
f579559b 41 sd_event *event;
9c0a72f9 42 sd_event_source *bus_retry_event_source;
1346b1f0 43 sd_bus *bus;
9c0a72f9 44 sd_bus_slot *prepare_for_sleep_slot;
f579559b
TG
45 struct udev *udev;
46 struct udev_monitor *udev_monitor;
47 sd_event_source *udev_event_source;
48
84de38c5
TG
49 bool enumerating:1;
50 bool dirty:1;
51
52 Set *dirty_links;
6a24f148 53
bbf7c048 54 char *state_file;
e331e246 55 LinkOperationalState operational_state;
bbf7c048 56
f579559b 57 Hashmap *links;
52433f6b 58 Hashmap *netdevs;
dbffab87 59 Hashmap *networks_by_name;
f579559b 60 LIST_HEAD(Network, networks);
11bf3cce 61 LIST_HEAD(AddressPool, address_pools);
f579559b 62
f579559b 63 usec_t network_dirs_ts_usec;
413708d1 64
8341a5c3 65 DUID duid;
f579559b
TG
66};
67
8341a5c3
ZJS
68static inline const DUID* link_duid(const Link *link) {
69 if (link->network->duid.type != _DUID_TYPE_INVALID)
70 return &link->network->duid;
71 else
72 return &link->manager->duid;
73}
74
e331e246
TG
75extern const sd_bus_vtable manager_vtable[];
76
f579559b
TG
77int manager_new(Manager **ret);
78void manager_free(Manager *m);
79
8f203c16 80int manager_connect_bus(Manager *m);
a97dcc12
TG
81int manager_run(Manager *m);
82
02b59d57
TG
83int manager_load_config(Manager *m);
84bool manager_should_reload(Manager *m);
85
505f8da7 86int manager_rtnl_enumerate_links(Manager *m);
45af44d4 87int manager_rtnl_enumerate_addresses(Manager *m);
1c8e710c 88int manager_rtnl_enumerate_routes(Manager *m);
f579559b 89
200a0868 90int manager_rtnl_process_address(sd_netlink *nl, sd_netlink_message *message, void *userdata);
1c8e710c 91int manager_rtnl_process_route(sd_netlink *nl, sd_netlink_message *message, void *userdata);
200a0868 92
e331e246 93int manager_send_changed(Manager *m, const char *property, ...) _sentinel_;
84de38c5 94void manager_dirty(Manager *m);
3bef724f 95
0dd25fb9 96int manager_address_pool_acquire(Manager *m, int family, unsigned prefixlen, union in_addr_union *found);
11bf3cce 97
4f5f911e
LP
98Link* manager_find_uplink(Manager *m, Link *exclude);
99
f579559b
TG
100DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
101#define _cleanup_manager_free_ _cleanup_(manager_freep)