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

Committer:
Ka_myk
Date:
Sun Jan 20 13:47:43 2019 +0000
Revision:
2:6c2e2cdea46a
add inet and dbg

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Ka_myk 2:6c2e2cdea46a 1
Ka_myk 2:6c2e2cdea46a 2 uint16_t htons (uint16_t x) {
Ka_myk 2:6c2e2cdea46a 3 #if BYTE_ORDER == BIG_ENDIAN
Ka_myk 2:6c2e2cdea46a 4 return x;
Ka_myk 2:6c2e2cdea46a 5 #elif BYTE_ORDER == LITTLE_ENDIAN
Ka_myk 2:6c2e2cdea46a 6 return __bswap_16 (x);
Ka_myk 2:6c2e2cdea46a 7 #else
Ka_myk 2:6c2e2cdea46a 8 # error "What kind of system is this?"
Ka_myk 2:6c2e2cdea46a 9 #endif
Ka_myk 2:6c2e2cdea46a 10 }
Ka_myk 2:6c2e2cdea46a 11
Ka_myk 2:6c2e2cdea46a 12 uint16_t ntohs (uint16_t x) {
Ka_myk 2:6c2e2cdea46a 13 #if BYTE_ORDER == BIG_ENDIAN
Ka_myk 2:6c2e2cdea46a 14 return x;
Ka_myk 2:6c2e2cdea46a 15 #elif BYTE_ORDER == LITTLE_ENDIAN
Ka_myk 2:6c2e2cdea46a 16 return __bswap_16 (x);
Ka_myk 2:6c2e2cdea46a 17 #else
Ka_myk 2:6c2e2cdea46a 18 # error "What kind of system is this?"
Ka_myk 2:6c2e2cdea46a 19 #endif
Ka_myk 2:6c2e2cdea46a 20 }