~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/net/netfilter/nf_conntrack_extend.h

Version: ~ [ linux-5.12 ] ~ [ linux-5.11.16 ] ~ [ linux-5.10.32 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.114 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.188 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.231 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.267 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.267 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _NF_CONNTRACK_EXTEND_H
  2 #define _NF_CONNTRACK_EXTEND_H
  3 
  4 #include <net/netfilter/nf_conntrack.h>
  5 
  6 enum nf_ct_ext_id
  7 {
  8         NF_CT_EXT_HELPER,
  9         NF_CT_EXT_NAT,
 10         NF_CT_EXT_ACCT,
 11         NF_CT_EXT_ECACHE,
 12         NF_CT_EXT_NUM,
 13 };
 14 
 15 #define NF_CT_EXT_HELPER_TYPE struct nf_conn_help
 16 #define NF_CT_EXT_NAT_TYPE struct nf_conn_nat
 17 #define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter
 18 #define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
 19 
 20 /* Extensions: optional stuff which isn't permanently in struct. */
 21 struct nf_ct_ext {
 22         struct rcu_head rcu;
 23         u8 offset[NF_CT_EXT_NUM];
 24         u8 len;
 25         char data[0];
 26 };
 27 
 28 static inline int nf_ct_ext_exist(const struct nf_conn *ct, u8 id)
 29 {
 30         return (ct->ext && ct->ext->offset[id]);
 31 }
 32 
 33 static inline void *__nf_ct_ext_find(const struct nf_conn *ct, u8 id)
 34 {
 35         if (!nf_ct_ext_exist(ct, id))
 36                 return NULL;
 37 
 38         return (void *)ct->ext + ct->ext->offset[id];
 39 }
 40 #define nf_ct_ext_find(ext, id) \
 41         ((id##_TYPE *)__nf_ct_ext_find((ext), (id)))
 42 
 43 /* Destroy all relationships */
 44 extern void __nf_ct_ext_destroy(struct nf_conn *ct);
 45 static inline void nf_ct_ext_destroy(struct nf_conn *ct)
 46 {
 47         if (ct->ext)
 48                 __nf_ct_ext_destroy(ct);
 49 }
 50 
 51 /* Free operation. If you want to free a object referred from private area,
 52  * please implement __nf_ct_ext_free() and call it.
 53  */
 54 static inline void nf_ct_ext_free(struct nf_conn *ct)
 55 {
 56         if (ct->ext)
 57                 kfree(ct->ext);
 58 }
 59 
 60 /* Add this type, returns pointer to data or NULL. */
 61 void *
 62 __nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp);
 63 #define nf_ct_ext_add(ct, id, gfp) \
 64         ((id##_TYPE *)__nf_ct_ext_add((ct), (id), (gfp)))
 65 
 66 #define NF_CT_EXT_F_PREALLOC    0x0001
 67 
 68 struct nf_ct_ext_type
 69 {
 70         /* Destroys relationships (can be NULL). */
 71         void (*destroy)(struct nf_conn *ct);
 72         /* Called when realloacted (can be NULL).
 73            Contents has already been moved. */
 74         void (*move)(void *new, void *old);
 75 
 76         enum nf_ct_ext_id id;
 77 
 78         unsigned int flags;
 79 
 80         /* Length and min alignment. */
 81         u8 len;
 82         u8 align;
 83         /* initial size of nf_ct_ext. */
 84         u8 alloc_size;
 85 };
 86 
 87 int nf_ct_extend_register(struct nf_ct_ext_type *type);
 88 void nf_ct_extend_unregister(struct nf_ct_ext_type *type);
 89 #endif /* _NF_CONNTRACK_EXTEND_H */
 90 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp