Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 /* Header for use in defining a given protocol. */
  2 #ifndef _IP_NAT_PROTOCOL_H
  3 #define _IP_NAT_PROTOCOL_H
  4 #include <linux/init.h>
  5 #include <linux/list.h>
  6 
  7 struct iphdr;
  8 struct ip_nat_range;
  9 
 10 struct ip_nat_protocol
 11 {
 12         /* Protocol name */
 13         const char *name;
 14 
 15         /* Protocol number. */
 16         unsigned int protonum;
 17 
 18         /* Translate a packet to the target according to manip type.
 19            Return true if succeeded. */
 20         int (*manip_pkt)(struct sk_buff **pskb,
 21                          unsigned int iphdroff,
 22                          const struct ip_conntrack_tuple *tuple,
 23                          enum ip_nat_manip_type maniptype);
 24 
 25         /* Is the manipable part of the tuple between min and max incl? */
 26         int (*in_range)(const struct ip_conntrack_tuple *tuple,
 27                         enum ip_nat_manip_type maniptype,
 28                         const union ip_conntrack_manip_proto *min,
 29                         const union ip_conntrack_manip_proto *max);
 30 
 31         /* Alter the per-proto part of the tuple (depending on
 32            maniptype), to give a unique tuple in the given range if
 33            possible; return false if not.  Per-protocol part of tuple
 34            is initialized to the incoming packet. */
 35         int (*unique_tuple)(struct ip_conntrack_tuple *tuple,
 36                             const struct ip_nat_range *range,
 37                             enum ip_nat_manip_type maniptype,
 38                             const struct ip_conntrack *conntrack);
 39 
 40         unsigned int (*print)(char *buffer,
 41                               const struct ip_conntrack_tuple *match,
 42                               const struct ip_conntrack_tuple *mask);
 43 
 44         unsigned int (*print_range)(char *buffer,
 45                                     const struct ip_nat_range *range);
 46 };
 47 
 48 #define MAX_IP_NAT_PROTO 256
 49 extern struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO];
 50 
 51 /* Protocol registration. */
 52 extern int ip_nat_protocol_register(struct ip_nat_protocol *proto);
 53 extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto);
 54 
 55 static inline struct ip_nat_protocol *ip_nat_find_proto(u_int8_t protocol)
 56 {
 57         return ip_nat_protos[protocol];
 58 }
 59 
 60 /* Built-in protocols. */
 61 extern struct ip_nat_protocol ip_nat_protocol_tcp;
 62 extern struct ip_nat_protocol ip_nat_protocol_udp;
 63 extern struct ip_nat_protocol ip_nat_protocol_icmp;
 64 extern struct ip_nat_protocol ip_nat_unknown_protocol;
 65 
 66 extern int init_protocols(void) __init;
 67 extern void cleanup_protocols(void);
 68 extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum);
 69 
 70 #endif /*_IP_NAT_PROTO_H*/
 71 
  This page was automatically generated by the LXR engine.