#ifndef _NETINET_IN_H #define _NETINET_IN_H 1 #include "glibc-bugs.h" #include #include #include #include #include #define SOL_IP 0 #define INET_ADDRSTRLEN 16 #define INET6_ADDRSTRLEN 46 #ifndef htonl #define ___htonl(x) __cpu_to_be32(x) #define ___htons(x) __cpu_to_be16(x) #define ___ntohl(x) __be32_to_cpu(x) #define ___ntohs(x) __be16_to_cpu(x) #define htonl(x) ___htonl(x) #define ntohl(x) ___ntohl(x) #define htons(x) ___htons(x) #define ntohs(x) ___ntohs(x) #endif #define IN6_IS_ADDR_UNSPECIFIED(a) \ (((__const uint32_t *) (a))[0] == 0 \ && ((__const uint32_t *) (a))[1] == 0 \ && ((__const uint32_t *) (a))[2] == 0 \ && ((__const uint32_t *) (a))[3] == 0) #define IN6_IS_ADDR_LOOPBACK(a) \ (((__const uint32_t *) (a))[0] == 0 \ && ((__const uint32_t *) (a))[1] == 0 \ && ((__const uint32_t *) (a))[2] == 0 \ && ((__const uint32_t *) (a))[3] == htonl (1)) #define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff) #define IN6_IS_ADDR_LINKLOCAL(a) \ ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \ == htonl (0xfe800000)) #define IN6_IS_ADDR_SITELOCAL(a) \ ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \ == htonl (0xfec00000)) #define IN6_IS_ADDR_V4MAPPED(a) \ ((((__const uint32_t *) (a))[0] == 0) \ && (((__const uint32_t *) (a))[1] == 0) \ && (((__const uint32_t *) (a))[2] == htonl (0xffff))) #define IN6_IS_ADDR_V4COMPAT(a) \ ((((__const uint32_t *) (a))[0] == 0) \ && (((__const uint32_t *) (a))[1] == 0) \ && (((__const uint32_t *) (a))[2] == 0) \ && (ntohl (((__const uint32_t *) (a))[3]) > 1)) #define IN6_ARE_ADDR_EQUAL(a,b) \ ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0]) \ && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \ && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \ && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3])) #endif /* netinet/in.h */