]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/network/networkd-route-util.h
Merge pull request #32684 from YHNdnzj/pr-followups
[thirdparty/systemd.git] / src / network / networkd-route-util.h
CommitLineData
344b3cff
YW
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2#pragma once
3
4#include <inttypes.h>
5#include <stdbool.h>
6
7#include "conf-parser.h"
8
9typedef struct Link Link;
10typedef struct Manager Manager;
8b7615f9 11typedef struct Address Address;
fc35a9f8 12typedef struct Route Route;
344b3cff
YW
13
14unsigned routes_max(void);
15
b9f29e9f
YW
16bool route_type_is_reject(const Route *route);
17
fc35a9f8
YW
18bool link_find_default_gateway(Link *link, int family, Route **gw);
19static inline bool link_has_default_gateway(Link *link, int family) {
20 return link_find_default_gateway(link, family, NULL);
21}
22
344b3cff
YW
23int manager_find_uplink(Manager *m, int family, Link *exclude, Link **ret);
24
25bool gateway_is_ready(Link *link, bool onlink, int family, const union in_addr_union *gw);
26
8b7615f9
YW
27int link_address_is_reachable(
28 Link *link,
29 int family,
30 const union in_addr_union *address,
31 const union in_addr_union *prefsrc, /* optional */
32 Address **ret);
33
34int manager_address_is_reachable(
35 Manager *manager,
36 int family,
37 const union in_addr_union *address,
38 const union in_addr_union *prefsrc, /* optional */
39 Address **ret);
40
344b3cff
YW
41int route_type_from_string(const char *s) _pure_;
42const char *route_type_to_string(int t) _const_;
43
44int route_scope_from_string(const char *s);
45int route_scope_to_string_alloc(int t, char **ret);
46
47int route_protocol_from_string(const char *s);
48int route_protocol_to_string_alloc(int t, char **ret);
49int route_protocol_full_from_string(const char *s);
50int route_protocol_full_to_string_alloc(int t, char **ret);
51
18b23bd4
YW
52int route_flags_to_string_alloc(uint32_t flags, char **ret);
53
344b3cff 54int manager_get_route_table_from_string(const Manager *m, const char *table, uint32_t *ret);
f4defbdc 55int manager_get_route_table_to_string(const Manager *m, uint32_t table, bool append_num, char **ret);
344b3cff
YW
56
57CONFIG_PARSER_PROTOTYPE(config_parse_route_table_names);