1 #ifndef __NET_PKT_CLS_H
2 #define __NET_PKT_CLS_H
5 #include <linux/pkt_cls.h>
10 /* Basic packet classifier frontend definitions. */
20 /* Fast access part */
21 struct tcf_proto *next;
23 int (*classify)(struct sk_buff*, struct tcf_proto*, struct tcf_result *);
31 struct tcf_proto_ops *ops;
39 int (*fn)(struct tcf_proto *, unsigned long node, struct tcf_walker *);
44 struct tcf_proto_ops *next;
47 int (*classify)(struct sk_buff*, struct tcf_proto*, struct tcf_result *);
48 int (*init)(struct tcf_proto*);
49 void (*destroy)(struct tcf_proto*);
51 unsigned long (*get)(struct tcf_proto*, u32 handle);
52 void (*put)(struct tcf_proto*, unsigned long);
53 int (*change)(struct tcf_proto*, unsigned long, u32 handle, struct rtattr **, unsigned long *);
54 int (*delete)(struct tcf_proto*, unsigned long);
55 void (*walk)(struct tcf_proto*, struct tcf_walker *arg);
57 /* rtnetlink specific */
58 int (*dump)(struct tcf_proto*, unsigned long, struct sk_buff *skb, struct tcmsg*);
61 /* Main classifier routine: scans classifier chain attached
62 to this qdisc, (optionally) tests for protocol and asks
66 static inline int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_result *res)
69 u32 protocol = skb->protocol;
71 for ( ; tp; tp = tp->next) {
72 if ((tp->protocol == protocol ||
73 tp->protocol == __constant_htons(ETH_P_ALL)) &&
74 (err = tp->classify(skb, tp, res)) >= 0)
82 extern int register_tcf_proto_ops(struct tcf_proto_ops *ops);
83 extern int unregister_tcf_proto_ops(struct tcf_proto_ops *ops);