00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef NETLINK_CLS_EMATCH_H_
00013 #define NETLINK_CLS_EMATCH_H_
00014
00015 #include <netlink/netlink.h>
00016 #include <netlink/msg.h>
00017 #include <netlink/route/classifier.h>
00018 #include <linux/pkt_cls.h>
00019
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023
00024
00025 #define RTNL_EMATCH_PROGID 2
00026
00027 struct rtnl_ematch;
00028 struct rtnl_ematch_tree;
00029
00030
00031
00032
00033 struct rtnl_ematch_ops
00034 {
00035 int eo_kind;
00036 const char * eo_name;
00037 size_t eo_minlen;
00038 size_t eo_datalen;
00039
00040 int (*eo_parse)(struct rtnl_ematch *, void *, size_t);
00041 void (*eo_dump)(struct rtnl_ematch *,
00042 struct nl_dump_params *);
00043 int (*eo_fill)(struct rtnl_ematch *, struct nl_msg *);
00044 void (*eo_free)(struct rtnl_ematch *);
00045 struct nl_list_head eo_list;
00046 };
00047
00048 extern int rtnl_ematch_register(struct rtnl_ematch_ops *);
00049 extern struct rtnl_ematch_ops * rtnl_ematch_lookup_ops(int);
00050 extern struct rtnl_ematch_ops * rtnl_ematch_lookup_ops_by_name(const char *);
00051
00052 extern struct rtnl_ematch * rtnl_ematch_alloc(void);
00053 extern int rtnl_ematch_add_child(struct rtnl_ematch *,
00054 struct rtnl_ematch *);
00055 extern void rtnl_ematch_unlink(struct rtnl_ematch *);
00056 extern void rtnl_ematch_free(struct rtnl_ematch *);
00057
00058 extern void * rtnl_ematch_data(struct rtnl_ematch *);
00059 extern void rtnl_ematch_set_flags(struct rtnl_ematch *,
00060 uint16_t);
00061 extern void rtnl_ematch_unset_flags(struct rtnl_ematch *,
00062 uint16_t);
00063 extern uint16_t rtnl_ematch_get_flags(struct rtnl_ematch *);
00064 extern int rtnl_ematch_set_ops(struct rtnl_ematch *,
00065 struct rtnl_ematch_ops *);
00066 extern int rtnl_ematch_set_kind(struct rtnl_ematch *,
00067 uint16_t);
00068 extern int rtnl_ematch_set_name(struct rtnl_ematch *,
00069 const char *);
00070
00071 extern struct rtnl_ematch_tree *rtnl_ematch_tree_alloc(uint16_t);
00072 extern void rtnl_ematch_tree_free(struct rtnl_ematch_tree *);
00073 extern void rtnl_ematch_tree_add(struct rtnl_ematch_tree *,
00074 struct rtnl_ematch *);
00075
00076 extern int rtnl_ematch_parse_attr(struct nlattr *,
00077 struct rtnl_ematch_tree **);
00078 extern int rtnl_ematch_fill_attr(struct nl_msg *, int,
00079 struct rtnl_ematch_tree *);
00080 extern void rtnl_ematch_tree_dump(struct rtnl_ematch_tree *,
00081 struct nl_dump_params *);
00082
00083
00084 extern int rtnl_ematch_parse_expr(const char *, char **,
00085 struct rtnl_ematch_tree **);
00086
00087 extern char * rtnl_ematch_offset2txt(uint8_t, uint16_t,
00088 char *, size_t);
00089 extern char * rtnl_ematch_opnd2txt(uint8_t, char *, size_t);
00090
00091 #ifdef __cplusplus
00092 }
00093 #endif
00094
00095 #endif