Merge branch 'for-2.6.39' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
[pandora-kernel.git] / include / linux / netfilter / ipset / pfxlen.h
1 #ifndef _PFXLEN_H
2 #define _PFXLEN_H
3
4 #include <asm/byteorder.h>
5 #include <linux/netfilter.h> 
6
7 /* Prefixlen maps, by Jan Engelhardt  */
8 extern const union nf_inet_addr ip_set_netmask_map[];
9 extern const union nf_inet_addr ip_set_hostmask_map[];
10
11 static inline __be32
12 ip_set_netmask(u8 pfxlen)
13 {
14         return ip_set_netmask_map[pfxlen].ip;
15 }
16
17 static inline const __be32 *
18 ip_set_netmask6(u8 pfxlen)
19 {
20         return &ip_set_netmask_map[pfxlen].ip6[0];
21 }
22
23 static inline u32
24 ip_set_hostmask(u8 pfxlen)
25 {
26         return (__force u32) ip_set_hostmask_map[pfxlen].ip;
27 }
28
29 static inline const __be32 *
30 ip_set_hostmask6(u8 pfxlen)
31 {
32         return &ip_set_hostmask_map[pfxlen].ip6[0];
33 }
34
35 #endif /*_PFXLEN_H */