[NETFILTER]: connection tracking event notifiers
[linux-2.6.git] / include / linux / netfilter_ipv4 / ip_conntrack_core.h
blob46eeea1e2733e5c2295d463c55afdf38995bd8bd
1 #ifndef _IP_CONNTRACK_CORE_H
2 #define _IP_CONNTRACK_CORE_H
3 #include <linux/netfilter.h>
5 /* This header is used to share core functionality between the
6 standalone connection tracking module, and the compatibility layer's use
7 of connection tracking. */
8 extern unsigned int ip_conntrack_in(unsigned int hooknum,
9 struct sk_buff **pskb,
10 const struct net_device *in,
11 const struct net_device *out,
12 int (*okfn)(struct sk_buff *));
14 extern int ip_conntrack_init(void);
15 extern void ip_conntrack_cleanup(void);
17 struct ip_conntrack_protocol;
19 extern int
20 ip_ct_get_tuple(const struct iphdr *iph,
21 const struct sk_buff *skb,
22 unsigned int dataoff,
23 struct ip_conntrack_tuple *tuple,
24 const struct ip_conntrack_protocol *protocol);
26 extern int
27 ip_ct_invert_tuple(struct ip_conntrack_tuple *inverse,
28 const struct ip_conntrack_tuple *orig,
29 const struct ip_conntrack_protocol *protocol);
31 /* Find a connection corresponding to a tuple. */
32 struct ip_conntrack_tuple_hash *
33 ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple,
34 const struct ip_conntrack *ignored_conntrack);
36 extern int __ip_conntrack_confirm(struct sk_buff **pskb);
38 /* Confirm a connection: returns NF_DROP if packet must be dropped. */
39 static inline int ip_conntrack_confirm(struct sk_buff **pskb)
41 struct ip_conntrack *ct = (struct ip_conntrack *)(*pskb)->nfct;
42 int ret = NF_ACCEPT;
44 if (ct && !is_confirmed(ct))
45 ret = __ip_conntrack_confirm(pskb);
46 ip_conntrack_deliver_cached_events_for(ct);
48 return ret;
51 #ifdef CONFIG_IP_NF_CONNTRACK_EVENTS
52 struct ip_conntrack_ecache;
53 extern void __ip_ct_deliver_cached_events(struct ip_conntrack_ecache *ec);
54 #endif
56 extern struct list_head *ip_conntrack_hash;
57 extern struct list_head ip_conntrack_expect_list;
58 extern rwlock_t ip_conntrack_lock;
59 #endif /* _IP_CONNTRACK_CORE_H */