blob: 760b782ad09efd110b631acae35c5318da68367f [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/*
2 * netlink/route/rule.h Rules
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation version 2.1
7 * of the License.
8 *
9 * Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch>
10 */
11
12#ifndef NETLINK_RULE_H_
13#define NETLINK_RULE_H_
14
15#include <netlink/netlink.h>
16#include <netlink/cache.h>
17#include <netlink/addr.h>
18#include <netlink/route/route.h>
19#include <linux/fib_rules.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25struct rtnl_rule;
26
27/* General */
28extern struct rtnl_rule * rtnl_rule_alloc(void);
29extern void rtnl_rule_put(struct rtnl_rule *);
30
31extern int rtnl_rule_alloc_cache(struct nl_sock *, int,
32 struct nl_cache **);
33extern void rtnl_rule_dump(struct rtnl_rule *, FILE *, struct nl_dump_params *);
34
35extern int rtnl_rule_build_add_request(struct rtnl_rule *, int,
36 struct nl_msg **);
37extern int rtnl_rule_add(struct nl_sock *, struct rtnl_rule *, int);
38extern int rtnl_rule_build_delete_request(struct rtnl_rule *, int,
39 struct nl_msg **);
40extern int rtnl_rule_delete(struct nl_sock *, struct rtnl_rule *, int);
41
42
43/* attribute modification */
44extern void rtnl_rule_set_family(struct rtnl_rule *, int);
45extern int rtnl_rule_get_family(struct rtnl_rule *);
46extern void rtnl_rule_set_prio(struct rtnl_rule *, uint32_t);
47extern uint32_t rtnl_rule_get_prio(struct rtnl_rule *);
48extern void rtnl_rule_set_mark(struct rtnl_rule *, uint32_t);
49extern uint32_t rtnl_rule_get_mark(struct rtnl_rule *);
50extern void rtnl_rule_set_mask(struct rtnl_rule *, uint32_t);
51extern uint32_t rtnl_rule_get_mask(struct rtnl_rule *);
52extern void rtnl_rule_set_table(struct rtnl_rule *, uint32_t);
53extern uint32_t rtnl_rule_get_table(struct rtnl_rule *);
54extern void rtnl_rule_set_dsfield(struct rtnl_rule *, uint8_t);
55extern uint8_t rtnl_rule_get_dsfield(struct rtnl_rule *);
56extern int rtnl_rule_set_src(struct rtnl_rule *, struct nl_addr *);
57extern struct nl_addr * rtnl_rule_get_src(struct rtnl_rule *);
58extern int rtnl_rule_set_dst(struct rtnl_rule *, struct nl_addr *);
59extern struct nl_addr * rtnl_rule_get_dst(struct rtnl_rule *);
60extern void rtnl_rule_set_action(struct rtnl_rule *, uint8_t);
61extern uint8_t rtnl_rule_get_action(struct rtnl_rule *);
62extern int rtnl_rule_set_iif(struct rtnl_rule *, const char *);
63extern char * rtnl_rule_get_iif(struct rtnl_rule *);
64extern int rtnl_rule_set_oif(struct rtnl_rule *, const char *);
65extern char * rtnl_rule_get_oif(struct rtnl_rule *);
66extern void rtnl_rule_set_realms(struct rtnl_rule *, uint32_t);
67extern uint32_t rtnl_rule_get_realms(struct rtnl_rule *);
68extern void rtnl_rule_set_goto(struct rtnl_rule *, uint32_t);
69extern uint32_t rtnl_rule_get_goto(struct rtnl_rule *);
70
71#ifdef __cplusplus
72}
73#endif
74
75#endif