Tizen 2.1 base
[platform/upstream/libnl2.git] / src / cls / utils.h
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
18 struct 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
26 extern struct cls_module *lookup_cls_mod(struct rtnl_cls_ops *);
27 extern void register_cls_module(struct cls_module *);
28 extern void unregister_cls_module(struct cls_module *);
29
30 struct 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
38 extern struct ematch_module *lookup_ematch_mod(struct rtnl_ematch_ops *);
39 extern void register_ematch_module(struct ematch_module *);
40 extern void unregister_ematch_module(struct ematch_module *);
41
42 extern struct rtnl_cls *nlt_alloc_cls(void);
43 extern void parse_dev(struct rtnl_cls *, struct nl_cache *, char *);
44 extern void parse_prio(struct rtnl_cls *, char *);
45 extern void parse_parent(struct rtnl_cls *, char *);
46 extern void parse_handle(struct rtnl_cls *, char *);
47 extern void parse_proto(struct rtnl_cls *, char *);
48
49 extern int parse_ematch_syntax(const char *, struct rtnl_ematch_tree **);
50
51 #endif