blob: 5d853e826d1d4cbbcadbdc1da0d7cc98afd3b928 [file] [log] [blame]
Martin Josefsson77ab9cf2006-11-29 02:34:58 +01001/*
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
Patrick McHardy9457d852006-12-02 22:05:25 -080025 /* Helper to assign to new connection */
26 struct nf_conntrack_helper *helper;
27
Martin Josefsson77ab9cf2006-11-29 02:34:58 +010028 /* 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
44 /* This is the original per-proto part, used to map the
45 * expected connection the way the recipient expects. */
46 union nf_conntrack_manip_proto saved_proto;
47 /* Direction relative to the master connection. */
48 enum ip_conntrack_dir dir;
49#endif
50};
51
52#define NF_CT_EXPECT_PERMANENT 0x1
53
54
55struct nf_conntrack_expect *
56__nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
57
58struct nf_conntrack_expect *
Yasuyuki Kozakai468ec442006-11-29 02:35:23 +010059nf_conntrack_expect_find_get(const struct nf_conntrack_tuple *tuple);
Martin Josefsson77ab9cf2006-11-29 02:34:58 +010060
61struct nf_conntrack_expect *
62find_expectation(const struct nf_conntrack_tuple *tuple);
63
64void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
65void nf_ct_remove_expectations(struct nf_conn *ct);
66void nf_conntrack_unexpect_related(struct nf_conntrack_expect *exp);
67
68/* Allocate space for an expectation: this is mandatory before calling
69 nf_conntrack_expect_related. You will have to call put afterwards. */
70struct nf_conntrack_expect *nf_conntrack_expect_alloc(struct nf_conn *me);
71void nf_conntrack_expect_put(struct nf_conntrack_expect *exp);
72int nf_conntrack_expect_related(struct nf_conntrack_expect *expect);
73
74#endif /*_NF_CONNTRACK_EXPECT_H*/
75