[NETFILTER]: nf_conntrack: introduce expectation classes and policies
[linux-2.6/mini2440.git] / include / net / netfilter / nf_conntrack_expect.h
blobdfdf4b4594751b00f8d21c7e136490307debe8d5
1 /*
2 * connection tracking expectations.
3 */
5 #ifndef _NF_CONNTRACK_EXPECT_H
6 #define _NF_CONNTRACK_EXPECT_H
7 #include <net/netfilter/nf_conntrack.h>
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;
13 struct nf_conntrack_expect
15 /* Conntrack expectation list member */
16 struct hlist_node lnode;
18 /* Hash member */
19 struct hlist_node hnode;
21 /* We expect this tuple, with the following mask */
22 struct nf_conntrack_tuple tuple;
23 struct nf_conntrack_tuple_mask mask;
25 /* Function to call after setup and insertion */
26 void (*expectfn)(struct nf_conn *new,
27 struct nf_conntrack_expect *this);
29 /* Helper to assign to new connection */
30 struct nf_conntrack_helper *helper;
32 /* The conntrack of the master connection */
33 struct nf_conn *master;
35 /* Timer function; deletes the expectation. */
36 struct timer_list timeout;
38 /* Usage count. */
39 atomic_t use;
41 /* Flags */
42 unsigned int flags;
44 /* Expectation class */
45 unsigned int class;
47 #ifdef CONFIG_NF_NAT_NEEDED
48 __be32 saved_ip;
49 /* This is the original per-proto part, used to map the
50 * expected connection the way the recipient expects. */
51 union nf_conntrack_man_proto saved_proto;
52 /* Direction relative to the master connection. */
53 enum ip_conntrack_dir dir;
54 #endif
56 struct rcu_head rcu;
59 struct nf_conntrack_expect_policy
61 unsigned int max_expected;
62 unsigned int timeout;
65 #define NF_CT_EXPECT_CLASS_DEFAULT 0
67 #define NF_CT_EXPECT_PERMANENT 0x1
68 #define NF_CT_EXPECT_INACTIVE 0x2
70 int nf_conntrack_expect_init(void);
71 void nf_conntrack_expect_fini(void);
73 struct nf_conntrack_expect *
74 __nf_ct_expect_find(const struct nf_conntrack_tuple *tuple);
76 struct nf_conntrack_expect *
77 nf_ct_expect_find_get(const struct nf_conntrack_tuple *tuple);
79 struct nf_conntrack_expect *
80 nf_ct_find_expectation(const struct nf_conntrack_tuple *tuple);
82 void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
83 void nf_ct_remove_expectations(struct nf_conn *ct);
84 void nf_ct_unexpect_related(struct nf_conntrack_expect *exp);
86 /* Allocate space for an expectation: this is mandatory before calling
87 nf_ct_expect_related. You will have to call put afterwards. */
88 struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me);
89 void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, int,
90 const union nf_inet_addr *,
91 const union nf_inet_addr *,
92 u_int8_t, const __be16 *, const __be16 *);
93 void nf_ct_expect_put(struct nf_conntrack_expect *exp);
94 int nf_ct_expect_related(struct nf_conntrack_expect *expect);
96 #endif /*_NF_CONNTRACK_EXPECT_H*/