This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / net / netfilter / nf_conntrack_core.h
1 /*
2  * This header is used to share core functionality between the
3  * standalone connection tracking module, and the compatibility layer's use
4  * of connection tracking.
5  *
6  * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
7  *      - generalize L3 protocol dependent part.
8  *
9  * Derived from include/linux/netfiter_ipv4/ip_conntrack_core.h
10  */
11
12 #ifndef _NF_CONNTRACK_CORE_H
13 #define _NF_CONNTRACK_CORE_H
14
15 #include <linux/netfilter.h>
16
17 /* This header is used to share core functionality between the
18    standalone connection tracking module, and the compatibility layer's use
19    of connection tracking. */
20 extern unsigned int nf_conntrack_in(int pf,
21                                     unsigned int hooknum,
22                                     struct sk_buff **pskb);
23
24 extern int nf_conntrack_init(void);
25 extern void nf_conntrack_cleanup(void);
26
27 struct nf_conntrack_l3proto;
28 extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf);
29 /* Like above, but you already have conntrack read lock. */
30 extern struct nf_conntrack_l3proto *__nf_ct_find_l3proto(u_int16_t l3proto);
31
32 struct nf_conntrack_protocol;
33
34 extern int
35 nf_ct_get_tuple(const struct sk_buff *skb,
36                 unsigned int nhoff,
37                 unsigned int dataoff,
38                 u_int16_t l3num,
39                 u_int8_t protonum,
40                 struct nf_conntrack_tuple *tuple,
41                 const struct nf_conntrack_l3proto *l3proto,
42                 const struct nf_conntrack_protocol *protocol);
43
44 extern int
45 nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
46                    const struct nf_conntrack_tuple *orig,
47                    const struct nf_conntrack_l3proto *l3proto,
48                    const struct nf_conntrack_protocol *protocol);
49
50 /* Find a connection corresponding to a tuple. */
51 extern struct nf_conntrack_tuple_hash *
52 nf_conntrack_find_get(const struct nf_conntrack_tuple *tuple,
53                       const struct nf_conn *ignored_conntrack);
54
55 extern int __nf_conntrack_confirm(struct sk_buff **pskb);
56
57 /* Confirm a connection: returns NF_DROP if packet must be dropped. */
58 static inline int nf_conntrack_confirm(struct sk_buff **pskb)
59 {
60         struct nf_conn *ct = (struct nf_conn *)(*pskb)->nfct;
61         int ret = NF_ACCEPT;
62
63         if (ct) {
64                 if (!nf_ct_is_confirmed(ct))
65                         ret = __nf_conntrack_confirm(pskb);
66                 nf_ct_deliver_cached_events(ct);
67         }
68         return ret;
69 }
70
71 extern void __nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb);
72
73 extern struct list_head *nf_conntrack_hash;
74 extern struct list_head nf_conntrack_expect_list;
75 extern rwlock_t nf_conntrack_lock ;
76 #endif /* _NF_CONNTRACK_CORE_H */