Lines Matching refs:option
221 coap_opt_t *option;
224 while ((option = coap_option_next(&opt_iter))) {
228 coap_opt_length(option),
229 coap_opt_value(option)))
431 coap_opt_t *option;
439 while ((option = coap_option_next(&opt_iter))) {
441 /* Found option to delete */
445 if (!option)
448 if (!coap_opt_parse(option, pdu->used_size - (option - pdu->token),
460 /* can simply update the delta of next option */
463 /* next option delta size increase */
468 /* can simply update the delta of next option */
471 /* next option delta size increase */
472 if (next_option - option < 2) {
479 while ((option = coap_option_next(&opt_iter))) {
481 /* Found option to delete */
486 assert(option != NULL);
500 /* next option delta size increase */
510 next_option = option + coap_opt_encode_size(decode_this.delta,
511 coap_opt_length(option));
515 memmove(option, next_option, pdu->used_size - (next_option - pdu->token));
516 pdu->used_size -= next_option - option;
518 pdu->data -= next_option - option;
524 /* Validate that the option is repeatable */
569 coap_opt_t *option;
581 while ((option = coap_option_next(&opt_iter))) {
588 assert(option != NULL);
589 /* size of option inc header to insert */
592 /* size of next option (header may shrink in size as delta changes */
593 if (!coap_opt_parse(option, pdu->used_size - (option - pdu->token), &decode))
608 while ((option = coap_option_next(&opt_iter))) {
614 assert(option != NULL);
617 /* can simply patch in the new delta of next option */
618 option[0] = (option[0] & 0x0f) + (coap_opt_t)(opt_delta << 4);
620 /* option header is going to shrink by one byte */
621 option[1] = (option[0] & 0x0f) + (coap_opt_t)(opt_delta << 4);
624 /* can simply patch in the new delta of next option */
625 option[1] = (coap_opt_t)(opt_delta - 13);
627 /* option header is going to shrink by two bytes */
628 option[2] = (option[0] & 0x0f) + (coap_opt_t)(opt_delta << 4);
631 /* option header is going to shrink by one bytes */
632 option[1] = (option[0] & 0x0f) + 0xd0;
633 option[2] = (coap_opt_t)(opt_delta - 13);
636 /* can simply patch in the new delta of next option */
637 option[1] = (coap_opt_t)((opt_delta - 269) >> 8);
638 option[2] = (opt_delta - 269) & 0xff;
641 memmove(&option[shift], &option[shrink],
642 pdu->used_size - (option - pdu->token) - shrink);
643 if (!coap_opt_encode(option, pdu->alloc_size - pdu->used_size,
663 coap_opt_t *option;
668 option = coap_check_option(pdu, number, &opt_iter);
669 if (!option)
672 old_length = coap_opt_parse(option, (size_t)-1, &decode);
682 option = coap_check_option(pdu, number, &opt_iter);
686 memmove(&option[new_length], &option[old_length],
687 pdu->used_size - (option - pdu->token) - old_length);
689 if (!coap_opt_encode(option, new_length,
732 * Need to check whether there is a hop-limit option. If not, it needs
755 /* include option delimiter */
764 /* encode option and check length */
769 coap_log_warn("coap_add_option: cannot add option\n");
898 * Advances *optp to next option if still in PDU. This function
904 coap_option_t option;
911 optsize = coap_opt_parse(*optp, *length, &option);
915 /* signal an error if this option would exceed the
917 if (*max_opt + option.delta > COAP_MAX_OPT) {
920 *max_opt += option.delta;
1307 coap_log_debug("coap_pdu_parse: %d.%02d: offset %u malformed option\n",
1316 coap_log_warn("coap_pdu_parse: %d.%02d: offset %u option %u has bad length %" PRIu32 "\n",