version 1.1, 2012/02/21 17:26:12
|
version 1.1.1.2, 2012/10/09 09:22:28
|
Line 112 struct prefix_rd
|
Line 112 struct prefix_rd
|
#define IPV4_NET0(a) ((((u_int32_t) (a)) & 0xff000000) == 0x00000000) |
#define IPV4_NET0(a) ((((u_int32_t) (a)) & 0xff000000) == 0x00000000) |
#define IPV4_NET127(a) ((((u_int32_t) (a)) & 0xff000000) == 0x7f000000) |
#define IPV4_NET127(a) ((((u_int32_t) (a)) & 0xff000000) == 0x7f000000) |
#define IPV4_LINKLOCAL(a) ((((u_int32_t) (a)) & 0xffff0000) == 0xa9fe0000) |
#define IPV4_LINKLOCAL(a) ((((u_int32_t) (a)) & 0xffff0000) == 0xa9fe0000) |
|
#define IPV4_CLASS_DE(a) ((((u_int32_t) (a)) & 0xe0000000) == 0xe0000000) |
|
|
/* Max bit/byte length of IPv6 address. */ |
/* Max bit/byte length of IPv6 address. */ |
#define IPV6_MAX_BYTELEN 16 |
#define IPV6_MAX_BYTELEN 16 |
Line 127 struct prefix_rd
|
Line 128 struct prefix_rd
|
/* Prefix's family member. */ |
/* Prefix's family member. */ |
#define PREFIX_FAMILY(p) ((p)->family) |
#define PREFIX_FAMILY(p) ((p)->family) |
|
|
/* Check bit of the prefix. */ |
|
static inline unsigned int |
|
prefix_bit (const u_char *prefix, const u_char prefixlen) |
|
{ |
|
unsigned int offset = prefixlen / 8; |
|
unsigned int shift = 7 - (prefixlen % 8); |
|
|
|
return (prefix[offset] >> shift) & 1; |
|
} |
|
|
|
static inline unsigned int |
|
prefix6_bit (const struct in6_addr *prefix, const u_char prefixlen) |
|
{ |
|
return prefix_bit((const u_char *) &prefix->s6_addr, prefixlen); |
|
} |
|
|
|
/* Prototypes. */ |
/* Prototypes. */ |
extern int afi2family (afi_t); |
extern int afi2family (afi_t); |
extern afi_t family2afi (int); |
extern afi_t family2afi (int); |
|
|
|
/* Check bit of the prefix. */ |
|
extern unsigned int prefix_bit (const u_char *prefix, const u_char prefixlen); |
|
extern unsigned int prefix6_bit (const struct in6_addr *prefix, const u_char prefixlen); |
|
|
extern struct prefix *prefix_new (void); |
extern struct prefix *prefix_new (void); |
extern void prefix_free (struct prefix *); |
extern void prefix_free (struct prefix *); |
extern const char *prefix_family_str (const struct prefix *); |
extern const char *prefix_family_str (const struct prefix *); |
Line 156 extern int prefix2str (const struct prefix *, char *,
|
Line 145 extern int prefix2str (const struct prefix *, char *,
|
extern int prefix_match (const struct prefix *, const struct prefix *); |
extern int prefix_match (const struct prefix *, const struct prefix *); |
extern int prefix_same (const struct prefix *, const struct prefix *); |
extern int prefix_same (const struct prefix *, const struct prefix *); |
extern int prefix_cmp (const struct prefix *, const struct prefix *); |
extern int prefix_cmp (const struct prefix *, const struct prefix *); |
|
extern int prefix_common_bits (const struct prefix *, const struct prefix *); |
extern void prefix_copy (struct prefix *dest, const struct prefix *src); |
extern void prefix_copy (struct prefix *dest, const struct prefix *src); |
extern void apply_mask (struct prefix *); |
extern void apply_mask (struct prefix *); |
|
|
extern struct prefix *sockunion2prefix (const union sockunion *dest, |
extern struct prefix *sockunion2prefix (const union sockunion *dest, |
const union sockunion *mask); |
const union sockunion *mask); |
extern struct prefix *sockunion2hostprefix (const union sockunion *); |
extern struct prefix *sockunion2hostprefix (const union sockunion *); |
|
extern void prefix2sockunion (const struct prefix *, union sockunion *); |
|
|
extern struct prefix_ipv4 *prefix_ipv4_new (void); |
extern struct prefix_ipv4 *prefix_ipv4_new (void); |
extern void prefix_ipv4_free (struct prefix_ipv4 *); |
extern void prefix_ipv4_free (struct prefix_ipv4 *); |
Line 175 extern int prefix_ipv4_any (const struct prefix_ipv4 *
|
Line 166 extern int prefix_ipv4_any (const struct prefix_ipv4 *
|
extern void apply_classful_mask_ipv4 (struct prefix_ipv4 *); |
extern void apply_classful_mask_ipv4 (struct prefix_ipv4 *); |
|
|
extern u_char ip_masklen (struct in_addr); |
extern u_char ip_masklen (struct in_addr); |
extern void masklen2ip (int, struct in_addr *); | extern void masklen2ip (const int, struct in_addr *); |
/* returns the network portion of the host address */ |
/* returns the network portion of the host address */ |
extern in_addr_t ipv4_network_addr (in_addr_t hostaddr, int masklen); |
extern in_addr_t ipv4_network_addr (in_addr_t hostaddr, int masklen); |
/* given the address of a host on a network and the network mask length, |
/* given the address of a host on a network and the network mask length, |
Line 196 extern void apply_mask_ipv6 (struct prefix_ipv6 *);
|
Line 187 extern void apply_mask_ipv6 (struct prefix_ipv6 *);
|
*((struct prefix_ipv6 *)(DST)) = *((const struct prefix_ipv6 *)(SRC)); |
*((struct prefix_ipv6 *)(DST)) = *((const struct prefix_ipv6 *)(SRC)); |
|
|
extern int ip6_masklen (struct in6_addr); |
extern int ip6_masklen (struct in6_addr); |
extern void masklen2ip6 (int, struct in6_addr *); | extern void masklen2ip6 (const int, struct in6_addr *); |
|
|
extern void str2in6_addr (const char *, struct in6_addr *); |
extern void str2in6_addr (const char *, struct in6_addr *); |
extern const char *inet6_ntoa (struct in6_addr); |
extern const char *inet6_ntoa (struct in6_addr); |