/* Unpacks unsigned 16 bit value from the buffer from the offset requested.  */
static int unpack_uint16(struct buf_ctx *buf, uint16_t *val)
/* Unpacks unsigned 16 bit value from the buffer from the offset requested.  */
static int unpack_uint16(struct buf_ctx *buf, uint16_t *val)
{
	NET_DBG(">> cur:%p, end:%p", (void *)buf->cur, (void *)buf->end);
	if ((buf->end - buf->cur) < sizeof(uint16_t)) {
		return -EINVAL;
	}
	*val = *(buf->cur++) << 8;
	*val |= *(buf->cur++);
	NET_DBG("<< val:%04x", *val);
	return 0;
}