Martin Josefsson | 77ab9cf | 2006-11-29 02:34:58 +0100 | [diff] [blame] | 1 | /* |
| 2 | * connection tracking expectations. |
| 3 | */ |
| 4 | |
| 5 | #ifndef _NF_CONNTRACK_EXPECT_H |
| 6 | #define _NF_CONNTRACK_EXPECT_H |
| 7 | #include <net/netfilter/nf_conntrack.h> |
| 8 | |
| 9 | extern struct list_head nf_conntrack_expect_list; |
| 10 | extern kmem_cache_t *nf_conntrack_expect_cachep; |
| 11 | extern struct file_operations exp_file_ops; |
| 12 | |
| 13 | struct nf_conntrack_expect |
| 14 | { |
| 15 | /* Internal linked list (global expectation list) */ |
| 16 | struct list_head list; |
| 17 | |
| 18 | /* We expect this tuple, with the following mask */ |
| 19 | struct nf_conntrack_tuple tuple, mask; |
| 20 | |
| 21 | /* Function to call after setup and insertion */ |
| 22 | void (*expectfn)(struct nf_conn *new, |
| 23 | struct nf_conntrack_expect *this); |
| 24 | |
Patrick McHardy | 9457d85 | 2006-12-02 22:05:25 -0800 | [diff] [blame] | 25 | /* Helper to assign to new connection */ |
| 26 | struct nf_conntrack_helper *helper; |
| 27 | |
Martin Josefsson | 77ab9cf | 2006-11-29 02:34:58 +0100 | [diff] [blame] | 28 | /* The conntrack of the master connection */ |
| 29 | struct nf_conn *master; |
| 30 | |
| 31 | /* Timer function; deletes the expectation. */ |
| 32 | struct timer_list timeout; |
| 33 | |
| 34 | /* Usage count. */ |
| 35 | atomic_t use; |
| 36 | |
| 37 | /* Unique ID */ |
| 38 | unsigned int id; |
| 39 | |
| 40 | /* Flags */ |
| 41 | unsigned int flags; |
| 42 | |
| 43 | #ifdef CONFIG_NF_NAT_NEEDED |
Patrick McHardy | f587de0 | 2006-12-02 22:08:46 -0800 | [diff] [blame^] | 44 | __be32 saved_ip; |
Martin Josefsson | 77ab9cf | 2006-11-29 02:34:58 +0100 | [diff] [blame] | 45 | /* This is the original per-proto part, used to map the |
| 46 | * expected connection the way the recipient expects. */ |
Jozsef Kadlecsik | 5b1158e | 2006-12-02 22:07:13 -0800 | [diff] [blame] | 47 | union nf_conntrack_man_proto saved_proto; |
Martin Josefsson | 77ab9cf | 2006-11-29 02:34:58 +0100 | [diff] [blame] | 48 | /* Direction relative to the master connection. */ |
| 49 | enum ip_conntrack_dir dir; |
| 50 | #endif |
| 51 | }; |
| 52 | |
| 53 | #define NF_CT_EXPECT_PERMANENT 0x1 |
| 54 | |
| 55 | |
| 56 | struct nf_conntrack_expect * |
| 57 | __nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple); |
| 58 | |
| 59 | struct nf_conntrack_expect * |
Yasuyuki Kozakai | 468ec44 | 2006-11-29 02:35:23 +0100 | [diff] [blame] | 60 | nf_conntrack_expect_find_get(const struct nf_conntrack_tuple *tuple); |
Martin Josefsson | 77ab9cf | 2006-11-29 02:34:58 +0100 | [diff] [blame] | 61 | |
| 62 | struct nf_conntrack_expect * |
| 63 | find_expectation(const struct nf_conntrack_tuple *tuple); |
| 64 | |
| 65 | void nf_ct_unlink_expect(struct nf_conntrack_expect *exp); |
| 66 | void nf_ct_remove_expectations(struct nf_conn *ct); |
| 67 | void nf_conntrack_unexpect_related(struct nf_conntrack_expect *exp); |
| 68 | |
| 69 | /* Allocate space for an expectation: this is mandatory before calling |
| 70 | nf_conntrack_expect_related. You will have to call put afterwards. */ |
| 71 | struct nf_conntrack_expect *nf_conntrack_expect_alloc(struct nf_conn *me); |
Patrick McHardy | d6a9b65 | 2006-12-02 22:08:01 -0800 | [diff] [blame] | 72 | void nf_conntrack_expect_init(struct nf_conntrack_expect *, int, |
| 73 | union nf_conntrack_address *, |
| 74 | union nf_conntrack_address *, |
| 75 | u_int8_t, __be16 *, __be16 *); |
Martin Josefsson | 77ab9cf | 2006-11-29 02:34:58 +0100 | [diff] [blame] | 76 | void nf_conntrack_expect_put(struct nf_conntrack_expect *exp); |
| 77 | int nf_conntrack_expect_related(struct nf_conntrack_expect *expect); |
| 78 | |
| 79 | #endif /*_NF_CONNTRACK_EXPECT_H*/ |
| 80 | |