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

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

Version: ~ [ linux-5.7-rc7 ] ~ [ linux-5.6.14 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.42 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.124 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.181 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.224 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.224 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.84 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ 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 /*
  2  * Copyright (C)2003,2004 USAGI/WIDE Project
  3  *
  4  * Header for use in defining a given L3 protocol for connection tracking.
  5  *
  6  * Author:
  7  *      Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
  8  *
  9  * Derived from include/netfilter_ipv4/ip_conntrack_protocol.h
 10  */
 11 
 12 #ifndef _NF_CONNTRACK_L3PROTO_H
 13 #define _NF_CONNTRACK_L3PROTO_H
 14 #include <linux/netlink.h>
 15 #include <net/netlink.h>
 16 #include <linux/seq_file.h>
 17 #include <net/netfilter/nf_conntrack.h>
 18 
 19 struct nf_conntrack_l3proto {
 20         /* L3 Protocol Family number. ex) PF_INET */
 21         u_int16_t l3proto;
 22 
 23         /* Protocol name */
 24         const char *name;
 25 
 26         /*
 27          * Try to fill in the third arg: nhoff is offset of l3 proto
 28          * hdr.  Return true if possible.
 29          */
 30         bool (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff,
 31                              struct nf_conntrack_tuple *tuple);
 32 
 33         /*
 34          * Invert the per-proto part of the tuple: ie. turn xmit into reply.
 35          * Some packets can't be inverted: return 0 in that case.
 36          */
 37         bool (*invert_tuple)(struct nf_conntrack_tuple *inverse,
 38                              const struct nf_conntrack_tuple *orig);
 39 
 40         /* Print out the per-protocol part of the tuple. */
 41         void (*print_tuple)(struct seq_file *s,
 42                             const struct nf_conntrack_tuple *);
 43 
 44         /*
 45          * Called before tracking. 
 46          *      *dataoff: offset of protocol header (TCP, UDP,...) in skb
 47          *      *protonum: protocol number
 48          */
 49         int (*get_l4proto)(const struct sk_buff *skb, unsigned int nhoff,
 50                            unsigned int *dataoff, u_int8_t *protonum);
 51 
 52         int (*tuple_to_nlattr)(struct sk_buff *skb,
 53                                const struct nf_conntrack_tuple *t);
 54 
 55         /*
 56          * Calculate size of tuple nlattr
 57          */
 58         int (*nlattr_tuple_size)(void);
 59 
 60         int (*nlattr_to_tuple)(struct nlattr *tb[],
 61                                struct nf_conntrack_tuple *t);
 62         const struct nla_policy *nla_policy;
 63 
 64         size_t nla_size;
 65 
 66 #ifdef CONFIG_SYSCTL
 67         const char              *ctl_table_path;
 68 #endif /* CONFIG_SYSCTL */
 69 
 70         /* Init l3proto pernet data */
 71         int (*init_net)(struct net *net);
 72 
 73         /* Module (if any) which this is connected to. */
 74         struct module *me;
 75 };
 76 
 77 extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX];
 78 
 79 /* Protocol pernet registration. */
 80 int nf_ct_l3proto_pernet_register(struct net *net,
 81                                   struct nf_conntrack_l3proto *proto);
 82 void nf_ct_l3proto_pernet_unregister(struct net *net,
 83                                      struct nf_conntrack_l3proto *proto);
 84 
 85 /* Protocol global registration. */
 86 int nf_ct_l3proto_register(struct nf_conntrack_l3proto *proto);
 87 void nf_ct_l3proto_unregister(struct nf_conntrack_l3proto *proto);
 88 
 89 struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto);
 90 
 91 /* Existing built-in protocols */
 92 extern struct nf_conntrack_l3proto nf_conntrack_l3proto_generic;
 93 
 94 static inline struct nf_conntrack_l3proto *
 95 __nf_ct_l3proto_find(u_int16_t l3proto)
 96 {
 97         if (unlikely(l3proto >= AF_MAX))
 98                 return &nf_conntrack_l3proto_generic;
 99         return rcu_dereference(nf_ct_l3protos[l3proto]);
100 }
101 
102 #endif /*_NF_CONNTRACK_L3PROTO_H*/
103 

~ [ 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