Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
423 | giacomo | 1 | /* Header for use in defining a given protocol for connection tracking. */ |
2 | #ifndef _IP_CONNTRACK_PROTOCOL_H |
||
3 | #define _IP_CONNTRACK_PROTOCOL_H |
||
4 | #include <linux/netfilter_ipv4/ip_conntrack.h> |
||
5 | |||
6 | struct ip_conntrack_protocol |
||
7 | { |
||
8 | /* Next pointer. */ |
||
9 | struct list_head list; |
||
10 | |||
11 | /* Protocol number. */ |
||
12 | u_int8_t proto; |
||
13 | |||
14 | /* Protocol name */ |
||
15 | const char *name; |
||
16 | |||
17 | /* Try to fill in the third arg: dataoff is offset past IP |
||
18 | hdr. Return true if possible. */ |
||
19 | int (*pkt_to_tuple)(const struct sk_buff *skb, |
||
20 | unsigned int dataoff, |
||
21 | struct ip_conntrack_tuple *tuple); |
||
22 | |||
23 | /* Invert the per-proto part of the tuple: ie. turn xmit into reply. |
||
24 | * Some packets can't be inverted: return 0 in that case. |
||
25 | */ |
||
26 | int (*invert_tuple)(struct ip_conntrack_tuple *inverse, |
||
27 | const struct ip_conntrack_tuple *orig); |
||
28 | |||
29 | /* Print out the per-protocol part of the tuple. */ |
||
30 | unsigned int (*print_tuple)(char *buffer, |
||
31 | const struct ip_conntrack_tuple *); |
||
32 | |||
33 | /* Print out the private part of the conntrack. */ |
||
34 | unsigned int (*print_conntrack)(char *buffer, |
||
35 | const struct ip_conntrack *); |
||
36 | |||
37 | /* Returns verdict for packet, or -1 for invalid. */ |
||
38 | int (*packet)(struct ip_conntrack *conntrack, |
||
39 | const struct sk_buff *skb, |
||
40 | enum ip_conntrack_info ctinfo); |
||
41 | |||
42 | /* Called when a new connection for this protocol found; |
||
43 | * returns TRUE if it's OK. If so, packet() called next. */ |
||
44 | int (*new)(struct ip_conntrack *conntrack, const struct sk_buff *skb); |
||
45 | |||
46 | /* Called when a conntrack entry is destroyed */ |
||
47 | void (*destroy)(struct ip_conntrack *conntrack); |
||
48 | |||
49 | /* Has to decide if a expectation matches one packet or not */ |
||
50 | int (*exp_matches_pkt)(struct ip_conntrack_expect *exp, |
||
51 | const struct sk_buff *skb); |
||
52 | |||
53 | /* Module (if any) which this is connected to. */ |
||
54 | struct module *me; |
||
55 | }; |
||
56 | |||
57 | /* Protocol registration. */ |
||
58 | extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto); |
||
59 | extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto); |
||
60 | |||
61 | /* Existing built-in protocols */ |
||
62 | extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp; |
||
63 | extern struct ip_conntrack_protocol ip_conntrack_protocol_udp; |
||
64 | extern struct ip_conntrack_protocol ip_conntrack_protocol_icmp; |
||
65 | extern int ip_conntrack_protocol_tcp_init(void); |
||
66 | #endif /*_IP_CONNTRACK_PROTOCOL_H*/ |