kbuild: use in-kernel unifdef
[linux-2.6/verdex.git] / include / linux / netfilter_ipv4 / ip_nat_protocol.h
blob612a43614e7ba659ed3f103b5f4f2e67ef658c48
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>
7 #include <linux/netfilter_ipv4/ip_nat.h>
8 #include <linux/netfilter/nfnetlink_conntrack.h>
10 struct iphdr;
11 struct ip_nat_range;
13 struct ip_nat_protocol
15 /* Protocol name */
16 const char *name;
18 /* Protocol number. */
19 unsigned int protonum;
21 struct module *me;
23 /* Translate a packet to the target according to manip type.
24 Return true if succeeded. */
25 int (*manip_pkt)(struct sk_buff **pskb,
26 unsigned int iphdroff,
27 const struct ip_conntrack_tuple *tuple,
28 enum ip_nat_manip_type maniptype);
30 /* Is the manipable part of the tuple between min and max incl? */
31 int (*in_range)(const struct ip_conntrack_tuple *tuple,
32 enum ip_nat_manip_type maniptype,
33 const union ip_conntrack_manip_proto *min,
34 const union ip_conntrack_manip_proto *max);
36 /* Alter the per-proto part of the tuple (depending on
37 maniptype), to give a unique tuple in the given range if
38 possible; return false if not. Per-protocol part of tuple
39 is initialized to the incoming packet. */
40 int (*unique_tuple)(struct ip_conntrack_tuple *tuple,
41 const struct ip_nat_range *range,
42 enum ip_nat_manip_type maniptype,
43 const struct ip_conntrack *conntrack);
45 int (*range_to_nfattr)(struct sk_buff *skb,
46 const struct ip_nat_range *range);
48 int (*nfattr_to_range)(struct nfattr *tb[],
49 struct ip_nat_range *range);
52 /* Protocol registration. */
53 extern int ip_nat_protocol_register(struct ip_nat_protocol *proto);
54 extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto);
56 extern struct ip_nat_protocol *ip_nat_proto_find_get(u_int8_t protocol);
57 extern void ip_nat_proto_put(struct ip_nat_protocol *proto);
59 /* Built-in protocols. */
60 extern struct ip_nat_protocol ip_nat_protocol_tcp;
61 extern struct ip_nat_protocol ip_nat_protocol_udp;
62 extern struct ip_nat_protocol ip_nat_protocol_icmp;
63 extern struct ip_nat_protocol ip_nat_unknown_protocol;
65 extern int init_protocols(void) __init;
66 extern void cleanup_protocols(void);
67 extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum);
69 extern int ip_nat_port_range_to_nfattr(struct sk_buff *skb,
70 const struct ip_nat_range *range);
71 extern int ip_nat_port_nfattr_to_range(struct nfattr *tb[],
72 struct ip_nat_range *range);
74 #endif /*_IP_NAT_PROTO_H*/