Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _IP_CONNTRACK_CORE_H |
| 2 | #define _IP_CONNTRACK_CORE_H |
| 3 | #include <linux/netfilter.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | |
| 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 *)); |
| 13 | |
| 14 | extern int ip_conntrack_init(void); |
| 15 | extern void ip_conntrack_cleanup(void); |
| 16 | |
| 17 | struct ip_conntrack_protocol; |
| 18 | |
| 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); |
| 25 | |
| 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); |
| 30 | |
| 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); |
| 35 | |
| 36 | extern int __ip_conntrack_confirm(struct sk_buff **pskb); |
| 37 | |
| 38 | /* Confirm a connection: returns NF_DROP if packet must be dropped. */ |
| 39 | static inline int ip_conntrack_confirm(struct sk_buff **pskb) |
| 40 | { |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame^] | 41 | struct ip_conntrack *ct = (struct ip_conntrack *)(*pskb)->nfct; |
| 42 | int ret = NF_ACCEPT; |
| 43 | |
| 44 | if (ct && !is_confirmed(ct)) |
| 45 | ret = __ip_conntrack_confirm(pskb); |
| 46 | ip_conntrack_deliver_cached_events_for(ct); |
| 47 | |
| 48 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | } |
| 50 | |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame^] | 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 |
| 55 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | extern struct list_head *ip_conntrack_hash; |
| 57 | extern struct list_head ip_conntrack_expect_list; |
Patrick McHardy | e45b1be | 2005-06-21 14:01:30 -0700 | [diff] [blame] | 58 | extern rwlock_t ip_conntrack_lock; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | #endif /* _IP_CONNTRACK_CORE_H */ |
| 60 | |