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>
10 struct ip_nat_protocol
12 struct list_head list;
17 /* Protocol number. */
18 unsigned int protonum;
20 /* Do a packet translation according to the ip_nat_proto_manip
21 * and manip type. Return true if succeeded. */
22 int (*manip_pkt)(struct sk_buff **pskb,
24 const struct ip_conntrack_manip *manip,
25 enum ip_nat_manip_type maniptype);
27 /* Is the manipable part of the tuple between min and max incl? */
28 int (*in_range)(const struct ip_conntrack_tuple *tuple,
29 enum ip_nat_manip_type maniptype,
30 const union ip_conntrack_manip_proto *min,
31 const union ip_conntrack_manip_proto *max);
33 /* Alter the per-proto part of the tuple (depending on
34 maniptype), to give a unique tuple in the given range if
35 possible; return false if not. Per-protocol part of tuple
36 is initialized to the incoming packet. */
37 int (*unique_tuple)(struct ip_conntrack_tuple *tuple,
38 const struct ip_nat_range *range,
39 enum ip_nat_manip_type maniptype,
40 const struct ip_conntrack *conntrack);
42 unsigned int (*print)(char *buffer,
43 const struct ip_conntrack_tuple *match,
44 const struct ip_conntrack_tuple *mask);
46 unsigned int (*print_range)(char *buffer,
47 const struct ip_nat_range *range);
50 /* Protocol registration. */
51 extern int ip_nat_protocol_register(struct ip_nat_protocol *proto);
52 extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto);
54 extern int init_protocols(void) __init;
55 extern void cleanup_protocols(void);
56 extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum);
58 #endif /*_IP_NAT_PROTO_H*/