Loading...
Searching...
No Matches
URI template processor

URI template processor. More...

Detailed Description

URI template processor.

A parser and processor for URI templates up to level 3 expression types according to RFC 6570.

See also
RFC 6570

Files

file  ut_process.h
 URI template processor definitions.
 

Data Structures

struct  ut_process_var_t
 Name-value-pair of a variable for URI template expansion. More...
 

Functions

int ut_process_expand (const char *ut, size_t ut_len, const ut_process_var_t *vars, size_t vars_len, char *uri, size_t *uri_len)
 Expands a URI template by a given value set.
 
static int ut_process_str_expand (const char *ut, const ut_process_var_t *vars, size_t vars_len, char *uri, size_t *uri_len)
 Expands a URI template by a given value set.
 

Function Documentation

◆ ut_process_expand()

int ut_process_expand ( const char *  ut,
size_t  ut_len,
const ut_process_var_t vars,
size_t  vars_len,
char *  uri,
size_t *  uri_len 
)

Expands a URI template by a given value set.

Precondition
(vars_len == 0) || (vars != NULL)
(uri != NULL) && (uri_len > 0)
Parameters
[in]utA URI template.
[in]ut_lenLength of ut.
[in]varsA set of variable-value pairs.
[in]vars_lenThe length of vars.
[out]uriThe resulting URI.
[in,out]uri_lenThe maximum length for uri on in, the actual length of uri on out.
Returns
The length of uri on success
-EINVAL, when ut is not parseable.
-ENOBUFS, when uri_len is too small to fit the resulting URI. Potentially broken data will be written to uri.

◆ ut_process_str_expand()

static int ut_process_str_expand ( const char *  ut,
const ut_process_var_t vars,
size_t  vars_len,
char *  uri,
size_t *  uri_len 
)
inlinestatic

Expands a URI template by a given value set.

Precondition
(vars_len == 0) || (vars != NULL)
(uri != NULL) && (uri_len > 0)
Parameters
[in]utA \0-terminated URI template.
[in]varsA set of variable-value pairs.
[in]vars_lenThe length of vars.
[out]uriThe resulting URI.
[in,out]uri_lenThe maximum length for uri on in, the actual length of uri on out.
Returns
The length of uri on success
-EINVAL, when ut is not parseable.
-ENOENT, when any ut_process_var_t::name in vars contains an invalid character.
-ENOBUFS, when uri_len is too small to fit the resulting URI. A truncated version of the resulting URI will then be stored in uri.

Definition at line 88 of file ut_process.h.