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