unicoap_options_iterator_t Struct Reference

The iterator you use to retrieve option values in-order. More...

Detailed Description

The iterator you use to retrieve option values in-order.

Example

unicoap_option_iterator iterator = {0};
unicoap_options_iterator_init(&iterator, message->options);
uint8_t* value = NULL;
ssize_t size = -1;
while ((size = unicoap_options_get_next(&iterator, &number, &value)) >= 0) {
printf("%s (%i) = (%" PRIiSIZE " bytes): ", unicoap_string_from_option_number(number), number, size);
my_dump_hex(value, size);
}
#define printf(...)
A wrapper for the printf() function that passes arguments through unmodified, but fails to compile if...
Definition: stdio.h:60
static void unicoap_options_iterator_init(unicoap_options_iterator_t *iterator, unicoap_options_t *options)
Initializes the given iterator structure.
Definition: options.h:601
ssize_t unicoap_options_get_next(unicoap_options_iterator_t *iterator, unicoap_option_number_t *number, const uint8_t **value)
Gets the next option provided by the given iterator.
unicoap_option_number_t
CoAP option number.
Definition: constants.h:419
const char * unicoap_string_from_option_number(unicoap_option_number_t number)
Returns label of option corresponding to the given number.
#define PRIiSIZE
Macro holding the format specifier to print an ssize_t variable.
Definition: architecture.h:168

Definition at line 582 of file options.h.

#include <options.h>

Data Fields

unicoap_options_toptions
 Options.
 
size_t index
 Current option's index.
 

Enumerating options

static void unicoap_options_iterator_init (unicoap_options_iterator_t *iterator, unicoap_options_t *options)
 Initializes the given iterator structure. More...
 
ssize_t unicoap_options_get_next (unicoap_options_iterator_t *iterator, unicoap_option_number_t *number, const uint8_t **value)
 Gets the next option provided by the given iterator. More...
 
ssize_t unicoap_options_get_next_by_number (unicoap_options_iterator_t *iterator, unicoap_option_number_t number, const uint8_t **value)
 Gets the next option with the given number, potentially skipping any options in between. More...
 
ssize_t unicoap_options_get_next_query_by_name (unicoap_options_iterator_t *iterator, unicoap_option_number_t number, const char *name, const char **value)
 Gets the next query option matching the given name, potentially skipping any options in between. More...
 

The documentation for this struct was generated from the following file: