jsm: Fixed EEH recovery error
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / net / netfilter / nf_conntrack_expect.h
blob0f8a8c587532f78ac5f191d93a1088b03ba1fd78
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 unsigned int nf_ct_expect_hsize;
10 extern unsigned int nf_ct_expect_max;
12 struct nf_conntrack_expect {
13 /* Conntrack expectation list member */
14 struct hlist_node lnode;
16 /* Hash member */
17 struct hlist_node hnode;
19 /* We expect this tuple, with the following mask */
20 struct nf_conntrack_tuple tuple;
21 struct nf_conntrack_tuple_mask mask;
23 /* Function to call after setup and insertion */
24 void (*expectfn)(struct nf_conn *new,
25 struct nf_conntrack_expect *this);
27 /* Helper to assign to new connection */
28 struct nf_conntrack_helper *helper;
30 /* The conntrack of the master connection */
31 struct nf_conn *master;
33 /* Timer function; deletes the expectation. */
34 struct timer_list timeout;
36 /* Usage count. */
37 atomic_t use;
39 /* Flags */
40 unsigned int flags;
42 /* Expectation class */
43 unsigned int class;
45 #ifdef CONFIG_NF_NAT_NEEDED
46 __be32 saved_ip;
47 /* This is the original per-proto part, used to map the
48 * expected connection the way the recipient expects. */
49 union nf_conntrack_man_proto saved_proto;
50 /* Direction relative to the master connection. */
51 enum ip_conntrack_dir dir;
52 #endif
54 struct rcu_head rcu;
57 static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp)
59 return nf_ct_net(exp->master);
62 struct nf_conntrack_expect_policy {
63 unsigned int max_expected;
64 unsigned int timeout;
65 const char *name;
68 #define NF_CT_EXPECT_CLASS_DEFAULT 0
70 int nf_conntrack_expect_init(struct net *net);
71 void nf_conntrack_expect_fini(struct net *net);
73 struct nf_conntrack_expect *
74 __nf_ct_expect_find(struct net *net, u16 zone,
75 const struct nf_conntrack_tuple *tuple);
77 struct nf_conntrack_expect *
78 nf_ct_expect_find_get(struct net *net, u16 zone,
79 const struct nf_conntrack_tuple *tuple);
81 struct nf_conntrack_expect *
82 nf_ct_find_expectation(struct net *net, u16 zone,
83 const struct nf_conntrack_tuple *tuple);
85 void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp,
86 u32 pid, int report);
87 static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)
89 nf_ct_unlink_expect_report(exp, 0, 0);
92 void nf_ct_remove_expectations(struct nf_conn *ct);
93 void nf_ct_unexpect_related(struct nf_conntrack_expect *exp);
94 void nf_ct_remove_userspace_expectations(void);
96 /* Allocate space for an expectation: this is mandatory before calling
97 nf_ct_expect_related. You will have to call put afterwards. */
98 struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me);
99 void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
100 const union nf_inet_addr *,
101 const union nf_inet_addr *,
102 u_int8_t, const __be16 *, const __be16 *);
103 void nf_ct_expect_put(struct nf_conntrack_expect *exp);
104 int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
105 u32 pid, int report);
106 static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect)
108 return nf_ct_expect_related_report(expect, 0, 0);
111 #endif /*_NF_CONNTRACK_EXPECT_H*/