1 #ifndef _IP_NAT_HELPER_H
2 #define _IP_NAT_HELPER_H
3 /* NAT protocol helper routines. */
5 #include <linux/netfilter_ipv4/ip_conntrack.h>
6 #include <linux/module.h>
11 /* NAT helper must be called on every packet (for TCP) */
12 #define IP_NAT_HELPER_F_ALWAYS 0x01
16 struct list_head list; /* Internal use */
18 const char *name; /* name of the module */
19 unsigned char flags; /* Flags (see above) */
20 struct module *me; /* pointer to self */
22 /* Mask of things we will help: vs. tuple from server */
23 struct ip_conntrack_tuple tuple;
24 struct ip_conntrack_tuple mask;
26 /* Helper function: returns verdict */
27 unsigned int (*help)(struct ip_conntrack *ct,
28 struct ip_conntrack_expect *exp,
29 struct ip_nat_info *info,
30 enum ip_conntrack_info ctinfo,
32 struct sk_buff **pskb);
34 /* Returns verdict and sets up NAT for this connection */
35 unsigned int (*expect)(struct sk_buff **pskb,
37 struct ip_conntrack *ct,
38 struct ip_nat_info *info);
41 extern struct list_head helpers;
43 extern int ip_nat_helper_register(struct ip_nat_helper *me);
44 extern void ip_nat_helper_unregister(struct ip_nat_helper *me);
46 /* These return true or false. */
47 extern int ip_nat_mangle_tcp_packet(struct sk_buff **skb,
48 struct ip_conntrack *ct,
49 enum ip_conntrack_info ctinfo,
50 unsigned int match_offset,
51 unsigned int match_len,
52 const char *rep_buffer,
53 unsigned int rep_len);
54 extern int ip_nat_mangle_udp_packet(struct sk_buff **skb,
55 struct ip_conntrack *ct,
56 enum ip_conntrack_info ctinfo,
57 unsigned int match_offset,
58 unsigned int match_len,
59 const char *rep_buffer,
60 unsigned int rep_len);
61 extern int ip_nat_seq_adjust(struct sk_buff **pskb,
62 struct ip_conntrack *ct,
63 enum ip_conntrack_info ctinfo);