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 | |
Harald Welte | 080774a | 2005-08-09 19:32:58 -0700 | [diff] [blame] | 5 | #define MAX_IP_CT_PROTO 256 |
| 6 | extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO]; |
| 7 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | /* This header is used to share core functionality between the |
| 9 | standalone connection tracking module, and the compatibility layer's use |
| 10 | of connection tracking. */ |
| 11 | extern unsigned int ip_conntrack_in(unsigned int hooknum, |
| 12 | struct sk_buff **pskb, |
| 13 | const struct net_device *in, |
| 14 | const struct net_device *out, |
| 15 | int (*okfn)(struct sk_buff *)); |
| 16 | |
| 17 | extern int ip_conntrack_init(void); |
| 18 | extern void ip_conntrack_cleanup(void); |
| 19 | |
| 20 | struct ip_conntrack_protocol; |
| 21 | |
| 22 | extern int |
| 23 | ip_ct_get_tuple(const struct iphdr *iph, |
| 24 | const struct sk_buff *skb, |
| 25 | unsigned int dataoff, |
| 26 | struct ip_conntrack_tuple *tuple, |
| 27 | const struct ip_conntrack_protocol *protocol); |
| 28 | |
| 29 | extern int |
| 30 | ip_ct_invert_tuple(struct ip_conntrack_tuple *inverse, |
| 31 | const struct ip_conntrack_tuple *orig, |
| 32 | const struct ip_conntrack_protocol *protocol); |
| 33 | |
| 34 | /* Find a connection corresponding to a tuple. */ |
| 35 | struct ip_conntrack_tuple_hash * |
| 36 | ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple, |
| 37 | const struct ip_conntrack *ignored_conntrack); |
| 38 | |
| 39 | extern int __ip_conntrack_confirm(struct sk_buff **pskb); |
| 40 | |
| 41 | /* Confirm a connection: returns NF_DROP if packet must be dropped. */ |
| 42 | static inline int ip_conntrack_confirm(struct sk_buff **pskb) |
| 43 | { |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 44 | struct ip_conntrack *ct = (struct ip_conntrack *)(*pskb)->nfct; |
| 45 | int ret = NF_ACCEPT; |
| 46 | |
Patrick McHardy | a86888b | 2005-08-09 20:02:13 -0700 | [diff] [blame] | 47 | if (ct) { |
| 48 | if (!is_confirmed(ct)) |
| 49 | ret = __ip_conntrack_confirm(pskb); |
| 50 | ip_ct_deliver_cached_events(ct); |
| 51 | } |
Harald Welte | ac3247b | 2005-08-09 19:28:03 -0700 | [diff] [blame] | 52 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | } |
| 54 | |
Pablo Neira Ayuso | 49719eb | 2005-09-06 15:10:46 -0700 | [diff] [blame^] | 55 | extern void ip_ct_unlink_expect(struct ip_conntrack_expect *exp); |
Harald Welte | 080774a | 2005-08-09 19:32:58 -0700 | [diff] [blame] | 56 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | extern struct list_head *ip_conntrack_hash; |
| 58 | extern struct list_head ip_conntrack_expect_list; |
Patrick McHardy | e45b1be | 2005-06-21 14:01:30 -0700 | [diff] [blame] | 59 | extern rwlock_t ip_conntrack_lock; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | #endif /* _IP_CONNTRACK_CORE_H */ |
| 61 | |