Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nf_conntrack_helper.h
Go to the documentation of this file.
1 /*
2  * connection tracking helpers.
3  *
4  * 16 Dec 2003: Yasuyuki Kozakai @USAGI <[email protected]>
5  * - generalize L3 protocol dependent part.
6  *
7  * Derived from include/linux/netfiter_ipv4/ip_conntrack_helper.h
8  */
9 
10 #ifndef _NF_CONNTRACK_HELPER_H
11 #define _NF_CONNTRACK_HELPER_H
15 
16 struct module;
17 
21 };
22 
23 #define NF_CT_HELPER_NAME_LEN 16
24 
26  struct hlist_node hnode; /* Internal use. */
27 
28  char name[NF_CT_HELPER_NAME_LEN]; /* name of the module */
29  struct module *me; /* pointer to self */
31 
32  /* length of internal data, ie. sizeof(struct nf_ct_*_master) */
33  size_t data_len;
34 
35  /* Tuple of things we will help (compared against server response) */
37 
38  /* Function to call when data passes; return verdict, or -1 to
39  invalidate. */
40  int (*help)(struct sk_buff *skb,
41  unsigned int protoff,
42  struct nf_conn *ct,
43  enum ip_conntrack_info conntrackinfo);
44 
45  void (*destroy)(struct nf_conn *ct);
46 
47  int (*from_nlattr)(struct nlattr *attr, struct nf_conn *ct);
48  int (*to_nlattr)(struct sk_buff *skb, const struct nf_conn *ct);
49  unsigned int expect_class_max;
50 
51  unsigned int flags;
52  unsigned int queue_num; /* For user-space helpers. */
53 };
54 
55 extern struct nf_conntrack_helper *
56 __nf_conntrack_helper_find(const char *name, u16 l3num, u8 protonum);
57 
58 extern struct nf_conntrack_helper *
59 nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum);
60 
63 
64 extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, struct nf_conntrack_helper *helper, gfp_t gfp);
65 
66 extern int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
67  gfp_t flags);
68 
69 extern void nf_ct_helper_destroy(struct nf_conn *ct);
70 
71 static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
72 {
73  return nf_ct_ext_find(ct, NF_CT_EXT_HELPER);
74 }
75 
76 static inline void *nfct_help_data(const struct nf_conn *ct)
77 {
78  struct nf_conn_help *help;
79 
80  help = nf_ct_ext_find(ct, NF_CT_EXT_HELPER);
81 
82  return (void *)help->data;
83 }
84 
85 extern int nf_conntrack_helper_init(struct net *net);
86 extern void nf_conntrack_helper_fini(struct net *net);
87 
88 extern int nf_conntrack_broadcast_help(struct sk_buff *skb,
89  unsigned int protoff,
90  struct nf_conn *ct,
91  enum ip_conntrack_info ctinfo,
92  unsigned int timeout);
93 
95  struct list_head head;
96  const char *name;
98 };
99 
102 struct nf_ct_helper_expectfn *
104 struct nf_ct_helper_expectfn *
106 
107 extern struct hlist_head *nf_ct_helper_hash;
108 extern unsigned int nf_ct_helper_hsize;
109 
110 #endif /*_NF_CONNTRACK_HELPER_H*/