summaryrefslogtreecommitdiffstats
path: root/libnl_2/include/netlink/route/rule.h
blob: 928dc0f174846cd7afc9cb92a5d2eb1cc7f89a45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * netlink/route/rule.h		Rules
 *
 *	This library is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU Lesser General Public
 *	License as published by the Free Software Foundation version 2.1
 *	of the License.
 *
 * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
 */

#ifndef NETLINK_RULE_H_
#define NETLINK_RULE_H_

#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#include <netlink/route/route.h>

#ifdef __cplusplus
extern "C" {
#endif

struct rtnl_rule;

/* General */
extern struct rtnl_rule *	rtnl_rule_alloc(void);
extern void			rtnl_rule_put(struct rtnl_rule *);

extern int	rtnl_rule_alloc_cache(struct nl_sock *, int,
				      struct nl_cache **);
extern void rtnl_rule_dump(struct rtnl_rule *, FILE *, struct nl_dump_params *);

extern int	rtnl_rule_build_add_request(struct rtnl_rule *, int,
					    struct nl_msg **);
extern int rtnl_rule_add(struct nl_sock *, struct rtnl_rule *, int);
extern int	rtnl_rule_build_delete_request(struct rtnl_rule *, int,
					       struct nl_msg **);
extern int rtnl_rule_delete(struct nl_sock *, struct rtnl_rule *, int);


/* attribute modification */
extern void		rtnl_rule_set_family(struct rtnl_rule *, int);
extern int		rtnl_rule_get_family(struct rtnl_rule *);
extern void		rtnl_rule_set_prio(struct rtnl_rule *, int);
extern int		rtnl_rule_get_prio(struct rtnl_rule *);
extern void		rtnl_rule_set_mark(struct rtnl_rule *, uint64_t);
extern uint64_t		rtnl_rule_get_mark(struct rtnl_rule *);
extern void		rtnl_rule_set_table(struct rtnl_rule *, int);
extern int		rtnl_rule_get_table(struct rtnl_rule *);
extern void		rtnl_rule_set_dsfield(struct rtnl_rule *, int);
extern int		rtnl_rule_get_dsfield(struct rtnl_rule *);
extern int		rtnl_rule_set_src(struct rtnl_rule *, struct nl_addr *);
extern struct nl_addr *	rtnl_rule_get_src(struct rtnl_rule *);
extern int		rtnl_rule_set_dst(struct rtnl_rule *, struct nl_addr *);
extern struct nl_addr *	rtnl_rule_get_dst(struct rtnl_rule *);
extern void		rtnl_rule_set_src_len(struct rtnl_rule *, int);
extern int		rtnl_rule_get_src_len(struct rtnl_rule *);
extern void		rtnl_rule_set_dst_len(struct rtnl_rule *, int);
extern int		rtnl_rule_get_dst_len(struct rtnl_rule *);

extern void		rtnl_rule_set_action(struct rtnl_rule *, int);
extern int		rtnl_rule_get_action(struct rtnl_rule *);

extern int		rtnl_rule_set_iif(struct rtnl_rule *, const char *);
extern char *		rtnl_rule_get_iif(struct rtnl_rule *);

extern void		rtnl_rule_set_classid(struct rtnl_rule *, uint32_t);
extern uint32_t		rtnl_rule_get_classid(struct rtnl_rule *);

extern void		rtnl_rule_set_realms(struct rtnl_rule *, uint32_t);
extern uint32_t		rtnl_rule_get_realms(struct rtnl_rule *);

#ifdef __cplusplus
}
#endif

#endif