summaryrefslogtreecommitdiffstats
path: root/include/net/pkt_cls.h
blob: f9c80dd0fbbf0d8e87b684886b3d5009fa1b26d6 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef __NET_PKT_CLS_H
#define __NET_PKT_CLS_H


#include <linux/pkt_cls.h>

struct rtattr;
struct tcmsg;

/* Basic packet classifier frontend definitions. */

struct tcf_result
{
	unsigned long	class;
	u32		classid;
};

struct tcf_proto
{
	/* Fast access part */
	struct tcf_proto	*next;
	void			*root;
	int			(*classify)(struct sk_buff*, struct tcf_proto*, struct tcf_result *);
	u32			protocol;

	/* All the rest */
	u32			prio;
	u32			classid;
	struct Qdisc		*q;
	void			*data;
	struct tcf_proto_ops	*ops;
};

struct tcf_walker
{
	int	stop;
	int	skip;
	int	count;
	int	(*fn)(struct tcf_proto *, unsigned long node, struct tcf_walker *);
};

struct tcf_proto_ops
{
	struct tcf_proto_ops	*next;
	char			kind[IFNAMSIZ];

	int			(*classify)(struct sk_buff*, struct tcf_proto*, struct tcf_result *);
	int			(*init)(struct tcf_proto*);
	void			(*destroy)(struct tcf_proto*);

	unsigned long		(*get)(struct tcf_proto*, u32 handle);
	void			(*put)(struct tcf_proto*, unsigned long);
	int			(*change)(struct tcf_proto*, unsigned long, u32 handle, struct rtattr **, unsigned long *);
	int			(*delete)(struct tcf_proto*, unsigned long);
	void			(*walk)(struct tcf_proto*, struct tcf_walker *arg);

	/* rtnetlink specific */
	int			(*dump)(struct tcf_proto*, unsigned long, struct sk_buff *skb, struct tcmsg*);
};

/* Main classifier routine: scans classifier chain attached
   to this qdisc, (optionally) tests for protocol and asks
   specific classifiers.
 */

extern __inline__ int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_result *res)
{
	int err = 0;
	u32 protocol = skb->protocol;

	for ( ; tp; tp = tp->next) {
		if ((tp->protocol == protocol ||
		     tp->protocol == __constant_htons(ETH_P_ALL)) &&
		    (err = tp->classify(skb, tp, res)) >= 0)
			return err;
	}
	return -1;
}



extern int register_tcf_proto_ops(struct tcf_proto_ops *ops);
extern int unregister_tcf_proto_ops(struct tcf_proto_ops *ops);



#endif
ionPavel Emelyanov2008-02-081-0/+3 * IPC: fix error check in all new xxx_lock() and xxx_exit_ns() functionsPierre Peiffer2008-02-061-3/+14 * IPC: fix error case when idr-cache is empty in ipcget()Pierre Peiffer2007-10-191-2/+2 * virtualization of sysv msg queues is incompleteKirill Korotaev2007-10-191-11/+10 * ipc: remove unneeded parametersNadia Derbey2007-10-191-3/+2 * fix idr_find() lockingNadia Derbey2007-10-191-12/+29 * ipc: fix wrong commentsNadia Derbey2007-10-191-2/+12 * Storing ipcs into IDRsNadia Derbey2007-10-191-4/+10 * ipc: integrate ipc_checkid() into ipc_lock()Nadia Derbey2007-10-191-32/+30 * ipc: unify the syscalls codeNadia Derbey2007-10-191-44/+17 * ipc: store ipcs into IDRsNadia Derbey2007-10-191-45/+70 * pid namespaces: changes to show virtual ids to userPavel Emelyanov2007-10-191-3/+3 * arch/i386/* fs/* ipc/*: mark variables with uninitialized_var()Jeff Garzik2007-07-171-2/+2 * remove CONFIG_UTS_NS and CONFIG_IPC_NSCedric Le Goater2007-07-161-3/+1 * [PATCH] Fix the size limit of compat space msgsizesuzuki2006-12-071-11/+33 * Revert unintentional "volatile" changes in ipc/msg.cLinus Torvalds2006-11-041-1/+1 * [PATCH] Fix ipc entries removalPavel Emelianov2006-11-031-0/+1 * [PATCH] IPC namespace - msgKirill Korotaev2006-10-021-51/+106 * [PATCH] ipc/msg.c: clean up coding styleIngo Molnar2006-07-311-184/+205 * Remove obsolete #include <linux/config.h>Jörn Engel2006-06-301-1/+0 * [PATCH] update of IPC audit record cleanupLinda Knippers2006-06-201-4/+5 * [PATCH] Rework of IPC auditingSteve Grubb2006-05-01