]>
Commit | Line | Data |
---|---|---|
f579559b TG |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
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 | ||
22 | #pragma once | |
23 | ||
24 | #include <arpa/inet.h> | |
f579559b TG |
25 | |
26 | #include "sd-event.h" | |
1c4baffc | 27 | #include "sd-netlink.h" |
1346b1f0 | 28 | #include "sd-bus.h" |
f579559b TG |
29 | #include "udev.h" |
30 | ||
f579559b TG |
31 | #include "hashmap.h" |
32 | #include "list.h" | |
33 | ||
f579559b | 34 | typedef struct Manager Manager; |
6ae115c1 | 35 | |
fc2f9534 LP |
36 | #include "networkd-network.h" |
37 | #include "networkd-address-pool.h" | |
38 | #include "networkd-link.h" | |
39 | #include "networkd-util.h" | |
11bf3cce | 40 | |
f579559b | 41 | struct Manager { |
1c4baffc | 42 | sd_netlink *rtnl; |
f579559b | 43 | sd_event *event; |
9c0a72f9 | 44 | sd_event_source *bus_retry_event_source; |
1346b1f0 | 45 | sd_bus *bus; |
9c0a72f9 | 46 | sd_bus_slot *prepare_for_sleep_slot; |
f579559b TG |
47 | struct udev *udev; |
48 | struct udev_monitor *udev_monitor; | |
49 | sd_event_source *udev_event_source; | |
50 | ||
6a24f148 TG |
51 | bool enumerating; |
52 | ||
bbf7c048 | 53 | char *state_file; |
e331e246 | 54 | LinkOperationalState operational_state; |
bbf7c048 | 55 | |
f579559b | 56 | Hashmap *links; |
52433f6b | 57 | Hashmap *netdevs; |
dbffab87 | 58 | Hashmap *networks_by_name; |
f579559b | 59 | LIST_HEAD(Network, networks); |
11bf3cce | 60 | LIST_HEAD(AddressPool, address_pools); |
f579559b | 61 | |
f579559b TG |
62 | usec_t network_dirs_ts_usec; |
63 | }; | |
64 | ||
2ad8416d ZJS |
65 | extern const char* const network_dirs[]; |
66 | ||
f579559b TG |
67 | /* Manager */ |
68 | ||
e331e246 TG |
69 | extern const sd_bus_vtable manager_vtable[]; |
70 | ||
f579559b TG |
71 | int manager_new(Manager **ret); |
72 | void manager_free(Manager *m); | |
73 | ||
8f203c16 | 74 | int manager_connect_bus(Manager *m); |
a97dcc12 TG |
75 | int manager_run(Manager *m); |
76 | ||
02b59d57 TG |
77 | int manager_load_config(Manager *m); |
78 | bool manager_should_reload(Manager *m); | |
79 | ||
505f8da7 | 80 | int manager_rtnl_enumerate_links(Manager *m); |
45af44d4 | 81 | int manager_rtnl_enumerate_addresses(Manager *m); |
f579559b | 82 | |
e331e246 | 83 | int manager_send_changed(Manager *m, const char *property, ...) _sentinel_; |
bbf7c048 | 84 | int manager_save(Manager *m); |
3bef724f | 85 | |
0dd25fb9 | 86 | int manager_address_pool_acquire(Manager *m, int family, unsigned prefixlen, union in_addr_union *found); |
11bf3cce | 87 | |
4f5f911e LP |
88 | Link* manager_find_uplink(Manager *m, Link *exclude); |
89 | ||
f579559b TG |
90 | DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free); |
91 | #define _cleanup_manager_free_ _cleanup_(manager_freep) |