]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/network/networkd-routing-policy-rule.h
resolved: do not keep dns_server to dns_stream ref if tls connection failed (#9855)
[thirdparty/systemd.git] / src / network / networkd-routing-policy-rule.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
bce67bbe
SS
2#pragma once
3
bce67bbe
SS
4#include <inttypes.h>
5#include <stdbool.h>
6
7#include "in-addr-util.h"
a2106925 8#include "conf-parser.h"
bce67bbe
SS
9
10typedef struct RoutingPolicyRule RoutingPolicyRule;
11
12#include "networkd-link.h"
13#include "networkd-network.h"
14
15typedef struct Network Network;
16typedef struct Link Link;
17typedef struct NetworkConfigSection NetworkConfigSection;
36e6e28b 18typedef struct Manager Manager;
bce67bbe
SS
19
20struct RoutingPolicyRule {
6964cf45 21 Manager *manager;
bce67bbe
SS
22 Network *network;
23 Link *link;
24 NetworkConfigSection *section;
25
26 uint8_t tos;
27
28 uint32_t table;
29 uint32_t fwmark;
30 uint32_t fwmask;
31 uint32_t priority;
32
33 int family;
34 unsigned char to_prefixlen;
35 unsigned char from_prefixlen;
36
762e2659
SS
37 char *iif;
38 char *oif;
39
bce67bbe
SS
40 union in_addr_union to;
41 union in_addr_union from;
42
43 LIST_FIELDS(RoutingPolicyRule, rules);
44};
45
46int routing_policy_rule_new(RoutingPolicyRule **ret);
47void routing_policy_rule_free(RoutingPolicyRule *rule);
48
49DEFINE_TRIVIAL_CLEANUP_FUNC(RoutingPolicyRule*, routing_policy_rule_free);
bce67bbe
SS
50
51int routing_policy_rule_configure(RoutingPolicyRule *address, Link *link, sd_netlink_message_handler_t callback, bool update);
52int routing_policy_rule_remove(RoutingPolicyRule *routing_policy_rule, Link *link, sd_netlink_message_handler_t callback);
53int link_routing_policy_rule_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata);
54int link_routing_policy_rule_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata);
55
56int routing_policy_rule_add(Manager *m, int family, const union in_addr_union *from, uint8_t from_prefixlen, const union in_addr_union *to, uint8_t to_prefixlen,
762e2659 57 uint8_t tos, uint32_t fwmark, uint32_t table, char *iif, char *oif, RoutingPolicyRule **ret);
bce67bbe 58int routing_policy_rule_add_foreign(Manager *m, int family, const union in_addr_union *from, uint8_t from_prefixlen, const union in_addr_union *to, uint8_t to_prefixlen,
762e2659 59 uint8_t tos, uint32_t fwmark, uint32_t table, char *iif, char *oif, RoutingPolicyRule **ret);
bce67bbe 60int routing_policy_rule_get(Manager *m, int family, const union in_addr_union *from, uint8_t from_prefixlen, const union in_addr_union *to, uint8_t to_prefixlen, uint8_t tos,
762e2659 61 uint32_t fwmark, uint32_t table, char *iif, char *oif, RoutingPolicyRule **ret);
bce67bbe 62int routing_policy_rule_make_local(Manager *m, RoutingPolicyRule *rule);
458d8ae3
ZJS
63int routing_policy_serialize_rules(Set *rules, FILE *f);
64int routing_policy_load_rules(const char *state_file, Set **rules);
bce67bbe
SS
65void routing_policy_rule_purge(Manager *m, Link *link);
66
a2106925
LP
67CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_tos);
68CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_table);
69CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_fwmark_mask);
70CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_prefix);
71CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_priority);
72CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_device);