• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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-2008 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 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 struct rtnl_rule;
25 
26 /* General */
27 extern struct rtnl_rule *	rtnl_rule_alloc(void);
28 extern void			rtnl_rule_put(struct rtnl_rule *);
29 
30 extern int	rtnl_rule_alloc_cache(struct nl_sock *, int,
31 				      struct nl_cache **);
32 extern void rtnl_rule_dump(struct rtnl_rule *, FILE *, struct nl_dump_params *);
33 
34 extern int	rtnl_rule_build_add_request(struct rtnl_rule *, int,
35 					    struct nl_msg **);
36 extern int rtnl_rule_add(struct nl_sock *, struct rtnl_rule *, int);
37 extern int	rtnl_rule_build_delete_request(struct rtnl_rule *, int,
38 					       struct nl_msg **);
39 extern int rtnl_rule_delete(struct nl_sock *, struct rtnl_rule *, int);
40 
41 
42 /* attribute modification */
43 extern void		rtnl_rule_set_family(struct rtnl_rule *, int);
44 extern int		rtnl_rule_get_family(struct rtnl_rule *);
45 extern void		rtnl_rule_set_prio(struct rtnl_rule *, int);
46 extern int		rtnl_rule_get_prio(struct rtnl_rule *);
47 extern void		rtnl_rule_set_mark(struct rtnl_rule *, uint64_t);
48 extern uint64_t		rtnl_rule_get_mark(struct rtnl_rule *);
49 extern void		rtnl_rule_set_table(struct rtnl_rule *, int);
50 extern int		rtnl_rule_get_table(struct rtnl_rule *);
51 extern void		rtnl_rule_set_dsfield(struct rtnl_rule *, int);
52 extern int		rtnl_rule_get_dsfield(struct rtnl_rule *);
53 extern int		rtnl_rule_set_src(struct rtnl_rule *, struct nl_addr *);
54 extern struct nl_addr *	rtnl_rule_get_src(struct rtnl_rule *);
55 extern int		rtnl_rule_set_dst(struct rtnl_rule *, struct nl_addr *);
56 extern struct nl_addr *	rtnl_rule_get_dst(struct rtnl_rule *);
57 extern void		rtnl_rule_set_src_len(struct rtnl_rule *, int);
58 extern int		rtnl_rule_get_src_len(struct rtnl_rule *);
59 extern void		rtnl_rule_set_dst_len(struct rtnl_rule *, int);
60 extern int		rtnl_rule_get_dst_len(struct rtnl_rule *);
61 
62 extern void		rtnl_rule_set_action(struct rtnl_rule *, int);
63 extern int		rtnl_rule_get_action(struct rtnl_rule *);
64 
65 extern int		rtnl_rule_set_iif(struct rtnl_rule *, const char *);
66 extern char *		rtnl_rule_get_iif(struct rtnl_rule *);
67 
68 extern void		rtnl_rule_set_classid(struct rtnl_rule *, uint32_t);
69 extern uint32_t		rtnl_rule_get_classid(struct rtnl_rule *);
70 
71 extern void		rtnl_rule_set_realms(struct rtnl_rule *, uint32_t);
72 extern uint32_t		rtnl_rule_get_realms(struct rtnl_rule *);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif
79