]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/network/networkd-routing-policy-rule.h
tree-wide: beautify remaining copyright statements
[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
4/***
96b2fb93 5 Copyright © 2017 Susant Sahani
bce67bbe
SS
6***/
7
8#include <inttypes.h>
9#include <stdbool.h>
10
11#include "in-addr-util.h"
a2106925 12#include "conf-parser.h"
bce67bbe
SS
13
14typedef struct RoutingPolicyRule RoutingPolicyRule;
15
16#include "networkd-link.h"
17#include "networkd-network.h"
18
19typedef struct Network Network;
20typedef struct Link Link;
21typedef struct NetworkConfigSection NetworkConfigSection;
36e6e28b 22typedef struct Manager Manager;
bce67bbe
SS
23
24struct RoutingPolicyRule {
6964cf45 25 Manager *manager;
bce67bbe
SS
26 Network *network;
27 Link *link;
28 NetworkConfigSection *section;
29
30 uint8_t tos;
31
32 uint32_t table;
33 uint32_t fwmark;
34 uint32_t fwmask;
35 uint32_t priority;
36
37 int family;
38 unsigned char to_prefixlen;
39 unsigned char from_prefixlen;
40
762e2659
SS
41 char *iif;
42 char *oif;
43
bce67bbe
SS
44 union in_addr_union to;
45 union in_addr_union from;
46
47 LIST_FIELDS(RoutingPolicyRule, rules);
48};
49
50int routing_policy_rule_new(RoutingPolicyRule **ret);
51void routing_policy_rule_free(RoutingPolicyRule *rule);
52
53DEFINE_TRIVIAL_CLEANUP_FUNC(RoutingPolicyRule*, routing_policy_rule_free);
bce67bbe
SS
54
55int routing_policy_rule_configure(RoutingPolicyRule *address, Link *link, sd_netlink_message_handler_t callback, bool update);
56int routing_policy_rule_remove(RoutingPolicyRule *routing_policy_rule, Link *link, sd_netlink_message_handler_t callback);
57int link_routing_policy_rule_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata);
58int link_routing_policy_rule_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata);
59
60int 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 61 uint8_t tos, uint32_t fwmark, uint32_t table, char *iif, char *oif, RoutingPolicyRule **ret);
bce67bbe 62int 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 63 uint8_t tos, uint32_t fwmark, uint32_t table, char *iif, char *oif, RoutingPolicyRule **ret);
bce67bbe 64int 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 65 uint32_t fwmark, uint32_t table, char *iif, char *oif, RoutingPolicyRule **ret);
bce67bbe 66int routing_policy_rule_make_local(Manager *m, RoutingPolicyRule *rule);
458d8ae3
ZJS
67int routing_policy_serialize_rules(Set *rules, FILE *f);
68int routing_policy_load_rules(const char *state_file, Set **rules);
bce67bbe
SS
69void routing_policy_rule_purge(Manager *m, Link *link);
70
a2106925
LP
71CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_tos);
72CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_table);
73CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_fwmark_mask);
74CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_prefix);
75CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_priority);
76CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_device);