ACPI: SBS: Split host controller (ACPI0001) from SBS driver (ACPI0002)
[linux-2.6/mini2440.git] / include / net / netfilter / nf_conntrack_extend.h
blob73b5711faf32f4e47b81044ec0c54b0978c669ca
1 #ifndef _NF_CONNTRACK_EXTEND_H
2 #define _NF_CONNTRACK_EXTEND_H
4 #include <net/netfilter/nf_conntrack.h>
6 enum nf_ct_ext_id
8 NF_CT_EXT_HELPER,
9 NF_CT_EXT_NAT,
10 NF_CT_EXT_NUM,
13 #define NF_CT_EXT_HELPER_TYPE struct nf_conn_help
14 #define NF_CT_EXT_NAT_TYPE struct nf_conn_nat
16 /* Extensions: optional stuff which isn't permanently in struct. */
17 struct nf_ct_ext {
18 u8 offset[NF_CT_EXT_NUM];
19 u8 len;
20 u8 real_len;
21 char data[0];
24 static inline int nf_ct_ext_exist(const struct nf_conn *ct, u8 id)
26 return (ct->ext && ct->ext->offset[id]);
29 static inline void *__nf_ct_ext_find(const struct nf_conn *ct, u8 id)
31 if (!nf_ct_ext_exist(ct, id))
32 return NULL;
34 return (void *)ct->ext + ct->ext->offset[id];
36 #define nf_ct_ext_find(ext, id) \
37 ((id##_TYPE *)__nf_ct_ext_find((ext), (id)))
39 /* Destroy all relationships */
40 extern void __nf_ct_ext_destroy(struct nf_conn *ct);
41 static inline void nf_ct_ext_destroy(struct nf_conn *ct)
43 if (ct->ext)
44 __nf_ct_ext_destroy(ct);
47 /* Free operation. If you want to free a object referred from private area,
48 * please implement __nf_ct_ext_free() and call it.
50 static inline void nf_ct_ext_free(struct nf_conn *ct)
52 if (ct->ext)
53 kfree(ct->ext);
56 /* Add this type, returns pointer to data or NULL. */
57 void *
58 __nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp);
59 #define nf_ct_ext_add(ct, id, gfp) \
60 ((id##_TYPE *)__nf_ct_ext_add((ct), (id), (gfp)))
62 #define NF_CT_EXT_F_PREALLOC 0x0001
64 struct nf_ct_ext_type
66 /* Destroys relationships (can be NULL). */
67 void (*destroy)(struct nf_conn *ct);
68 /* Called when realloacted (can be NULL).
69 Contents has already been moved. */
70 void (*move)(struct nf_conn *ct, void *old);
72 enum nf_ct_ext_id id;
74 unsigned int flags;
76 /* Length and min alignment. */
77 u8 len;
78 u8 align;
79 /* initial size of nf_ct_ext. */
80 u8 alloc_size;
83 int nf_ct_extend_register(struct nf_ct_ext_type *type);
84 void nf_ct_extend_unregister(struct nf_ct_ext_type *type);
85 #endif /* _NF_CONNTRACK_EXTEND_H */