]> git.proxmox.com Git - systemd.git/blame - src/network/networkd.h
Merge tag 'upstream/229'
[systemd.git] / src / network / networkd.h
CommitLineData
60f067b4
JS
1/***
2 This file is part of systemd.
3
4 Copyright 2013 Tom Gundersen <teg@jklm.no>
5
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
10
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <http://www.gnu.org/licenses/>.
18***/
19
20#pragma once
21
22#include <arpa/inet.h>
23
4c89c718 24#include "sd-bus.h"
60f067b4 25#include "sd-event.h"
86f210e9 26#include "sd-netlink.h"
60f067b4 27
60f067b4
JS
28#include "hashmap.h"
29#include "list.h"
4c89c718 30#include "udev.h"
60f067b4 31
60f067b4 32typedef struct Manager Manager;
60f067b4 33
d9dfd233
MP
34#include "networkd-address-pool.h"
35#include "networkd-link.h"
4c89c718 36#include "networkd-network.h"
d9dfd233 37#include "networkd-util.h"
60f067b4
JS
38
39struct Manager {
86f210e9 40 sd_netlink *rtnl;
60f067b4 41 sd_event *event;
e735f4d4 42 sd_event_source *bus_retry_event_source;
60f067b4 43 sd_bus *bus;
e735f4d4 44 sd_bus_slot *prepare_for_sleep_slot;
60f067b4
JS
45 struct udev *udev;
46 struct udev_monitor *udev_monitor;
47 sd_event_source *udev_event_source;
60f067b4 48
db2df898
MP
49 bool enumerating:1;
50 bool dirty:1;
51
52 Set *dirty_links;
e735f4d4 53
60f067b4 54 char *state_file;
e735f4d4 55 LinkOperationalState operational_state;
60f067b4
JS
56
57 Hashmap *links;
58 Hashmap *netdevs;
e735f4d4 59 Hashmap *networks_by_name;
60f067b4 60 LIST_HEAD(Network, networks);
e842803a 61 LIST_HEAD(AddressPool, address_pools);
60f067b4
JS
62
63 usec_t network_dirs_ts_usec;
64};
65
66extern const char* const network_dirs[];
67
68/* Manager */
69
e735f4d4
MP
70extern const sd_bus_vtable manager_vtable[];
71
60f067b4
JS
72int manager_new(Manager **ret);
73void manager_free(Manager *m);
74
e735f4d4
MP
75int manager_connect_bus(Manager *m);
76int manager_run(Manager *m);
77
60f067b4
JS
78int manager_load_config(Manager *m);
79bool manager_should_reload(Manager *m);
80
81int manager_rtnl_enumerate_links(Manager *m);
f47781d8 82int manager_rtnl_enumerate_addresses(Manager *m);
db2df898
MP
83int manager_rtnl_enumerate_routes(Manager *m);
84
85int manager_rtnl_process_address(sd_netlink *nl, sd_netlink_message *message, void *userdata);
86int manager_rtnl_process_route(sd_netlink *nl, sd_netlink_message *message, void *userdata);
60f067b4 87
e735f4d4 88int manager_send_changed(Manager *m, const char *property, ...) _sentinel_;
db2df898 89void manager_dirty(Manager *m);
60f067b4 90
5eef597e 91int manager_address_pool_acquire(Manager *m, int family, unsigned prefixlen, union in_addr_union *found);
e842803a 92
d9dfd233
MP
93Link* manager_find_uplink(Manager *m, Link *exclude);
94
60f067b4
JS
95DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
96#define _cleanup_manager_free_ _cleanup_(manager_freep)