[PATCH] USB: EHCI works again on NVidia controllers with >2GB RAM
[linux-2.6/btrfs-unstable.git] / include / linux / netfilter_ipv4 / ip_conntrack_protocol.h
blob2c76b879e3dc1b774c364f244d5a910fa116d08d
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 #include <linux/netfilter/nfnetlink_conntrack.h>
7 struct seq_file;
9 struct ip_conntrack_protocol
11 /* Protocol number. */
12 u_int8_t proto;
14 /* Protocol name */
15 const char *name;
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);
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. Return like seq_* */
30 int (*print_tuple)(struct seq_file *,
31 const struct ip_conntrack_tuple *);
33 /* Print out the private part of the conntrack. */
34 int (*print_conntrack)(struct seq_file *, const struct ip_conntrack *);
36 /* Returns verdict for packet, or -1 for invalid. */
37 int (*packet)(struct ip_conntrack *conntrack,
38 const struct sk_buff *skb,
39 enum ip_conntrack_info ctinfo);
41 /* Called when a new connection for this protocol found;
42 * returns TRUE if it's OK. If so, packet() called next. */
43 int (*new)(struct ip_conntrack *conntrack, const struct sk_buff *skb);
45 /* Called when a conntrack entry is destroyed */
46 void (*destroy)(struct ip_conntrack *conntrack);
48 int (*error)(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
49 unsigned int hooknum);
51 /* convert protoinfo to nfnetink attributes */
52 int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa,
53 const struct ip_conntrack *ct);
55 /* convert nfnetlink attributes to protoinfo */
56 int (*from_nfattr)(struct nfattr *tb[], struct ip_conntrack *ct);
58 int (*tuple_to_nfattr)(struct sk_buff *skb,
59 const struct ip_conntrack_tuple *t);
60 int (*nfattr_to_tuple)(struct nfattr *tb[],
61 struct ip_conntrack_tuple *t);
63 /* Module (if any) which this is connected to. */
64 struct module *me;
67 /* Protocol registration. */
68 extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto);
69 extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto);
70 /* Existing built-in protocols */
71 extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp;
72 extern struct ip_conntrack_protocol ip_conntrack_protocol_udp;
73 extern struct ip_conntrack_protocol ip_conntrack_protocol_icmp;
74 extern struct ip_conntrack_protocol ip_conntrack_generic_protocol;
75 extern int ip_conntrack_protocol_tcp_init(void);
77 /* Log invalid packets */
78 extern unsigned int ip_ct_log_invalid;
80 extern int ip_ct_port_tuple_to_nfattr(struct sk_buff *,
81 const struct ip_conntrack_tuple *);
82 extern int ip_ct_port_nfattr_to_tuple(struct nfattr *tb[],
83 struct ip_conntrack_tuple *);
85 #ifdef CONFIG_SYSCTL
86 #ifdef DEBUG_INVALID_PACKETS
87 #define LOG_INVALID(proto) \
88 (ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW)
89 #else
90 #define LOG_INVALID(proto) \
91 ((ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW) \
92 && net_ratelimit())
93 #endif
94 #else
95 #define LOG_INVALID(proto) 0
96 #endif /* CONFIG_SYSCTL */
98 #endif /*_IP_CONNTRACK_PROTOCOL_H*/