]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/networkd-route-nexthop.h
network: make Reload bus method synchronous
[thirdparty/systemd.git] / src / network / networkd-route-nexthop.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include <inttypes.h>
5 #include <stdbool.h>
6
7 #include "sd-netlink.h"
8
9 #include "conf-parser.h"
10 #include "in-addr-util.h"
11 #include "macro.h"
12 #include "siphash24.h"
13
14 typedef struct Link Link;
15 typedef struct Manager Manager;
16 typedef struct Route Route;
17
18 typedef struct RouteNextHop {
19 int family; /* used in RTA_VIA (IPv4 only) */
20 union in_addr_union gw; /* RTA_GATEWAY or RTA_VIA (IPv4 only) */
21 uint32_t weight; /* rtnh_hops */
22 int ifindex; /* RTA_OIF(u32) or rtnh_ifindex */
23 char *ifname; /* only used by Route object owned by Network object */
24 /* unsupported attributes: RTA_FLOW (IPv4 only), RTA_ENCAP_TYPE, RTA_ENCAP. */
25 } RouteNextHop;
26
27 #define ROUTE_NEXTHOP_NULL ((const RouteNextHop) {})
28
29 void route_detach_from_nexthop(Route *route);
30 void route_attach_to_nexthop(Route *route);
31
32 RouteNextHop* route_nexthop_free(RouteNextHop *nh);
33 DEFINE_TRIVIAL_CLEANUP_FUNC(RouteNextHop*, route_nexthop_free);
34
35 void route_nexthops_done(Route *route);
36
37 void route_nexthops_hash_func(const Route *route, struct siphash *state);
38 int route_nexthops_compare_func(const Route *a, const Route *b);
39
40 int route_nexthops_copy(const Route *src, const RouteNextHop *nh, Route *dest);
41 bool route_nexthops_needs_adjust(const Route *route);
42 int route_adjust_nexthops(Route *route, Link *link);
43
44 int route_nexthop_get_link(Manager *manager, const RouteNextHop *nh, Link **ret);
45 int route_nexthops_is_ready_to_configure(const Route *route, Manager *manager);
46
47 int route_nexthops_to_string(const Route *route, char **ret);
48
49 int route_nexthops_set_netlink_message(const Route *route, sd_netlink_message *message);
50 int route_nexthops_read_netlink_message(Route *route, sd_netlink_message *message);
51
52 int route_section_verify_nexthops(Route *route);
53
54 CONFIG_PARSER_PROTOTYPE(config_parse_gateway);
55 CONFIG_PARSER_PROTOTYPE(config_parse_route_gateway_onlink);
56 CONFIG_PARSER_PROTOTYPE(config_parse_route_nexthop);
57 CONFIG_PARSER_PROTOTYPE(config_parse_multipath_route);