This is CoAP library with a focus on simplicity. It offers minimal CoAP PDU construction and decoding to and from byte buffers.

Revision:
2:6c2e2cdea46a
diff -r 5eec2844ad47 -r 6c2e2cdea46a inet.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inet.h	Sun Jan 20 13:47:43 2019 +0000
@@ -0,0 +1,20 @@
+
+uint16_t htons (uint16_t x) {
+#if BYTE_ORDER == BIG_ENDIAN
+  return x;
+#elif BYTE_ORDER == LITTLE_ENDIAN
+  return __bswap_16 (x);
+#else
+# error "What kind of system is this?"
+#endif
+}
+
+uint16_t ntohs (uint16_t x) {
+#if BYTE_ORDER == BIG_ENDIAN
+  return x;
+#elif BYTE_ORDER == LITTLE_ENDIAN
+  return __bswap_16 (x);
+#else
+# error "What kind of system is this?"
+#endif
+}
\ No newline at end of file