inline int unpack_body(uint8_t* src, int src_len) { if (src_len < body_size()) { return -1; } id = read64be(src); src += 8; uint16_t address_size = read16be(src); src += 2; if (src_len < 8 + 2 + address_size) { return -2; } address = std::string((const char*)src, address_size); return 0; }
uint16_t read16(bool be,void *p) { return (be)?(read16be(p)):(read16le(p)); }