Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
423 | giacomo | 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 | struct list_head list; |
||
13 | |||
14 | /* Protocol name */ |
||
15 | const char *name; |
||
16 | |||
17 | /* Protocol number. */ |
||
18 | unsigned int protonum; |
||
19 | |||
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, |
||
23 | unsigned int hdroff, |
||
24 | const struct ip_conntrack_manip *manip, |
||
25 | enum ip_nat_manip_type maniptype); |
||
26 | |||
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); |
||
32 | |||
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); |
||
41 | |||
42 | unsigned int (*print)(char *buffer, |
||
43 | const struct ip_conntrack_tuple *match, |
||
44 | const struct ip_conntrack_tuple *mask); |
||
45 | |||
46 | unsigned int (*print_range)(char *buffer, |
||
47 | const struct ip_nat_range *range); |
||
48 | }; |
||
49 | |||
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); |
||
53 | |||
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); |
||
57 | |||
58 | #endif /*_IP_NAT_PROTO_H*/ |