|
static unsigned char * | strnchr (unsigned char *s, size_t len, unsigned char c) |
| A length-safe version of strchr(). More...
|
|
int | coap_split_uri (unsigned char *str_var, size_t len, coap_uri_t *uri) |
| Parses a given string into URI components. More...
|
|
void | decode_segment (const unsigned char *seg, size_t length, unsigned char *buf) |
| Decodes percent-encoded characters while copying the string seg of size length to buf . More...
|
|
int | check_segment (const unsigned char *s, size_t length) |
| Runs through the given path (or query) segment and checks if percent-encodings are correct. More...
|
|
int | make_decoded_option (const unsigned char *s, size_t length, unsigned char *buf, size_t buflen) |
| Writes a coap option from given string s to buf . More...
|
|
size_t | coap_split_path_impl (coap_parse_iterator_t *parse_iter, segment_handler_t h, void *data) |
| Splits the given string into segments. More...
|
|
void | write_option (unsigned char *s, size_t len, void *data) |
|
int | coap_split_path (const unsigned char *s, size_t length, unsigned char *buf, size_t *buflen) |
| Splits the given URI path into segments. More...
|
|
int | coap_split_query (const unsigned char *s, size_t length, unsigned char *buf, size_t *buflen) |
| Splits the given URI query into segments. More...
|
|
coap_uri_t * | coap_new_uri (const unsigned char *uri, unsigned int length) |
| Creates a new coap_uri_t object from the specified URI. More...
|
|
coap_uri_t * | coap_clone_uri (const coap_uri_t *uri) |
| Clones the specified coap_uri_t object. More...
|
|
static void | hash_segment (unsigned char *s, size_t len, void *data) |
|
int | coap_hash_path (const unsigned char *path, size_t len, coap_key_t key) |
| Calculates a hash over the given path and stores the result in key . More...
|
|
coap_parse_iterator_t * | coap_parse_iterator_init (unsigned char *s, size_t n, unsigned char separator, unsigned char *delim, size_t dlen, coap_parse_iterator_t *pi) |
| Initializes the given iterator pi . More...
|
|
unsigned char * | coap_parse_next (coap_parse_iterator_t *pi) |
| Updates the iterator pi to point to the next token. More...
|
|
int make_decoded_option |
( |
const unsigned char * |
s, |
|
|
size_t |
length, |
|
|
unsigned char * |
buf, |
|
|
size_t |
buflen |
|
) |
| |
Writes a coap option from given string s
to buf
.
s
should point to a (percent-encoded) path or query segment of a coap_uri_t object. The created option will have type 0
, and the length parameter will be set according to the size of the decoded string. On success, this function returns the option's size, or a value less than zero on error. This function must be called from coap_split_path_impl() only.
- Parameters
-
s | The string to decode. |
length | The size of the percent-encoded string s . |
buf | The buffer to store the new coap option. |
buflen | The maximum size of buf . |
- Returns
- The option's size, or
-1
on error.
- Bug:
- This function does not split segments that are bigger than 270 bytes.
Definition at line 258 of file uri.c.