[NETFILTER]: Avoid skb_copy/pskb_copy/skb_realloc_headroom
[deliverable/linux.git] / include / net / netfilter / nf_conntrack_core.h
CommitLineData
9fb9cbb1
YK
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>
77ab9cff 16#include <net/netfilter/nf_conntrack_l3proto.h>
605dcad6 17#include <net/netfilter/nf_conntrack_l4proto.h>
f6180121 18#include <net/netfilter/nf_conntrack_ecache.h>
9fb9cbb1
YK
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. */
23extern unsigned int nf_conntrack_in(int pf,
24 unsigned int hooknum,
25 struct sk_buff **pskb);
26
27extern int nf_conntrack_init(void);
28extern void nf_conntrack_cleanup(void);
29
ac5357eb
PM
30extern int nf_conntrack_proto_init(void);
31extern void nf_conntrack_proto_fini(void);
32
ceceae1b
YK
33extern int nf_conntrack_helper_init(void);
34extern void nf_conntrack_helper_fini(void);
35
9fb9cbb1
YK
36struct nf_conntrack_l3proto;
37extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf);
38/* Like above, but you already have conntrack read lock. */
39extern struct nf_conntrack_l3proto *__nf_ct_find_l3proto(u_int16_t l3proto);
40
605dcad6 41struct nf_conntrack_l4proto;
9fb9cbb1
YK
42
43extern int
44nf_ct_get_tuple(const struct sk_buff *skb,
45 unsigned int nhoff,
46 unsigned int dataoff,
47 u_int16_t l3num,
48 u_int8_t protonum,
49 struct nf_conntrack_tuple *tuple,
50 const struct nf_conntrack_l3proto *l3proto,
605dcad6 51 const struct nf_conntrack_l4proto *l4proto);
9fb9cbb1
YK
52
53extern int
54nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
55 const struct nf_conntrack_tuple *orig,
56 const struct nf_conntrack_l3proto *l3proto,
605dcad6 57 const struct nf_conntrack_l4proto *l4proto);
9fb9cbb1
YK
58
59/* Find a connection corresponding to a tuple. */
60extern struct nf_conntrack_tuple_hash *
330f7db5 61nf_conntrack_find_get(const struct nf_conntrack_tuple *tuple);
9fb9cbb1
YK
62
63extern int __nf_conntrack_confirm(struct sk_buff **pskb);
64
65/* Confirm a connection: returns NF_DROP if packet must be dropped. */
66static inline int nf_conntrack_confirm(struct sk_buff **pskb)
67{
68 struct nf_conn *ct = (struct nf_conn *)(*pskb)->nfct;
69 int ret = NF_ACCEPT;
70
71 if (ct) {
ec68e97d 72 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
9fb9cbb1
YK
73 ret = __nf_conntrack_confirm(pskb);
74 nf_ct_deliver_cached_events(ct);
75 }
76 return ret;
77}
78
79extern void __nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb);
80
77ab9cff
MJ
81int
82print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
83 struct nf_conntrack_l3proto *l3proto,
605dcad6 84 struct nf_conntrack_l4proto *proto);
77ab9cff 85
f205c5e0 86extern struct hlist_head *nf_conntrack_hash;
9fb9cbb1 87extern rwlock_t nf_conntrack_lock ;
f205c5e0 88extern struct hlist_head unconfirmed;
7e5d03bb 89
9fb9cbb1 90#endif /* _NF_CONNTRACK_CORE_H */
This page took 0.232885 seconds and 5 git commands to generate.