]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - include/net/netfilter/nf_conntrack_core.h
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
[karo-tx-linux.git] / include / net / netfilter / nf_conntrack_core.h
1 /*
2  * This header is used to share core functionality between the
3  * standalone connection tracking module, and the compatibility layer's use
4  * of connection tracking.
5  *
6  * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
7  *      - generalize L3 protocol dependent part.
8  *
9  * Derived from include/linux/netfiter_ipv4/ip_conntrack_core.h
10  */
11
12 #ifndef _NF_CONNTRACK_CORE_H
13 #define _NF_CONNTRACK_CORE_H
14
15 #include <linux/netfilter.h>
16 #include <net/netfilter/nf_conntrack_l3proto.h>
17 #include <net/netfilter/nf_conntrack_l4proto.h>
18 #include <net/netfilter/nf_conntrack_ecache.h>
19
20 /* This header is used to share core functionality between the
21    standalone connection tracking module, and the compatibility layer's use
22    of connection tracking. */
23 extern unsigned int nf_conntrack_in(int pf,
24                                     unsigned int hooknum,
25                                     struct sk_buff **pskb);
26
27 extern int nf_conntrack_init(void);
28 extern void nf_conntrack_cleanup(void);
29
30 extern int nf_conntrack_proto_init(void);
31 extern void nf_conntrack_proto_fini(void);
32
33 struct nf_conntrack_l3proto;
34 extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf);
35 /* Like above, but you already have conntrack read lock. */
36 extern struct nf_conntrack_l3proto *__nf_ct_find_l3proto(u_int16_t l3proto);
37
38 struct nf_conntrack_l4proto;
39
40 extern int
41 nf_ct_get_tuple(const struct sk_buff *skb,
42                 unsigned int nhoff,
43                 unsigned int dataoff,
44                 u_int16_t l3num,
45                 u_int8_t protonum,
46                 struct nf_conntrack_tuple *tuple,
47                 const struct nf_conntrack_l3proto *l3proto,
48                 const struct nf_conntrack_l4proto *l4proto);
49
50 extern int
51 nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
52                    const struct nf_conntrack_tuple *orig,
53                    const struct nf_conntrack_l3proto *l3proto,
54                    const struct nf_conntrack_l4proto *l4proto);
55
56 /* Find a connection corresponding to a tuple. */
57 extern struct nf_conntrack_tuple_hash *
58 nf_conntrack_find_get(const struct nf_conntrack_tuple *tuple,
59                       const struct nf_conn *ignored_conntrack);
60
61 extern int __nf_conntrack_confirm(struct sk_buff **pskb);
62
63 /* Confirm a connection: returns NF_DROP if packet must be dropped. */
64 static inline int nf_conntrack_confirm(struct sk_buff **pskb)
65 {
66         struct nf_conn *ct = (struct nf_conn *)(*pskb)->nfct;
67         int ret = NF_ACCEPT;
68
69         if (ct) {
70                 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
71                         ret = __nf_conntrack_confirm(pskb);
72                 nf_ct_deliver_cached_events(ct);
73         }
74         return ret;
75 }
76
77 extern void __nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb);
78
79 int
80 print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
81             struct nf_conntrack_l3proto *l3proto,
82             struct nf_conntrack_l4proto *proto);
83
84 extern struct list_head *nf_conntrack_hash;
85 extern struct list_head nf_conntrack_expect_list;
86 extern rwlock_t nf_conntrack_lock ;
87 extern struct list_head unconfirmed;
88
89 #endif /* _NF_CONNTRACK_CORE_H */