summaryrefslogtreecommitdiffstats
path: root/src/cls/utils.h
blob: 1a8ee9bcea18eb7af933c8823907148b39b5c77d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * src/cls-utils.h     Classifier Helpers
 *
 *	This library is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU General Public License as
 *	published by the Free Software Foundation version 2 of the License.
 *
 * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch>
 */

#ifndef __CLS_UTILS_H_
#define __CLS_UTILS_H_

#include "../utils.h"
#include <netlink/route/classifier-modules.h>
#include <netlink/route/cls/ematch.h>

struct cls_module
{
	const char *		name;
	struct rtnl_cls_ops *	ops;
	void		      (*parse_argv)(struct rtnl_cls *, int, char **);
	struct nl_list_head	list;
};

extern struct cls_module *lookup_cls_mod(struct rtnl_cls_ops *);
extern void register_cls_module(struct cls_module *);
extern void unregister_cls_module(struct cls_module *);

struct ematch_module
{
	int kind;
	struct rtnl_ematch_ops *ops;
	void (*parse_argv)(struct rtnl_ematch *, int, char **);
	struct nl_list_head list;
};

extern struct ematch_module *lookup_ematch_mod(struct rtnl_ematch_ops *);
extern void register_ematch_module(struct ematch_module *);
extern void unregister_ematch_module(struct ematch_module *);

extern struct rtnl_cls *nlt_alloc_cls(void);
extern void parse_dev(struct rtnl_cls *, struct nl_cache *, char *);
extern void parse_prio(struct rtnl_cls *, char *);
extern void parse_parent(struct rtnl_cls *, char *);
extern void parse_handle(struct rtnl_cls *, char *);
extern void parse_proto(struct rtnl_cls *, char *);

extern int parse_ematch_syntax(const char *, struct rtnl_ematch_tree **);

#endif