Options header. More...

Detailed Description

#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <sys/types.h>
#include "byteorder.h"
#include "net/unicoap/constants.h"
#include "net/unicoap/util_macros.h"
+ Include dependency graph for options.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  unicoap_option_entry_t
 Helper struct for options parser. More...
 
struct  unicoap_options_t
 CoAP options container. More...
 
struct  unicoap_options_iterator_t
 The iterator you use to retrieve option values in-order. More...
 

Allocating option buffers

#define UNICOAP_OPTIONS_ALLOC(name, capacity)    _UNICOAP_OPTIONS_ALLOC(_CONCAT3(name, _storage, __LINE__), name, capacity,)
 Allocates options with buffer capacity. More...
 
#define UNICOAP_OPTIONS_ALLOC_STATIC(name, capacity)    _UNICOAP_OPTIONS_ALLOC(_CONCAT3(name, _storage, __LINE__), name, capacity, static)
 Statically allocates options with buffer capacity. More...
 
#define UNICOAP_OPTIONS_ALLOC_DEFAULT(name)    UNICOAP_OPTIONS_ALLOC(name, CONFIG_UNICOAP_OPTIONS_BUFFER_DEFAULT_CAPACITY)
 Allocates options with default capacity. More...
 
#define UNICOAP_OPTIONS_ALLOC_STATIC_DEFAULT(name)    UNICOAP_OPTIONS_ALLOC_STATIC(name, CONFIG_UNICOAP_OPTIONS_BUFFER_DEFAULT_CAPACITY)
 Statically allocates options with default capacity. More...
 

Auxiliary constants

#define EBADOPT   151
 Bad option.
 
#define EPAYLD   152
 Cannot read option, encountered payload marker.
 
#define UNICOAP_UINT24_MAX   (0xffffff)
 Largest number representable with 24 bits (3 bytes)
 
#define UNICOAP_UINT24_SIZE   (3)
 Size in bytes of number representable with 24 bits (3 bytes)
 
#define UNICOAP_UINT_MAX   (14 + 255 + 0xffff)
 Unsigned integer large enough to accommodate the maximum integer representable by CoAP option delta fields and extended length fields. More...
 

Observe

#define UNICOAP_OBSERVE_OPTION_REGISTER   (0)
 Observe value for registering for notifications.
 
#define UNICOAP_OBSERVE_OPTION_DEREGISTER   (1)
 Observe value for cancelling a registration for notifications.
 

Block-wise Transfers

#define UNICOAP_BLOCK_OPTION_NONE   (0x0f000000)
 Sentinel value for unicoap_block_option_t indicating an uninitialized value. More...
 
typedef uint32_t unicoap_block_option_t
 Block1 and Block2 option value
 

Option characteristics

static bool unicoap_option_is_critical (unicoap_option_number_t option_number)
 Determines whether the given option is considered critical. More...
 
static bool unicoap_option_is_safe_to_forward (unicoap_option_number_t option_number)
 Determines whether the given option is safe to forward. More...
 
static bool unicoap_option_is_no_cache_key (unicoap_option_number_t option_number)
 Determines whether the given option is not intended to be part of the cache key. More...
 
static bool unicoap_option_is_cache_key (unicoap_option_number_t option_number)
 Determines whether the given option is intended to be part of the cache key. More...
 

Tools

const char * unicoap_string_from_option_number (unicoap_option_number_t number)
 Returns label of option corresponding to the given number. More...