Merge master.kernel.org:/home/rmk/linux-2.6-mmc
[pandora-kernel.git] / include / net / netfilter / nf_conntrack_compat.h
1 #ifndef _NF_CONNTRACK_COMPAT_H
2 #define _NF_CONNTRACK_COMPAT_H
3
4 #ifdef __KERNEL__
5
6 #if defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE)
7
8 #include <linux/netfilter_ipv4/ip_conntrack.h>
9
10 #ifdef CONFIG_IP_NF_CONNTRACK_MARK
11 static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
12                                         u_int32_t *ctinfo)
13 {
14         struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
15
16         if (ct)
17                 return &ct->mark;
18         else
19                 return NULL;
20 }
21 #endif /* CONFIG_IP_NF_CONNTRACK_MARK */
22
23 #ifdef CONFIG_IP_NF_CT_ACCT
24 static inline struct ip_conntrack_counter *
25 nf_ct_get_counters(const struct sk_buff *skb)
26 {
27         enum ip_conntrack_info ctinfo;
28         struct ip_conntrack *ct = ip_conntrack_get(skb, &ctinfo);
29
30         if (ct)
31                 return ct->counters;
32         else
33                 return NULL;
34 }
35 #endif /* CONFIG_IP_NF_CT_ACCT */
36
37 static inline int nf_ct_is_untracked(const struct sk_buff *skb)
38 {
39         return (skb->nfct == &ip_conntrack_untracked.ct_general);
40 }
41
42 static inline void nf_ct_untrack(struct sk_buff *skb)
43 {
44         skb->nfct = &ip_conntrack_untracked.ct_general;
45 }
46
47 static inline int nf_ct_get_ctinfo(const struct sk_buff *skb,
48                                    enum ip_conntrack_info *ctinfo)
49 {
50         struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
51         return (ct != NULL);
52 }
53
54 #else /* CONFIG_IP_NF_CONNTRACK */
55
56 #include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
57 #include <net/netfilter/nf_conntrack.h>
58
59 #ifdef CONFIG_NF_CONNTRACK_MARK
60
61 static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
62                                         u_int32_t *ctinfo)
63 {
64         struct nf_conn *ct = nf_ct_get(skb, ctinfo);
65
66         if (ct)
67                 return &ct->mark;
68         else
69                 return NULL;
70 }
71 #endif /* CONFIG_NF_CONNTRACK_MARK */
72
73 #ifdef CONFIG_NF_CT_ACCT
74 static inline struct ip_conntrack_counter *
75 nf_ct_get_counters(const struct sk_buff *skb)
76 {
77         enum ip_conntrack_info ctinfo;
78         struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
79
80         if (ct)
81                 return ct->counters;
82         else
83                 return NULL;
84 }
85 #endif /* CONFIG_NF_CT_ACCT */
86
87 static inline int nf_ct_is_untracked(const struct sk_buff *skb)
88 {
89         return (skb->nfct == &nf_conntrack_untracked.ct_general);
90 }
91
92 static inline void nf_ct_untrack(struct sk_buff *skb)
93 {
94         skb->nfct = &nf_conntrack_untracked.ct_general;
95 }
96
97 static inline int nf_ct_get_ctinfo(const struct sk_buff *skb,
98                                    enum ip_conntrack_info *ctinfo)
99 {
100         struct nf_conn *ct = nf_ct_get(skb, ctinfo);
101         return (ct != NULL);
102 }
103
104 #endif /* CONFIG_IP_NF_CONNTRACK */
105
106 #endif /* __KERNEL__ */
107
108 #endif /* _NF_CONNTRACK_COMPAT_H */