endian: MacOS X support for endian conversion macros
betohX/htobeX are only available on GNU/Linux. This change introduces a
header file that maps these functions to the ones available on MacOS X.
diff --git a/include/gsm/endian.h b/include/gsm/endian.h
new file mode 100644
index 0000000..c176a49
--- /dev/null
+++ b/include/gsm/endian.h
@@ -0,0 +1,15 @@
+#ifndef GSM_ENDIAN_H
+#define GSM_ENDIAN_H
+
+#if defined(__linux__)
+# include <endian.h>
+#elif defined(__APPLE__)
+# include <libkern/OSByteOrder.h>
+
+# define htobe16(x) OSSwapHostToBigInt16(x)
+# define htobe32(x) OSSwapHostToBigInt32(x)
+
+# define be32toh(x) OSSwapBigToHostInt32(x)
+#endif
+
+#endif /* GSM_ENDIAN_H */