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