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>
6 struct ip_conntrack_protocol
11 /* Protocol number. */
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,
21 struct ip_conntrack_tuple *tuple);
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.
26 int (*invert_tuple)(struct ip_conntrack_tuple *inverse,
27 const struct ip_conntrack_tuple *orig);
29 /* Print out the per-protocol part of the tuple. */
30 unsigned int (*print_tuple)(char *buffer,
31 const struct ip_conntrack_tuple *);
33 /* Print out the private part of the conntrack. */
34 unsigned int (*print_conntrack)(char *buffer,
35 const struct ip_conntrack *);
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);
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);
46 /* Called when a conntrack entry is destroyed */
47 void (*destroy)(struct ip_conntrack *conntrack);
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);
53 /* Module (if any) which this is connected to. */
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);
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*/