1 /* 2 * netlink/route/cls/ematch.h Extended Matches 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) 2008 Thomas Graf <tgraf@suug.ch> 10 */ 11 12 #ifndef NETLINK_CLS_EMATCH_H_ 13 #define NETLINK_CLS_EMATCH_H_ 14 15 #include <netlink/netlink.h> 16 #include <netlink/route/classifier.h> 17 #include <linux/pkt_cls.h> 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 struct rtnl_ematch; 24 struct rtnl_ematch_tree; 25 26 struct rtnl_ematch_ops 27 { 28 int eo_kind; 29 const char * eo_name; 30 size_t eo_datalen; 31 32 int (*eo_parse)(struct rtnl_ematch *, 33 void *, size_t); 34 void (*eo_dump)(struct rtnl_ematch *, 35 struct nl_dump_params *); 36 struct nl_list_head eo_list; 37 }; 38 39 extern int rtnl_ematch_register(struct rtnl_ematch_ops *); 40 extern int rtnl_ematch_unregister(struct rtnl_ematch_ops *); 41 42 extern struct rtnl_ematch_ops * 43 rtnl_ematch_lookup_ops(int); 44 extern struct rtnl_ematch_ops * 45 rtnl_ematch_lookup_ops_name(const char *); 46 47 extern struct rtnl_ematch * 48 rtnl_ematch_alloc(struct rtnl_ematch_ops *); 49 extern void rtnl_ematch_add_child(struct rtnl_ematch *, 50 struct rtnl_ematch *); 51 extern void rtnl_ematch_unlink(struct rtnl_ematch *); 52 extern void rtnl_ematch_free(struct rtnl_ematch *); 53 54 extern void * rtnl_ematch_data(struct rtnl_ematch *); 55 extern void rtnl_ematch_set_flags(struct rtnl_ematch *, uint16_t); 56 extern void rtnl_ematch_unset_flags(struct rtnl_ematch *, uint16_t); 57 extern uint16_t rtnl_ematch_get_flags(struct rtnl_ematch *); 58 59 extern struct rtnl_ematch_tree * 60 rtnl_ematch_tree_alloc(uint16_t); 61 extern void rtnl_ematch_tree_free(struct rtnl_ematch_tree *); 62 63 extern int rtnl_ematch_parse(struct nlattr *, struct rtnl_ematch_tree **); 64 extern void rtnl_ematch_tree_add_tail(struct rtnl_ematch_tree *, 65 struct rtnl_ematch *); 66 extern void rtnl_ematch_tree_dump(struct rtnl_ematch_tree *, 67 struct nl_dump_params *); 68 69 #ifdef __cplusplus 70 } 71 #endif 72 73 #endif 74