Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nf_conntrack_expect.h
Go to the documentation of this file.
1 /*
2  * connection tracking expectations.
3  */
4 
5 #ifndef _NF_CONNTRACK_EXPECT_H
6 #define _NF_CONNTRACK_EXPECT_H
8 
9 extern unsigned int nf_ct_expect_hsize;
10 extern unsigned int nf_ct_expect_max;
11 
13  /* Conntrack expectation list member */
14  struct hlist_node lnode;
15 
16  /* Hash member */
17  struct hlist_node hnode;
18 
19  /* We expect this tuple, with the following mask */
22 
23  /* Function to call after setup and insertion */
24  void (*expectfn)(struct nf_conn *new,
25  struct nf_conntrack_expect *this);
26 
27  /* Helper to assign to new connection */
29 
30  /* The conntrack of the master connection */
31  struct nf_conn *master;
32 
33  /* Timer function; deletes the expectation. */
35 
36  /* Usage count. */
38 
39  /* Flags */
40  unsigned int flags;
41 
42  /* Expectation class */
43  unsigned int class;
44 
45 #ifdef CONFIG_NF_NAT_NEEDED
46  union nf_inet_addr saved_addr;
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
53 
54  struct rcu_head rcu;
55 };
56 
57 static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp)
58 {
59  return nf_ct_net(exp->master);
60 }
61 
62 #define NF_CT_EXP_POLICY_NAME_LEN 16
63 
65  unsigned int max_expected;
66  unsigned int timeout;
68 };
69 
70 #define NF_CT_EXPECT_CLASS_DEFAULT 0
71 
72 int nf_conntrack_expect_init(struct net *net);
73 void nf_conntrack_expect_fini(struct net *net);
74 
75 struct nf_conntrack_expect *
77  const struct nf_conntrack_tuple *tuple);
78 
79 struct nf_conntrack_expect *
81  const struct nf_conntrack_tuple *tuple);
82 
83 struct nf_conntrack_expect *
85  const struct nf_conntrack_tuple *tuple);
86 
88  u32 pid, int report);
89 static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)
90 {
91  nf_ct_unlink_expect_report(exp, 0, 0);
92 }
93 
96 
97 /* Allocate space for an expectation: this is mandatory before calling
98  nf_ct_expect_related. You will have to call put afterwards. */
100 void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
101  const union nf_inet_addr *,
102  const union nf_inet_addr *,
103  u_int8_t, const __be16 *, const __be16 *);
106  u32 pid, int report);
107 static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect)
108 {
109  return nf_ct_expect_related_report(expect, 0, 0);
110 }
111 
112 #endif /*_NF_CONNTRACK_EXPECT_H*/
113