diff options
| author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:03:48 -0800 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:03:48 -0800 |
| commit | 4e468ed2eb86a2406e14f1eca82072ee501d05fd (patch) | |
| tree | 4e05b3c66eef86531e464521a3bf96a1864d4bf5 /libc/include/netinet/in6.h | |
| parent | a27d2baa0c1a2ec70f47ea9199b1dd6762c8a349 (diff) | |
| download | bionic-4e468ed2eb86a2406e14f1eca82072ee501d05fd.zip bionic-4e468ed2eb86a2406e14f1eca82072ee501d05fd.tar.gz bionic-4e468ed2eb86a2406e14f1eca82072ee501d05fd.tar.bz2 | |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'libc/include/netinet/in6.h')
| -rw-r--r-- | libc/include/netinet/in6.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/libc/include/netinet/in6.h b/libc/include/netinet/in6.h index 330e718..e645c48 100644 --- a/libc/include/netinet/in6.h +++ b/libc/include/netinet/in6.h @@ -36,6 +36,12 @@ (*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ (*(const uint32_t *)(const void *)(&(a)->s6_addr[12]) == 0)) +#define IN6_IS_ADDR_LOOPBACK(a) \ + ((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ + (*(const uint32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1))) + #define IN6_IS_ADDR_V4COMPAT(a) \ ((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ (*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ @@ -54,10 +60,34 @@ #define IN6_IS_ADDR_SITELOCAL(a) \ (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) -#define IN6_IS_ADDR_MULTICAST(a) \ - (((__const uint8_t *) (a))[0] == 0xff) +#define IN6_IS_ADDR_MULTICAST(a) \ + (((__const uint8_t *) (a))[0] == 0xff) + + +#define IPV6_ADDR_SCOPE_NODELOCAL 0x01 +#define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 +#define IPV6_ADDR_SCOPE_LINKLOCAL 0x02 +#define IPV6_ADDR_SCOPE_SITELOCAL 0x05 +#define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 +#define IPV6_ADDR_SCOPE_GLOBAL 0x0e + +#define IPV6_ADDR_MC_SCOPE(a) \ + ((a)->s6_addr[1] & 0x0f) + +#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL)) +#define IN6_IS_ADDR_MC_SITELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL)) +#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL)) + #define IN6_ARE_ADDR_EQUAL(a, b) \ (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0) +#define INET6_ADDRSTRLEN 46 + #endif /* _NETINET_IN6_H */ |
