]>
Commit | Line | Data |
---|---|---|
e4a71bf3 WKI |
1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
2 | #pragma once | |
3 | ||
4 | #include "sd-netlink.h" | |
5 | ||
6 | #include "conf-parser.h" | |
7 | #include "ether-addr-util.h" | |
8 | #include "in-addr-util.h" | |
9 | #include "list.h" | |
10 | #include "macro.h" | |
11 | ||
12 | typedef struct Neighbor Neighbor; | |
13 | ||
14 | #include "networkd-link.h" | |
15 | #include "networkd-network.h" | |
fcbf4cb7 | 16 | #include "networkd-util.h" |
e4a71bf3 | 17 | |
d1bdafd2 WKI |
18 | union lladdr_union { |
19 | struct ether_addr mac; | |
20 | union in_addr_union ip; | |
21 | }; | |
22 | ||
e4a71bf3 WKI |
23 | struct Neighbor { |
24 | Network *network; | |
25 | Link *link; | |
26 | NetworkConfigSection *section; | |
27 | ||
28 | int family; | |
29 | union in_addr_union in_addr; | |
d1bdafd2 | 30 | union lladdr_union lladdr; |
f9ab224e | 31 | size_t lladdr_size; |
e4a71bf3 WKI |
32 | |
33 | LIST_FIELDS(Neighbor, neighbors); | |
34 | }; | |
35 | ||
36 | void neighbor_free(Neighbor *neighbor); | |
37 | ||
fcbf4cb7 | 38 | DEFINE_NETWORK_SECTION_FUNCTIONS(Neighbor, neighbor_free); |
e4a71bf3 WKI |
39 | |
40 | int neighbor_configure(Neighbor *neighbor, Link *link, link_netlink_message_handler_t callback); | |
d1bdafd2 WKI |
41 | int neighbor_remove(Neighbor *neighbor, Link *link, link_netlink_message_handler_t callback); |
42 | ||
43 | int neighbor_get(Link *link, int family, const union in_addr_union *addr, const union lladdr_union *lladdr, size_t lladdr_size, Neighbor **ret); | |
44 | int neighbor_add(Link *link, int family, const union in_addr_union *addr, const union lladdr_union *lladdr, size_t lladdr_size, Neighbor **ret); | |
45 | int neighbor_add_foreign(Link *link, int family, const union in_addr_union *addr, const union lladdr_union *lladdr, size_t lladdr_size, Neighbor **ret); | |
46 | bool neighbor_equal(const Neighbor *n1, const Neighbor *n2); | |
e4a71bf3 | 47 | |
044d4b40 YW |
48 | int neighbor_section_verify(Neighbor *neighbor); |
49 | ||
58f1fe9a YW |
50 | int link_set_neighbors(Link *link); |
51 | ||
e4a71bf3 WKI |
52 | CONFIG_PARSER_PROTOTYPE(config_parse_neighbor_address); |
53 | CONFIG_PARSER_PROTOTYPE(config_parse_neighbor_hwaddr); | |
b956364d | 54 | CONFIG_PARSER_PROTOTYPE(config_parse_neighbor_lladdr); |