Lines Matching defs:length

51   pdu->actual_token.length = 0;
208 size_t length = old_pdu->used_size - old_pdu->e_token_length -
211 if (!coap_pdu_resize(pdu, length + pdu->e_token_length))
215 old_pdu->token + old_pdu->e_token_length, length);
216 pdu->used_size += length;
274 if (pdu->actual_token.length < COAP_TOKEN_EXT_1B_BIAS)
276 else if (pdu->actual_token.length < COAP_TOKEN_EXT_2B_BIAS)
315 pdu->actual_token.length = len;
331 pdu->actual_token.length = len;
403 pdu->actual_token.length = len;
764 /* encode option and check length */
903 next_option_safe(coap_opt_t **optp, size_t *length, uint16_t *max_opt) {
909 assert(length);
911 optsize = coap_opt_parse(*optp, *length, &option);
913 assert(optsize <= *length);
922 *length -= optsize;
961 size_t length) {
965 assert(coap_pdu_parse_header_size(proto, data) <= length);
970 if ((proto == COAP_PROTO_TCP || proto==COAP_PROTO_TLS) && length >= 1) {
977 } else if (length >= 2) {
981 } else if (length >= 3) {
985 } else if (length >= 5) {
993 /* account for the token length */
1042 pdu->actual_token.length = pdu->e_token_length;
1046 pdu->actual_token.length = pdu->e_token_length - 1;
1051 pdu->actual_token.length = pdu->e_token_length - 2;
1058 pdu->actual_token.length = 0;
1297 size_t length = pdu->used_size - pdu->e_token_length;
1299 while (length > 0 && *opt != COAP_PAYLOAD_START) {
1303 size_t optsize = next_option_safe(&opt, &length, &pdu->max_opt);
1316 coap_log_warn("coap_pdu_parse: %d.%02d: offset %u option %u has bad length %" PRIu32 "\n",
1339 length = pdu->used_size - pdu->e_token_length;
1345 while (length > 0 && *opt != COAP_PAYLOAD_START) {
1347 size_t optsize = next_option_safe(&opt, &length, &pdu->max_opt);
1357 length = 0;
1368 if (length && *opt == COAP_PAYLOAD_START) {
1377 if (length > 0) {
1380 length--;
1382 if (length == 0) {
1387 if (length > 0)
1399 size_t length,
1403 if (length == 0)
1406 if (!hdr_size || hdr_size > length)
1410 if (!coap_pdu_resize(pdu, length - hdr_size))
1413 memcpy(pdu->token - hdr_size, data, length);
1415 pdu->used_size = length - hdr_size;
1426 if (pdu->actual_token.length < COAP_TOKEN_EXT_1B_BIAS) {
1427 e_token_length = (uint8_t)pdu->actual_token.length;
1428 } else if (pdu->actual_token.length < COAP_TOKEN_EXT_2B_BIAS) {
1430 } else if (pdu->actual_token.length <= COAP_TOKEN_EXT_MAX) {