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