1/*
2 * netlink/route/cls/ematch.h		Extended Matches
3 *
4 *	This library is free software; you can redistribute it and/or
5 *	modify it under the terms of the GNU Lesser General Public
6 *	License as published by the Free Software Foundation version 2.1
7 *	of the License.
8 *
9 * Copyright (c) 2008 Thomas Graf <tgraf@suug.ch>
10 */
11
12#ifndef NETLINK_CLS_EMATCH_H_
13#define NETLINK_CLS_EMATCH_H_
14
15#include <netlink/netlink.h>
16#include <netlink/route/classifier.h>
17#include <linux/pkt_cls.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23struct rtnl_ematch;
24struct rtnl_ematch_tree;
25
26struct rtnl_ematch_ops
27{
28	int				eo_kind;
29	const char *			eo_name;
30	size_t				eo_datalen;
31
32	int			      (*eo_parse)(struct rtnl_ematch *,
33						  void *, size_t);
34	void			      (*eo_dump)(struct rtnl_ematch *,
35						 struct nl_dump_params *);
36	struct nl_list_head		eo_list;
37};
38
39extern int	rtnl_ematch_register(struct rtnl_ematch_ops *);
40extern int	rtnl_ematch_unregister(struct rtnl_ematch_ops *);
41
42extern struct rtnl_ematch_ops *
43		rtnl_ematch_lookup_ops(int);
44extern struct rtnl_ematch_ops *
45		rtnl_ematch_lookup_ops_name(const char *);
46
47extern struct rtnl_ematch *
48		rtnl_ematch_alloc(struct rtnl_ematch_ops *);
49extern void	rtnl_ematch_add_child(struct rtnl_ematch *,
50				      struct rtnl_ematch *);
51extern void	rtnl_ematch_unlink(struct rtnl_ematch *);
52extern void	rtnl_ematch_free(struct rtnl_ematch *);
53
54extern void *	rtnl_ematch_data(struct rtnl_ematch *);
55extern void	rtnl_ematch_set_flags(struct rtnl_ematch *, uint16_t);
56extern void	rtnl_ematch_unset_flags(struct rtnl_ematch *, uint16_t);
57extern uint16_t	rtnl_ematch_get_flags(struct rtnl_ematch *);
58
59extern struct rtnl_ematch_tree *
60		rtnl_ematch_tree_alloc(uint16_t);
61extern void	rtnl_ematch_tree_free(struct rtnl_ematch_tree *);
62
63extern int	rtnl_ematch_parse(struct nlattr *, struct rtnl_ematch_tree **);
64extern void	rtnl_ematch_tree_add_tail(struct rtnl_ematch_tree *,
65					  struct rtnl_ematch *);
66extern void	rtnl_ematch_tree_dump(struct rtnl_ematch_tree *,
67				      struct nl_dump_params *);
68
69#ifdef __cplusplus
70}
71#endif
72
73#endif
74