Lines Matching refs:buf

30 static int unpack_uint8(struct buf_ctx *buf, uint8_t *val)  in unpack_uint8()  argument
32 uint8_t *cur = buf->cur; in unpack_uint8()
33 uint8_t *end = buf->end; in unpack_uint8()
42 buf->cur = (cur + sizeof(uint8_t)); in unpack_uint8()
60 static int unpack_uint16(struct buf_ctx *buf, uint16_t *val) in unpack_uint16() argument
62 uint8_t *cur = buf->cur; in unpack_uint16()
63 uint8_t *end = buf->end; in unpack_uint16()
72 buf->cur = (cur + sizeof(uint16_t)); in unpack_uint16()
90 static int unpack_utf8_str(struct buf_ctx *buf, struct mqtt_utf8 *str) in unpack_utf8_str() argument
95 NET_DBG(">> cur:%p, end:%p", (void *)buf->cur, (void *)buf->end); in unpack_utf8_str()
97 err_code = unpack_uint16(buf, &utf8_strlen); in unpack_utf8_str()
102 if ((buf->end - buf->cur) < utf8_strlen) { in unpack_utf8_str()
110 str->utf8 = buf->cur; in unpack_utf8_str()
111 buf->cur += utf8_strlen; in unpack_utf8_str()
133 static int unpack_data(uint32_t length, struct buf_ctx *buf, in unpack_data() argument
136 NET_DBG(">> cur:%p, end:%p", (void *)buf->cur, (void *)buf->end); in unpack_data()
138 if ((buf->end - buf->cur) < length) { in unpack_data()
146 str->data = buf->cur; in unpack_data()
147 buf->cur += length; in unpack_data()
168 static int packet_length_decode(struct buf_ctx *buf, uint32_t *length) in packet_length_decode() argument
179 if (buf->cur >= buf->end) { in packet_length_decode()
183 *length += ((uint32_t)*(buf->cur) & MQTT_LENGTH_VALUE_MASK) in packet_length_decode()
187 } while ((*(buf->cur++) & MQTT_LENGTH_CONTINUATION_BIT) != 0U); in packet_length_decode()
198 int fixed_header_decode(struct buf_ctx *buf, uint8_t *type_and_flags, in fixed_header_decode() argument
203 err_code = unpack_uint8(buf, type_and_flags); in fixed_header_decode()
208 return packet_length_decode(buf, length); in fixed_header_decode()
211 int connect_ack_decode(const struct mqtt_client *client, struct buf_ctx *buf, in connect_ack_decode() argument
217 err_code = unpack_uint8(buf, &flags); in connect_ack_decode()
222 err_code = unpack_uint8(buf, &ret_code); in connect_ack_decode()
240 int publish_decode(uint8_t flags, uint32_t var_length, struct buf_ctx *buf, in publish_decode() argument
250 err_code = unpack_utf8_str(buf, &param->message.topic.topic); in publish_decode()
258 err_code = unpack_uint16(buf, &param->message_id); in publish_decode()
279 int publish_ack_decode(struct buf_ctx *buf, struct mqtt_puback_param *param) in publish_ack_decode() argument
281 return unpack_uint16(buf, &param->message_id); in publish_ack_decode()
284 int publish_receive_decode(struct buf_ctx *buf, struct mqtt_pubrec_param *param) in publish_receive_decode() argument
286 return unpack_uint16(buf, &param->message_id); in publish_receive_decode()
289 int publish_release_decode(struct buf_ctx *buf, struct mqtt_pubrel_param *param) in publish_release_decode() argument
291 return unpack_uint16(buf, &param->message_id); in publish_release_decode()
294 int publish_complete_decode(struct buf_ctx *buf, in publish_complete_decode() argument
297 return unpack_uint16(buf, &param->message_id); in publish_complete_decode()
300 int subscribe_ack_decode(struct buf_ctx *buf, struct mqtt_suback_param *param) in subscribe_ack_decode() argument
304 err_code = unpack_uint16(buf, &param->message_id); in subscribe_ack_decode()
309 return unpack_data(buf->end - buf->cur, buf, &param->return_codes); in subscribe_ack_decode()
312 int unsubscribe_ack_decode(struct buf_ctx *buf, in unsubscribe_ack_decode() argument
315 return unpack_uint16(buf, &param->message_id); in unsubscribe_ack_decode()