e1000: FIX: Stop raw interrupts disabled nag from RT
[pandora-kernel.git] / include / linux / netfilter_ipv4 / ip_nat_protocol.h
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 #include <linux/netfilter_ipv4/ip_nat.h>
8 #include <linux/netfilter/nfnetlink_conntrack.h>
9
10 struct iphdr;
11 struct ip_nat_range;
12
13 struct ip_nat_protocol
14 {
15         /* Protocol name */
16         const char *name;
17
18         /* Protocol number. */
19         unsigned int protonum;
20
21         struct module *me;
22
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);
29
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);
35
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);
44
45         int (*range_to_nfattr)(struct sk_buff *skb,
46                                const struct ip_nat_range *range);
47
48         int (*nfattr_to_range)(struct nfattr *tb[],
49                                struct ip_nat_range *range);
50 };
51
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);
55
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);
58
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;
64
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);
68
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);
73
74 #endif /*_IP_NAT_PROTO_H*/