libcoap
4.2.1
|
CoAP PDUs contain normalized URIs with their path and query split into multiple segments. More...
Functions | |
int | coap_split_uri (const uint8_t *str_var, size_t len, coap_uri_t *uri) |
Parses a given string into URI components. More... | |
int | coap_split_path (const uint8_t *s, size_t length, unsigned char *buf, size_t *buflen) |
Splits the given URI path into segments. More... | |
int | coap_split_query (const uint8_t *s, size_t length, unsigned char *buf, size_t *buflen) |
Splits the given URI query into segments. More... | |
coap_string_t * | coap_get_query (const struct coap_pdu_t *request) |
Extract query string from request PDU according to escape rules in 6.5.8. More... | |
coap_string_t * | coap_get_uri_path (const struct coap_pdu_t *request) |
Extract uri_path string from request PDU. More... | |
CoAP PDUs contain normalized URIs with their path and query split into multiple segments.
The functions in this module help splitting strings.
coap_string_t* coap_get_query | ( | const struct coap_pdu_t * | request | ) |
Extract query string from request PDU according to escape rules in 6.5.8.
request | Request PDU. |
coap_string_t* coap_get_uri_path | ( | const struct coap_pdu_t * | request | ) |
Extract uri_path string from request PDU.
request | Request PDU. |
int coap_split_path | ( | const uint8_t * | s, |
size_t | length, | ||
unsigned char * | buf, | ||
size_t * | buflen | ||
) |
Splits the given URI path into segments.
Each segment is preceded by an option pseudo-header with delta-value 0 and the actual length of the respective segment after percent-decoding.
s | The path string to split. |
length | The actual length of s . |
buf | Result buffer for parsed segments. |
buflen | Maximum length of buf . Will be set to the actual number of bytes written into buf on success. |
-1
on error. Definition at line 390 of file uri.c.
int coap_split_query | ( | const uint8_t * | s, |
size_t | length, | ||
unsigned char * | buf, | ||
size_t * | buflen | ||
) |
Splits the given URI query into segments.
Each segment is preceded by an option pseudo-header with delta-value 0 and the actual length of the respective query term.
s | The query string to split. |
length | The actual length of s . |
buf | Result buffer for parsed segments. |
buflen | Maximum length of buf . Will be set to the actual number of bytes written into buf on success. |
-1
on error.Definition at line 402 of file uri.c.
int coap_split_uri | ( | const uint8_t * | str_var, |
size_t | len, | ||
coap_uri_t * | uri | ||
) |
Parses a given string into URI components.
The identified syntactic components are stored in the result parameter uri
. Optional URI components that are not specified will be set to { 0, 0 }, except for the port which is set to COAP_DEFAULT_PORT
. This function returns 0
if parsing succeeded, a value less than zero otherwise.
str_var | The string to split up. |
len | The actual length of str_var |
uri | The coap_uri_t object to store the result. |
0
on success, or < 0 on error. Definition at line 43 of file uri.c.