| 
    libcoap 4.3.5-develop-13abce9
    
   | 
 
CoAP option handling functions. More...
 Include dependency graph for coap_option.c:Go to the source code of this file.
Macros | |
| #define | ADVANCE_OPT(o, e, step) | 
| #define | ADVANCE_OPT_CHECK(o, e, step) | 
| #define | LONG_MASK ((1 << COAP_OPT_FILTER_LONG) - 1) | 
| #define | SHORT_MASK (~LONG_MASK & ((1 << (COAP_OPT_FILTER_LONG + COAP_OPT_FILTER_SHORT)) - 1)) | 
Enumerations | |
| enum | filter_op_t { FILTER_SET , FILTER_CLEAR , FILTER_GET } | 
| Operation specifiers for coap_filter_op().  More... | |
Functions | |
| size_t | coap_opt_parse (const coap_opt_t *opt, size_t length, coap_option_t *result) | 
Parses the option pointed to by opt into result.   | |
| coap_opt_iterator_t * | coap_option_iterator_init (const coap_pdu_t *pdu, coap_opt_iterator_t *oi, const coap_opt_filter_t *filter) | 
Initializes the given option iterator oi to point to the beginning of the pdu's option list.   | |
| COAP_STATIC_INLINE int | opt_finished (coap_opt_iterator_t *oi) | 
| coap_opt_t * | coap_option_next (coap_opt_iterator_t *oi) | 
Updates the iterator oi to point to the next option.   | |
| coap_opt_t * | coap_check_option (const coap_pdu_t *pdu, coap_option_num_t number, coap_opt_iterator_t *oi) | 
Retrieves the first option of number number from pdu.   | |
| uint32_t | coap_opt_length (const coap_opt_t *opt) | 
| Returns the length of the given option.   | |
| const uint8_t * | coap_opt_value (const coap_opt_t *opt) | 
| Returns a pointer to the value of the given option.   | |
| size_t | coap_opt_size (const coap_opt_t *opt) | 
| Returns the size of the given option, taking into account a possible option jump.   | |
| size_t | coap_opt_setheader (coap_opt_t *opt, size_t maxlen, uint16_t delta, size_t length) | 
Encodes the given delta and length values into opt.   | |
| size_t | coap_opt_encode_size (uint16_t delta, size_t length) | 
Compute storage bytes needed for an option with given delta and length.   | |
| size_t | coap_opt_encode (coap_opt_t *opt, size_t maxlen, uint16_t delta, const uint8_t *val, size_t length) | 
Encodes option with given delta into opt.   | |
| COAP_STATIC_INLINE int | is_long_option (coap_option_num_t number) | 
Returns true iff number denotes an option number larger than 255.   | |
| static int | coap_option_filter_op (coap_opt_filter_t *filter, coap_option_num_t number, enum filter_op_t op) | 
Applies op on filter with respect to number.   | |
| void | coap_option_filter_clear (coap_opt_filter_t *filter) | 
Clears filter filter.   | |
| int | coap_option_filter_set (coap_opt_filter_t *filter, coap_option_num_t option) | 
Sets the corresponding entry for number in filter.   | |
| int | coap_option_filter_unset (coap_opt_filter_t *filter, coap_option_num_t option) | 
Clears the corresponding entry for number in filter.   | |
| int | coap_option_filter_get (coap_opt_filter_t *filter, coap_option_num_t option) | 
Checks if number is contained in filter.   | |
| coap_optlist_t * | coap_new_optlist (uint16_t number, size_t length, const uint8_t *data) | 
| Create a new optlist entry.   | |
| static int | order_opts (void *a, void *b) | 
| int | coap_add_optlist_pdu (coap_pdu_t *pdu, coap_optlist_t **options) | 
The current optlist of optlist_chain is first sorted (as per RFC7272 ordering requirements) and then added to the pdu.   | |
| int | coap_insert_optlist (coap_optlist_t **head, coap_optlist_t *node) | 
Adds optlist to the given optlist_chain.   | |
| static int | coap_internal_delete (coap_optlist_t *node) | 
| void | coap_delete_optlist (coap_optlist_t *queue) | 
Removes all entries from the optlist_chain, freeing off their memory usage.   | |
CoAP option handling functions.
Definition in file coap_option.c.
| #define ADVANCE_OPT | ( | o, | |
| e, | |||
| step | |||
| ) | 
Definition at line 22 of file coap_option.c.
| #define ADVANCE_OPT_CHECK | ( | o, | |
| e, | |||
| step | |||
| ) | 
Definition at line 34 of file coap_option.c.
| #define LONG_MASK ((1 << COAP_OPT_FILTER_LONG) - 1) | 
Definition at line 398 of file coap_option.c.
| #define SHORT_MASK (~LONG_MASK & ((1 << (COAP_OPT_FILTER_LONG + COAP_OPT_FILTER_SHORT)) - 1)) | 
Definition at line 399 of file coap_option.c.
| enum filter_op_t | 
Operation specifiers for coap_filter_op().
| Enumerator | |
|---|---|
| FILTER_SET | |
| FILTER_CLEAR | |
| FILTER_GET | |
Definition at line 409 of file coap_option.c.
      
  | 
  static | 
Definition at line 584 of file coap_option.c.
 Here is the call graph for this function:
 Here is the caller graph for this function:| size_t coap_opt_parse | ( | const coap_opt_t * | opt, | 
| size_t | length, | ||
| coap_option_t * | result | ||
| ) | 
Parses the option pointed to by opt into result. 
This function returns the number of bytes that have been parsed, or 0 on error. An error is signaled when illegal delta or length values are encountered or when option parsing would result in reading past the option (i.e. beyond opt + length).
| opt | The beginning of the option to parse. | 
| length | The maximum length of opt.  | 
| result | A pointer to the coap_option_t structure that is filled with actual values iff coap_opt_parse() > 0. | 
0 on error. Definition at line 41 of file coap_option.c.
 Here is the caller graph for this function:| size_t coap_opt_size | ( | const coap_opt_t * | opt | ) | 
Returns the size of the given option, taking into account a possible option jump.
| opt | An option jump or the beginning of the option. | 
opt and the end of the option starting at opt. In case of an error, this function returns 0 as options need at least one byte storage space. Definition at line 284 of file coap_option.c.
 Here is the call graph for this function:
 Here is the caller graph for this function:
      
  | 
  static | 
Applies op on filter with respect to number. 
The following operations are defined:
FILTER_SET: Store number into an empty slot in filter. Returns 1 on success, or 0 if no spare slot was available.
FILTER_CLEAR: Remove number from filter if it exists.
FILTER_GET: Search for number in filter. Returns 1 if found, or 0 if not found.
| filter | The filter object. | 
| number | The option number to set, get or clear in filter.  | 
| op | The operation to apply to filter and number. | 
number with FILTER_SET. Definition at line 431 of file coap_option.c.
 Here is the call graph for this function:
 Here is the caller graph for this function:| COAP_STATIC_INLINE int is_long_option | ( | coap_option_num_t | number | ) | 
Returns true iff number denotes an option number larger than 255. 
Definition at line 404 of file coap_option.c.
 Here is the caller graph for this function:| COAP_STATIC_INLINE int opt_finished | ( | coap_opt_iterator_t * | oi | ) | 
      
  | 
  static |