2 * connection tracking expectations.
5 #ifndef _NF_CONNTRACK_EXPECT_H
6 #define _NF_CONNTRACK_EXPECT_H
7 #include <net/netfilter/nf_conntrack.h>
9 extern unsigned int nf_ct_expect_hsize
;
10 extern unsigned int nf_ct_expect_max
;
12 struct nf_conntrack_expect
14 /* Conntrack expectation list member */
15 struct hlist_node lnode
;
18 struct hlist_node hnode
;
20 /* We expect this tuple, with the following mask */
21 struct nf_conntrack_tuple tuple
;
22 struct nf_conntrack_tuple_mask mask
;
24 /* Function to call after setup and insertion */
25 void (*expectfn
)(struct nf_conn
*new,
26 struct nf_conntrack_expect
*this);
28 /* Helper to assign to new connection */
29 struct nf_conntrack_helper
*helper
;
31 /* The conntrack of the master connection */
32 struct nf_conn
*master
;
34 /* Timer function; deletes the expectation. */
35 struct timer_list timeout
;
43 /* Expectation class */
46 #ifdef CONFIG_NF_NAT_NEEDED
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
;
58 static inline struct net
*nf_ct_exp_net(struct nf_conntrack_expect
*exp
)
61 return exp
->master
->ct_net
; /* by definition */
67 struct nf_conntrack_expect_policy
69 unsigned int max_expected
;
73 #define NF_CT_EXPECT_CLASS_DEFAULT 0
75 #define NF_CT_EXPECT_PERMANENT 0x1
76 #define NF_CT_EXPECT_INACTIVE 0x2
78 int nf_conntrack_expect_init(struct net
*net
);
79 void nf_conntrack_expect_fini(struct net
*net
);
81 struct nf_conntrack_expect
*
82 __nf_ct_expect_find(struct net
*net
, const struct nf_conntrack_tuple
*tuple
);
84 struct nf_conntrack_expect
*
85 nf_ct_expect_find_get(struct net
*net
, const struct nf_conntrack_tuple
*tuple
);
87 struct nf_conntrack_expect
*
88 nf_ct_find_expectation(struct net
*net
, const struct nf_conntrack_tuple
*tuple
);
90 void nf_ct_unlink_expect(struct nf_conntrack_expect
*exp
);
91 void nf_ct_remove_expectations(struct nf_conn
*ct
);
92 void nf_ct_unexpect_related(struct nf_conntrack_expect
*exp
);
94 /* Allocate space for an expectation: this is mandatory before calling
95 nf_ct_expect_related. You will have to call put afterwards. */
96 struct nf_conntrack_expect
*nf_ct_expect_alloc(struct nf_conn
*me
);
97 void nf_ct_expect_init(struct nf_conntrack_expect
*, unsigned int, u_int8_t
,
98 const union nf_inet_addr
*,
99 const union nf_inet_addr
*,
100 u_int8_t
, const __be16
*, const __be16
*);
101 void nf_ct_expect_put(struct nf_conntrack_expect
*exp
);
102 int nf_ct_expect_related(struct nf_conntrack_expect
*expect
);
103 int nf_ct_expect_related_report(struct nf_conntrack_expect
*expect
,
104 u32 pid
, int report
);
106 #endif /*_NF_CONNTRACK_EXPECT_H*/