]>
git.proxmox.com Git - mirror_iproute2.git/blob - tc/m_ematch.h
1 /* SPDX-License-Identifier: GPL-2.0 */
13 #define EMATCHKINDSIZ 16
23 extern struct bstr
* bstr_alloc(const char *text
);
25 static inline struct bstr
* bstr_new(char *data
, unsigned int len
)
27 struct bstr
*b
= calloc(1, sizeof(*b
));
38 static inline int bstrcmp(struct bstr
*b
, const char *text
)
40 int len
= strlen(text
);
44 return strncmp(b
->data
, text
, len
);
49 static inline struct bstr
*bstr_next(struct bstr
*b
)
54 extern unsigned long bstrtoul(const struct bstr
*b
);
55 extern void bstr_print(FILE *fd
, const struct bstr
*b
, int ascii
);
69 static inline struct ematch
* new_ematch(struct bstr
*args
, int inverted
)
71 struct ematch
*e
= calloc(1, sizeof(*e
));
77 e
->inverted
= inverted
;
82 extern void print_ematch_tree(const struct ematch
*tree
);
87 char kind
[EMATCHKINDSIZ
];
89 int (*parse_eopt
)(struct nlmsghdr
*,struct tcf_ematch_hdr
*,
91 int (*parse_eopt_argv
)(struct nlmsghdr
*, struct tcf_ematch_hdr
*,
93 int (*print_eopt
)(FILE *, struct tcf_ematch_hdr
*, void *, int);
94 void (*print_usage
)(FILE *);
95 struct ematch_util
*next
;
98 static inline int parse_layer(struct bstr
*b
)
100 if (*((char *) b
->data
) == 'l')
101 return TCF_LAYER_LINK
;
102 else if (*((char *) b
->data
) == 'n')
103 return TCF_LAYER_NETWORK
;
104 else if (*((char *) b
->data
) == 't')
105 return TCF_LAYER_TRANSPORT
;
110 extern int em_parse_error(int err
, struct bstr
*args
, struct bstr
*carg
,
111 struct ematch_util
*, char *fmt
, ...);
112 extern int print_ematch(FILE *, const struct rtattr
*);
113 extern int parse_ematch(int *, char ***, int, struct nlmsghdr
*);