From: Peter van Dijk Date: Thu, 19 Nov 2015 09:15:32 +0000 (+0100) Subject: define endianness macros for OS X portability X-Git-Tag: dnsdist-1.0.0-alpha1~210^2~8^2~1^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=323c477aff315f3495d93618a7a51c93c1ca7156;p=pdns define endianness macros for OS X portability --- diff --git a/pdns/iputils.hh b/pdns/iputils.hh index ddc841416..5cd6f8780 100644 --- a/pdns/iputils.hh +++ b/pdns/iputils.hh @@ -41,6 +41,25 @@ #include "namespaces.hh" +#ifdef __APPLE__ +#include + +#define htobe16(x) OSSwapHostToBigInt16(x) +#define htole16(x) OSSwapHostToLittleInt16(x) +#define be16toh(x) OSSwapBigToHostInt16(x) +#define le16toh(x) OSSwapLittleToHostInt16(x) + +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htole32(x) OSSwapHostToLittleInt32(x) +#define be32toh(x) OSSwapBigToHostInt32(x) +#define le32toh(x) OSSwapLittleToHostInt32(x) + +#define htobe64(x) OSSwapHostToBigInt64(x) +#define htole64(x) OSSwapHostToLittleInt64(x) +#define be64toh(x) OSSwapBigToHostInt64(x) +#define le64toh(x) OSSwapLittleToHostInt64(x) +#endif + union ComboAddress { struct sockaddr_in sin4; struct sockaddr_in6 sin6;