uri.h File Reference
`#include "hashkey.h"`
`#include "str.h"`
Include dependency graph for uri.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | coap_uri_t
| Representation of parsed URI. More...

## Functions

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...
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...
int | coap_split_uri (const unsigned char *str_var, size_t len, coap_uri_t *uri)
| Parses a given string into URI components. More...
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...

## Function Documentation

## coap_clone_uri()

coap_uri_t* coap_clone_uri | ( | const coap_uri_t * | uri | ) |

Clones the specified coap_uri_t object.

Thie function allocates sufficient memory to hold the coap_uri_t structure and its contents. The object must be released with coap_free().

Definition at line 433 of file uri.c.

Here is the call graph for this function:

## coap_hash_path()

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`.

This function returns `0` on error or `1` on success.

Parameters

  path | The URI path to generate hash for.
  len | The length of `path`.
  key | The output buffer.

Returns
  `1` if `key` was set, `0` otherwise.

Definition at line 483 of file uri.c.

Here is the call graph for this function:
Here is the caller graph for this function:

## coap_new_uri()

coap_uri_t* coap_new_uri | ( | const unsigned char * | uri,
|  | unsigned int | length
| ) |  |

Creates a new coap_uri_t object from the specified URI.

Returns the new object or NULL on error. The memory allocated by the new coap_uri_t must be released using coap_free().

Parameters

  uri | The URI path to copy.
  length | The length of uri.

Returns
  New URI object or NULL on error.

Definition at line 414 of file uri.c.

Here is the call graph for this function: