9d5af4e22c4f615731435d5e3e9f0cca3766f83b
[deliverable/linux.git] / include / net / netfilter / nf_conntrack_expect.h
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 hlist_head *nf_ct_expect_hash;
10 extern unsigned int nf_ct_expect_hsize;
11
12 struct nf_conntrack_expect
13 {
14 /* Conntrack expectation list member */
15 struct hlist_node lnode;
16
17 /* Hash member */
18 struct hlist_node hnode;
19
20 /* We expect this tuple, with the following mask */
21 struct nf_conntrack_tuple tuple;
22 struct nf_conntrack_tuple_mask mask;
23
24 /* Function to call after setup and insertion */
25 void (*expectfn)(struct nf_conn *new,
26 struct nf_conntrack_expect *this);
27
28 /* Helper to assign to new connection */
29 struct nf_conntrack_helper *helper;
30
31 /* The conntrack of the master connection */
32 struct nf_conn *master;
33
34 /* Timer function; deletes the expectation. */
35 struct timer_list timeout;
36
37 /* Usage count. */
38 atomic_t use;
39
40 /* Unique ID */
41 unsigned int id;
42
43 /* Flags */
44 unsigned int flags;
45
46 #ifdef CONFIG_NF_NAT_NEEDED
47 __be32 saved_ip;
48 /* This is the original per-proto part, used to map the
49 * expected connection the way the recipient expects. */
50 union nf_conntrack_man_proto saved_proto;
51 /* Direction relative to the master connection. */
52 enum ip_conntrack_dir dir;
53 #endif
54 };
55
56 #define NF_CT_EXPECT_PERMANENT 0x1
57
58 int nf_conntrack_expect_init(void);
59 void nf_conntrack_expect_fini(void);
60
61 struct nf_conntrack_expect *
62 __nf_ct_expect_find(const struct nf_conntrack_tuple *tuple);
63
64 struct nf_conntrack_expect *
65 nf_ct_expect_find_get(const struct nf_conntrack_tuple *tuple);
66
67 struct nf_conntrack_expect *
68 nf_ct_find_expectation(const struct nf_conntrack_tuple *tuple);
69
70 void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
71 void nf_ct_remove_expectations(struct nf_conn *ct);
72 void nf_ct_unexpect_related(struct nf_conntrack_expect *exp);
73
74 /* Allocate space for an expectation: this is mandatory before calling
75 nf_ct_expect_related. You will have to call put afterwards. */
76 struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me);
77 void nf_ct_expect_init(struct nf_conntrack_expect *, int,
78 union nf_conntrack_address *,
79 union nf_conntrack_address *,
80 u_int8_t, __be16 *, __be16 *);
81 void nf_ct_expect_put(struct nf_conntrack_expect *exp);
82 int nf_ct_expect_related(struct nf_conntrack_expect *expect);
83
84 #endif /*_NF_CONNTRACK_EXPECT_H*/
85
This page took 0.075897 seconds and 4 git commands to generate.