11 #define EMATCHKINDSIZ 16
21 extern struct bstr * bstr_alloc(const char *text);
23 static inline struct bstr * bstr_new(char *data, unsigned int len)
25 struct bstr *b = calloc(1, sizeof(*b));
36 static inline int bstrcmp(struct bstr *b, const char *text)
38 int len = strlen(text);
42 return strncmp(b->data, text, len);
47 static inline struct bstr *bstr_next(struct bstr *b)
52 extern unsigned long bstrtoul(const struct bstr *b);
53 extern void bstr_print(FILE *fd, const struct bstr *b, int ascii);
67 static inline struct ematch * new_ematch(struct bstr *args, int inverted)
69 struct ematch *e = calloc(1, sizeof(*e));
75 e->inverted = inverted;
80 extern void print_ematch_tree(const struct ematch *tree);
85 char kind[EMATCHKINDSIZ];
87 int (*parse_eopt)(struct nlmsghdr *,struct tcf_ematch_hdr *,
89 int (*print_eopt)(FILE *, struct tcf_ematch_hdr *, void *, int);
90 void (*print_usage)(FILE *);
91 struct ematch_util *next;
94 static inline int parse_layer(struct bstr *b)
96 if (*((char *) b->data) == 'l')
97 return TCF_LAYER_LINK;
98 else if (*((char *) b->data) == 'n')
99 return TCF_LAYER_NETWORK;
100 else if (*((char *) b->data) == 't')
101 return TCF_LAYER_TRANSPORT;
106 extern int em_parse_error(int err, struct bstr *args, struct bstr *carg,
107 struct ematch_util *, char *fmt, ...);
108 extern int print_ematch(FILE *, const struct rtattr *);
109 extern int parse_ematch(int *, char ***, int, struct nlmsghdr *);