ide: ide-cd_ioctl.c fix sparse integer as NULL pointer warnings
[linux-2.6/kvm.git] / include / net / netfilter / nf_conntrack_l3proto.h
blob0378676c3dd816ba97a172359240a59153612e84
1 /*
2 * Copyright (C)2003,2004 USAGI/WIDE Project
4 * Header for use in defining a given L3 protocol for connection tracking.
6 * Author:
7 * Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
9 * Derived from include/netfilter_ipv4/ip_conntrack_protocol.h
12 #ifndef _NF_CONNTRACK_L3PROTO_H
13 #define _NF_CONNTRACK_L3PROTO_H
14 #include <linux/netlink.h>
15 #include <net/netlink.h>
16 #include <linux/seq_file.h>
17 #include <net/netfilter/nf_conntrack.h>
19 struct nf_conntrack_l3proto
21 /* L3 Protocol Family number. ex) PF_INET */
22 u_int16_t l3proto;
24 /* Protocol name */
25 const char *name;
28 * Try to fill in the third arg: nhoff is offset of l3 proto
29 * hdr. Return true if possible.
31 bool (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff,
32 struct nf_conntrack_tuple *tuple);
35 * Invert the per-proto part of the tuple: ie. turn xmit into reply.
36 * Some packets can't be inverted: return 0 in that case.
38 bool (*invert_tuple)(struct nf_conntrack_tuple *inverse,
39 const struct nf_conntrack_tuple *orig);
41 /* Print out the per-protocol part of the tuple. */
42 int (*print_tuple)(struct seq_file *s,
43 const struct nf_conntrack_tuple *);
46 * Called before tracking.
47 * *dataoff: offset of protocol header (TCP, UDP,...) in skb
48 * *protonum: protocol number
50 int (*get_l4proto)(const struct sk_buff *skb, unsigned int nhoff,
51 unsigned int *dataoff, u_int8_t *protonum);
53 int (*tuple_to_nlattr)(struct sk_buff *skb,
54 const struct nf_conntrack_tuple *t);
56 int (*nlattr_to_tuple)(struct nlattr *tb[],
57 struct nf_conntrack_tuple *t);
58 const struct nla_policy *nla_policy;
60 #ifdef CONFIG_SYSCTL
61 struct ctl_table_header *ctl_table_header;
62 struct ctl_path *ctl_table_path;
63 struct ctl_table *ctl_table;
64 #endif /* CONFIG_SYSCTL */
66 /* Module (if any) which this is connected to. */
67 struct module *me;
70 extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX];
72 /* Protocol registration. */
73 extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto);
74 extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto);
75 extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto);
76 extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
78 /* Existing built-in protocols */
79 extern struct nf_conntrack_l3proto nf_conntrack_l3proto_generic;
81 static inline struct nf_conntrack_l3proto *
82 __nf_ct_l3proto_find(u_int16_t l3proto)
84 if (unlikely(l3proto >= AF_MAX))
85 return &nf_conntrack_l3proto_generic;
86 return rcu_dereference(nf_ct_l3protos[l3proto]);
89 #endif /*_NF_CONNTRACK_L3PROTO_H*/