|
libcoap 4.3.3
|
API for handling strings and binary data. More...
Collaboration diagram for String handling support:Data Structures | |
| struct | coap_string_t |
| CoAP string data definition. More... | |
| struct | coap_str_const_t |
| CoAP string data definition with const data. More... | |
| struct | coap_binary_t |
| CoAP binary data definition. More... | |
| struct | coap_bin_const_t |
| CoAP binary data definition with const data. More... | |
Macros | |
| #define | COAP_SET_STR(st, l, v) { (st)->length = (l), (st)->s = (v); } |
| #define | COAP_MAX_STR_CONST_FUNC 2 |
| #define | coap_string_equal(string1, string2) |
| Compares the two strings for equality. More... | |
| #define | coap_binary_equal(binary1, binary2) |
| Compares the two binary data for equality. More... | |
Typedefs | |
| typedef struct coap_string_t | coap_string_t |
| CoAP string data definition. More... | |
| typedef struct coap_str_const_t | coap_str_const_t |
| CoAP string data definition with const data. More... | |
| typedef struct coap_binary_t | coap_binary_t |
| CoAP binary data definition. More... | |
| typedef struct coap_bin_const_t | coap_bin_const_t |
| CoAP binary data definition with const data. More... | |
Functions | |
| coap_string_t * | coap_new_string (size_t size) |
| Returns a new string object with at least size+1 bytes storage allocated. More... | |
| void | coap_delete_string (coap_string_t *string) |
| Deletes the given string and releases any memory allocated. More... | |
| coap_str_const_t * | coap_new_str_const (const uint8_t *data, size_t size) |
| Returns a new const string object with at least size+1 bytes storage allocated, and the provided data copied into the string object. More... | |
| void | coap_delete_str_const (coap_str_const_t *string) |
| Deletes the given const string and releases any memory allocated. More... | |
| coap_binary_t * | coap_new_binary (size_t size) |
| Returns a new binary object with at least size bytes storage allocated. More... | |
| void | coap_delete_binary (coap_binary_t *binary) |
| Deletes the given coap_binary_t object and releases any memory allocated. More... | |
| coap_binary_t * | coap_resize_binary (coap_binary_t *binary, size_t new_size) |
| Resizes the given coap_binary_t object. More... | |
| coap_bin_const_t * | coap_new_bin_const (const uint8_t *data, size_t size) |
| Take the specified byte array (text) and create a coap_bin_const_t * Returns a new const binary object with at least size bytes storage allocated, and the provided data copied into the binary object. More... | |
| void | coap_delete_bin_const (coap_bin_const_t *binary) |
| Deletes the given const binary data and releases any memory allocated. More... | |
| coap_str_const_t * | coap_make_str_const (const char *string) |
| Take the specified byte array (text) and create a coap_str_const_t *. More... | |
API for handling strings and binary data.
| #define coap_binary_equal | ( | binary1, | |
| binary2 | |||
| ) |
Compares the two binary data for equality.
| binary1 | The first binary data. |
| binary2 | The second binary data. |
1 if the binary data is equal 0 otherwise. Definition at line 203 of file coap_str.h.
| #define COAP_MAX_STR_CONST_FUNC 2 |
Definition at line 162 of file coap_str.h.
| #define COAP_SET_STR | ( | st, | |
| l, | |||
| v | |||
| ) | { (st)->length = (l), (st)->s = (v); } |
Definition at line 51 of file coap_str.h.
| #define coap_string_equal | ( | string1, | |
| string2 | |||
| ) |
Compares the two strings for equality.
| string1 | The first string. |
| string2 | The second string. |
1 if the strings are equal 0 otherwise. Definition at line 189 of file coap_str.h.
| typedef struct coap_bin_const_t coap_bin_const_t |
CoAP binary data definition with const data.
| typedef struct coap_binary_t coap_binary_t |
CoAP binary data definition.
| typedef struct coap_str_const_t coap_str_const_t |
CoAP string data definition with const data.
| typedef struct coap_string_t coap_string_t |
CoAP string data definition.
| void coap_delete_bin_const | ( | coap_bin_const_t * | binary | ) |
Deletes the given const binary data and releases any memory allocated.
| binary | The binary data to free off. |
Definition at line 120 of file coap_str.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void coap_delete_binary | ( | coap_binary_t * | binary | ) |
Deletes the given coap_binary_t object and releases any memory allocated.
| binary | The coap_binary_t object to free off. |
Definition at line 105 of file coap_str.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void coap_delete_str_const | ( | coap_str_const_t * | string | ) |
Deletes the given const string and releases any memory allocated.
| string | The string to free off. |
Definition at line 61 of file coap_str.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void coap_delete_string | ( | coap_string_t * | string | ) |
Deletes the given string and releases any memory allocated.
| string | The string to free off. |
Definition at line 46 of file coap_str.c.
Here is the call graph for this function:
Here is the caller graph for this function:| coap_str_const_t * coap_make_str_const | ( | const char * | string | ) |
Take the specified byte array (text) and create a coap_str_const_t *.
Note: the array is 2 deep as there are up to two callings of coap_make_str_const in a function call. e.g. coap_add_attr(). Caution: If there are local variable assignments, these will cycle around the var[COAP_MAX_STR_CONST_FUNC] set. No current examples do this.
| string | The const string to convert to a coap_str_const_t * |
Definition at line 66 of file coap_str.c.
Here is the caller graph for this function:| coap_bin_const_t * coap_new_bin_const | ( | const uint8_t * | data, |
| size_t | size | ||
| ) |
Take the specified byte array (text) and create a coap_bin_const_t * Returns a new const binary object with at least size bytes storage allocated, and the provided data copied into the binary object.
The binary data must be released using coap_delete_bin_const().
| data | The data to put in the new string object. |
| size | The size to allocate for the binary data. |
NULL on error. Definition at line 110 of file coap_str.c.
Here is the call graph for this function:
Here is the caller graph for this function:| coap_binary_t * coap_new_binary | ( | size_t | size | ) |
Returns a new binary object with at least size bytes storage allocated.
It is the responsibility of the caller to fill in all the appropriate information. The coap_binary_t object must be released using coap_delete_binary().
| size | The size to allocate for the binary data. |
NULL on error. Definition at line 77 of file coap_str.c.
Here is the call graph for this function:
Here is the caller graph for this function:| coap_str_const_t * coap_new_str_const | ( | const uint8_t * | data, |
| size_t | size | ||
| ) |
Returns a new const string object with at least size+1 bytes storage allocated, and the provided data copied into the string object.
The string must be released using coap_delete_str_const().
| data | The data to put in the new string object. |
| size | The size to allocate for the binary string data. |
NULL on error. Definition at line 51 of file coap_str.c.
Here is the call graph for this function:| coap_string_t * coap_new_string | ( | size_t | size | ) |
Returns a new string object with at least size+1 bytes storage allocated.
It is the responsibility of the caller to fill in all the appropriate information. The string must be released using coap_delete_string().
| size | The size to allocate for the string data. |
NULL on error. Definition at line 21 of file coap_str.c.
Here is the call graph for this function:
Here is the caller graph for this function:| coap_binary_t * coap_resize_binary | ( | coap_binary_t * | binary, |
| size_t | new_size | ||
| ) |
Resizes the given coap_binary_t object.
It is the responsibility of the caller to fill in all the appropriate additional information.
Note: If there is an error, binary will separately need to be released by coap_delete_binary().
| binary | The coap_binary_t object to resize. |
| new_size | The new size to allocate for the binary data. |
NULL on error. Definition at line 82 of file coap_str.c.
Here is the call graph for this function:
Here is the caller graph for this function: