Lines Matching refs:length
29 < (unsigned char *)pdu->hdr + pdu->length)) { in options_start()
39 coap_opt_parse(const coap_opt_t *opt, size_t length, coap_option_t *result) { in coap_opt_parse() argument
53 if (length < 1) in coap_opt_parse()
57 result->length = *opt & 0x0f; in coap_opt_parse()
69 ADVANCE_OPT(opt,length,1); in coap_opt_parse()
77 ADVANCE_OPT(opt,length,1); in coap_opt_parse()
85 switch(result->length) { in coap_opt_parse()
93 ADVANCE_OPT(opt,length,1); in coap_opt_parse()
94 result->length = ((*opt & 0xff) << 8) + 269; in coap_opt_parse()
97 ADVANCE_OPT(opt,length,1); in coap_opt_parse()
98 result->length += *opt & 0xff; in coap_opt_parse()
105 ADVANCE_OPT(opt,length,1); in coap_opt_parse()
109 if (length < result->length) { in coap_opt_parse()
116 return (opt + result->length) - opt_start; in coap_opt_parse()
130 if ((unsigned char *)pdu->hdr + pdu->length <= oi->next_option) { in coap_option_iterator_init()
135 assert((sizeof(coap_hdr_t) + pdu->hdr->token_length) <= pdu->length); in coap_option_iterator_init()
137 oi->length = pdu->length - (sizeof(coap_hdr_t) + pdu->hdr->token_length); in coap_option_iterator_init()
150 if (oi->bad || oi->length == 0 || in opt_finished()
178 optsize = coap_opt_parse(oi->next_option, oi->length, &option); in coap_option_next()
180 assert(optsize <= oi->length); in coap_option_next()
183 oi->length -= optsize; in coap_option_next()
252 unsigned short length; in coap_opt_length() local
254 length = *opt & 0x0f; in coap_opt_length()
269 switch (length) { in coap_opt_length()
274 length = (*opt++ << 8) + 269; in coap_opt_length()
277 length += *opt++; in coap_opt_length()
282 return length; in coap_opt_length()
330 unsigned short delta, size_t length) { in coap_opt_setheader() argument
359 if (length < 13) { in coap_opt_setheader()
360 opt[0] |= length & 0x0f; in coap_opt_setheader()
361 } else if (length < 270) { in coap_opt_setheader()
363 debug("insufficient space to encode option length %zu", length); in coap_opt_setheader()
368 opt[++skip] = length - 13; in coap_opt_setheader()
376 opt[++skip] = ((length - 269) >> 8) & 0xff; in coap_opt_setheader()
377 opt[++skip] = (length - 269) & 0xff; in coap_opt_setheader()
385 const unsigned char *val, size_t length) { in coap_opt_encode() argument
388 l = coap_opt_setheader(opt, maxlen, delta, length); in coap_opt_encode()
399 if (maxlen < length) { in coap_opt_encode()
405 memcpy(opt, val, length); in coap_opt_encode()
407 return l + length; in coap_opt_encode()