1/*
2 * src/cls-utils.h     Classifier Helpers
3 *
4 *	This library is free software; you can redistribute it and/or
5 *	modify it under the terms of the GNU General Public License as
6 *	published by the Free Software Foundation version 2 of the License.
7 *
8 * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch>
9 */
10
11#ifndef __CLS_UTILS_H_
12#define __CLS_UTILS_H_
13
14#include "../utils.h"
15#include <netlink/route/classifier-modules.h>
16#include <netlink/route/cls/ematch.h>
17
18struct cls_module
19{
20	const char *		name;
21	struct rtnl_cls_ops *	ops;
22	void		      (*parse_argv)(struct rtnl_cls *, int, char **);
23	struct nl_list_head	list;
24};
25
26extern struct cls_module *lookup_cls_mod(struct rtnl_cls_ops *);
27extern void register_cls_module(struct cls_module *);
28extern void unregister_cls_module(struct cls_module *);
29
30struct ematch_module
31{
32	int kind;
33	struct rtnl_ematch_ops *ops;
34	void (*parse_argv)(struct rtnl_ematch *, int, char **);
35	struct nl_list_head list;
36};
37
38extern struct ematch_module *lookup_ematch_mod(struct rtnl_ematch_ops *);
39extern void register_ematch_module(struct ematch_module *);
40extern void unregister_ematch_module(struct ematch_module *);
41
42extern struct rtnl_cls *nlt_alloc_cls(void);
43extern void parse_dev(struct rtnl_cls *, struct nl_cache *, char *);
44extern void parse_prio(struct rtnl_cls *, char *);
45extern void parse_parent(struct rtnl_cls *, char *);
46extern void parse_handle(struct rtnl_cls *, char *);
47extern void parse_proto(struct rtnl_cls *, char *);
48
49extern int parse_ematch_syntax(const char *, struct rtnl_ematch_tree **);
50
51#endif
52