Lines Matching refs:length
45 pdu->length = sizeof(coap_hdr_t); in coap_pdu_clear()
66 result->length = pbuf->tot_len; in coap_pdu_from_pbuf()
163 pdu->length = HEADERLENGTH; in coap_add_token()
183 opt = (unsigned char *)pdu->hdr + pdu->length; in coap_add_option()
186 optsize = coap_opt_encode(opt, pdu->max_size - pdu->length, in coap_add_option()
195 pdu->length += optsize; in coap_add_option()
215 opt = (unsigned char *)pdu->hdr + pdu->length; in coap_add_option_later()
218 optsize = coap_opt_encode(opt, pdu->max_size - pdu->length, in coap_add_option_later()
227 pdu->length += optsize; in coap_add_option_later()
241 if (pdu->length + len + 1 > pdu->max_size) { in coap_add_data()
247 pdu->data = (unsigned char *)pdu->hdr + pdu->length; in coap_add_data()
252 pdu->length += len + 1; in coap_add_data()
263 *len = (unsigned char *)pdu->hdr + pdu->length - pdu->data; in coap_get_data()
322 next_option_safe(coap_opt_t **optp, size_t *length) { in next_option_safe() argument
327 assert(length); in next_option_safe()
329 optsize = coap_opt_parse(*optp, *length, &option); in next_option_safe()
331 assert(optsize <= *length); in next_option_safe()
334 *length -= optsize; in next_option_safe()
341 coap_pdu_parse(unsigned char *data, size_t length, coap_pdu_t *pdu) { in coap_pdu_parse() argument
347 if (pdu->max_size < length) { in coap_pdu_parse()
352 if (length < sizeof(coap_hdr_t)) { in coap_pdu_parse()
358 LWIP_ASSERT("coap_pdu_parse with unexpected length", length == pdu->length); in coap_pdu_parse()
370 if (length != sizeof(coap_hdr_t) || pdu->hdr->token_length) { in coap_pdu_parse()
376 if (length < sizeof(coap_hdr_t) + pdu->hdr->token_length in coap_pdu_parse()
388 memcpy(pdu->hdr + 1, data + sizeof(coap_hdr_t), length - sizeof(coap_hdr_t)); in coap_pdu_parse()
389 pdu->length = length; in coap_pdu_parse()
396 length -= (pdu->hdr->token_length + sizeof(coap_hdr_t)); in coap_pdu_parse()
399 while (length && *opt != COAP_PAYLOAD_START) { in coap_pdu_parse()
400 if (!next_option_safe(&opt, (size_t *)&length)) { in coap_pdu_parse()
407 if (length) { in coap_pdu_parse()
409 opt++; length--; in coap_pdu_parse()
411 if (!length) { in coap_pdu_parse()
417 (unsigned char *)pdu->hdr + pdu->length); in coap_pdu_parse()