]> bbs.cooldavid.org Git - net-next-2.6.git/blame - include/net/netfilter/nf_conntrack_expect.h
[NETFILTER]: nf_conntrack: split out expectation handling
[net-next-2.6.git] / include / net / netfilter / nf_conntrack_expect.h
CommitLineData
77ab9cff
MJ
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
9extern struct list_head nf_conntrack_expect_list;
10extern kmem_cache_t *nf_conntrack_expect_cachep;
11extern struct file_operations exp_file_ops;
12
13struct 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
25 /* The conntrack of the master connection */
26 struct nf_conn *master;
27
28 /* Timer function; deletes the expectation. */
29 struct timer_list timeout;
30
31 /* Usage count. */
32 atomic_t use;
33
34 /* Unique ID */
35 unsigned int id;
36
37 /* Flags */
38 unsigned int flags;
39
40#ifdef CONFIG_NF_NAT_NEEDED
41 /* This is the original per-proto part, used to map the
42 * expected connection the way the recipient expects. */
43 union nf_conntrack_manip_proto saved_proto;
44 /* Direction relative to the master connection. */
45 enum ip_conntrack_dir dir;
46#endif
47};
48
49#define NF_CT_EXPECT_PERMANENT 0x1
50
51
52struct nf_conntrack_expect *
53__nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
54
55struct nf_conntrack_expect *
56nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
57
58struct nf_conntrack_expect *
59find_expectation(const struct nf_conntrack_tuple *tuple);
60
61void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
62void nf_ct_remove_expectations(struct nf_conn *ct);
63void nf_conntrack_unexpect_related(struct nf_conntrack_expect *exp);
64
65/* Allocate space for an expectation: this is mandatory before calling
66 nf_conntrack_expect_related. You will have to call put afterwards. */
67struct nf_conntrack_expect *nf_conntrack_expect_alloc(struct nf_conn *me);
68void nf_conntrack_expect_put(struct nf_conntrack_expect *exp);
69int nf_conntrack_expect_related(struct nf_conntrack_expect *expect);
70
71#endif /*_NF_CONNTRACK_EXPECT_H*/
72