aboutsummaryrefslogtreecommitdiff
path: root/src/include/ndpi_define.h.in
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/ndpi_define.h.in')
-rw-r--r--src/include/ndpi_define.h.in70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/include/ndpi_define.h.in b/src/include/ndpi_define.h.in
index 75f41dac2..c22d69823 100644
--- a/src/include/ndpi_define.h.in
+++ b/src/include/ndpi_define.h.in
@@ -394,33 +394,103 @@ static inline u_int64_t get_u_int64_t(const u_int8_t* X, int O)
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#ifndef htobe16
#define htobe16(x) htons(x)
+#endif
+
+#ifndef htole16
#define htole16(x) (x)
+#endif
+
+#ifndef be16toh
#define be16toh(x) ntohs(x)
+#endif
+
+#ifndef le16toh
#define le16toh(x) (x)
+#endif
+
+#ifndef htobe32
#define htobe32(x) htonl(x)
+#endif
+
+#ifndef htole32
#define htole32(x) (x)
+#endif
+
+#ifndef be32toh
#define be32toh(x) ntohl(x)
+#endif
+
+#ifndef le32toh
#define le32toh(x) (x)
+#endif
+
+#ifndef htobe64
#define htobe64(x) ndpi_htonll(x)
+#endif
+
+#ifndef htole64
#define htole64(x) (x)
+#endif
+
+#ifndef be64toh
#define be64toh(x) ndpi_ntohll(x)
+#endif
+
+#ifndef le64toh
#define le64toh(x) (x)
+#endif
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#ifndef htobe16
#define htobe16(x) (x)
+#endif
+
+#ifndef htole16
#define htole16(x) __builtin_bswap16(x)
+#endif
+
+#ifndef be16toh
#define be16toh(x) (x)
+#endif
+
+#ifndef le16toh
#define le16toh(x) __builtin_bswap16(x)
+#endif
+
+#ifndef htobe32
#define htobe32(x) (x)
+#endif
+
+#ifndef htole32
#define htole32(x) __builtin_bswap32(x)
+#endif
+
+#ifndef be32toh
#define be32toh(x) (x)
+#endif
+
+#ifndef le32toh
#define le32toh(x) __builtin_bswap32(x)
+#endif
+
+#ifndef htobe64
#define htobe64(x) (x)
+#endif
+
+#ifndef htole64
#define htole64(x) __builtin_bswap64(x)
+#endif
+
+#ifndef be64toh
#define be64toh(x) (x)
+#endif
+
+#ifndef le64toh
#define le64toh(x) __builtin_bswap64(x)
+#endif
#else
#error Unexpected __BYTE_ORDER__