Flesh out <arpa/inet.h>.

Use the upstream OpenBSD implementations of these functions.

Also ensure we have symbols for htonl, htons, ntohl, and ntohs.
gtest doesn't like us using the macro versions in ASSERT_EQ.

Bug: 14840760
Change-Id: I68720e9aca14838df457d2bb27b999d5818ac2b5
This commit is contained in:
Elliott Hughes
2014-05-13 16:05:51 -07:00
parent 0ccef7ec52
commit 6a41b0fb0e
18 changed files with 731 additions and 517 deletions

View File

@@ -186,14 +186,22 @@
#define letoh64(x) (x)
#endif /* __BSD_VISIBLE */
#define htons(x) __swap16(x)
/* glibc compatibility. */
__BEGIN_DECLS
uint32_t htonl(uint32_t) __pure2;
uint16_t htons(uint16_t) __pure2;
uint32_t ntohl(uint32_t) __pure2;
uint16_t ntohs(uint16_t) __pure2;
__END_DECLS
#define htonl(x) __swap32(x)
#define ntohs(x) __swap16(x)
#define htons(x) __swap16(x)
#define ntohl(x) __swap32(x)
#define ntohs(x) __swap16(x)
/* Bionic additions */
#define ntohq(x) __swap64(x)
#define htonq(x) __swap64(x)
#define ntohq(x) __swap64(x)
#define __LITTLE_ENDIAN_BITFIELD