40 uint8_t *base = *bufp;
59 const uint8_t *base = *bufp;
62 "Header size %d is less than the minumum fixed length %d",
64 HT_TRY(
"decoding comm header",
76 memset((
void *)(base+6), 0, 4);
77 uint32_t checksum =
fletcher32(base, *bufp-base);
uint32_t decode_i32(const uint8_t **bufp, size_t *remainp)
Decode a 32-bit integer in little-endian order.
uint32_t fletcher32(const void *data8, size_t len8)
Compute fletcher32 checksum for arbitary data.
uint8_t decode_i8(const uint8_t **bufp, size_t *remainp)
Decode a 8-bit integer (a byte/character)
uint64_t decode_i64(const uint8_t **bufp, size_t *remainp)
Decode a 64-bit integer in little-endian order.
uint16_t decode_i16(const uint8_t **bufp, size_t *remainp)
Decode a 16-bit integer in little-endian order.
Logging routines and macros.
void encode_i32(uint8_t **bufp, uint32_t val)
Encode a 32-bit integer in little-endian order.
Compatibility Macros for C/C++.
void encode_i16(uint8_t **bufp, uint16_t val)
Encode a 16-bit integer in little-endian order.
void encode_i64(uint8_t **bufp, uint64_t val)
Encode a 64-bit integer in little-endian order.
Functions to serialize/deserialize primitives to/from a memory buffer.
Implementation of checksum routines.
#define HT_THROWF(_code_, _fmt_,...)
#define HT_TRY(_s_, _code_)
Error codes, Exception handling, error logging.
void encode_i8(uint8_t **bufp, uint8_t val)
Encodes a byte into the given buffer.