This commit was manufactured by cvs2svn to create branch
[linux-2.6.git] / include / linux / netfilter_ipv4 / ip_conntrack_core.h
1 #ifndef _IP_CONNTRACK_CORE_H
2 #define _IP_CONNTRACK_CORE_H
3 #include <linux/netfilter.h>
4 #include <linux/netfilter_ipv4/lockhelp.h>
5
6 /* This header is used to share core functionality between the
7    standalone connection tracking module, and the compatibility layer's use
8    of connection tracking. */
9 extern unsigned int ip_conntrack_in(unsigned int hooknum,
10                                     struct sk_buff **pskb,
11                                     const struct net_device *in,
12                                     const struct net_device *out,
13                                     int (*okfn)(struct sk_buff *));
14
15 extern int ip_conntrack_init(void);
16 extern void ip_conntrack_cleanup(void);
17
18 struct ip_conntrack_protocol;
19
20 extern int
21 ip_ct_get_tuple(const struct iphdr *iph,
22                 const struct sk_buff *skb,
23                 unsigned int dataoff,
24                 struct ip_conntrack_tuple *tuple,
25                 const struct ip_conntrack_protocol *protocol);
26
27 extern int
28 ip_ct_invert_tuple(struct ip_conntrack_tuple *inverse,
29                    const struct ip_conntrack_tuple *orig,
30                    const struct ip_conntrack_protocol *protocol);
31
32 /* Find a connection corresponding to a tuple. */
33 struct ip_conntrack_tuple_hash *
34 ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple,
35                       const struct ip_conntrack *ignored_conntrack);
36
37 struct ip_conntrack_tuple_hash *
38 __ip_conntrack_find(const struct ip_conntrack_tuple *tuple,
39                     const struct ip_conntrack *ignored_conntrack);
40
41 struct ip_conntrack_expect *
42 __ip_conntrack_exp_find(const struct ip_conntrack_tuple *tuple);
43
44 extern int __ip_conntrack_confirm(struct sk_buff **pskb);
45
46 /* Confirm a connection: returns NF_DROP if packet must be dropped. */
47 static inline int ip_conntrack_confirm(struct sk_buff **pskb)
48 {
49         if ((*pskb)->nfct
50             && !is_confirmed((struct ip_conntrack *)(*pskb)->nfct))
51                 return __ip_conntrack_confirm(pskb);
52         return NF_ACCEPT;
53 }
54
55 extern struct list_head *ip_conntrack_hash;
56 extern struct list_head ip_conntrack_expect_list;
57 DECLARE_RWLOCK_EXTERN(ip_conntrack_lock);
58 #endif /* _IP_CONNTRACK_CORE_H */
59