A minimal, non-destructive URI parser

A minimal, non-destructive parser for URI references. More...

Detailed Description

A minimal, non-destructive parser for URI references.

This module acts on URI references, and thus process both relative references and URIs.

Note that fragment identifiers are not handled by the implementation.

See also
https://tools.ietf.org/html/rfc3986

Handler functions for uri_parser

Author
Cenk Gündoğan cenk..nosp@m.guen.nosp@m.dogan.nosp@m.@haw.nosp@m.-hamb.nosp@m.urg..nosp@m.de

Data Structures

struct  uri_parser_result_t
 container that holds all results More...
 

Functions

bool uri_parser_is_absolute (const char *uri, size_t uri_len)
 Checks whether uri is in absolute form. More...
 
bool uri_parser_is_absolute_string (const char *uri)
 Checks whether uri is in absolute form. More...
 
int uri_parser_process (uri_parser_result_t *result, const char *uri, size_t uri_len)
 Parse a URI reference. More...
 
int uri_parser_process_string (uri_parser_result_t *result, const char *uri)
 Parse a URI reference. More...
 

Function Documentation

◆ uri_parser_is_absolute()

bool uri_parser_is_absolute ( const char *  uri,
size_t  uri_len 
)

Checks whether uri is in absolute form.

Parameters
[in]uriURI reference to check. Must not be NULL
[in]uri_lenLength of uri
Precondition
uri != NULL
Returns
true if uri is a URI
false if uri is a relative reference

◆ uri_parser_is_absolute_string()

bool uri_parser_is_absolute_string ( const char *  uri)

Checks whether uri is in absolute form.

Parameters
[in]uriZero-terminated URI reference to check. Must not be Null
Precondition
uri != NULL
Returns
true if uri is a URI
false if uri is a relative reference

◆ uri_parser_process()

int uri_parser_process ( uri_parser_result_t result,
const char *  uri,
size_t  uri_len 
)

Parse a URI reference.

Parameters
[out]resultpointer to a container that will hold the result
[in]uriURI to parse. Must not be NULL
[in]uri_lenLength of uri
Precondition
uri != NULL
Returns
0 on success
-1 on parsing error

◆ uri_parser_process_string()

int uri_parser_process_string ( uri_parser_result_t result,
const char *  uri 
)

Parse a URI reference.

Parameters
[out]resultpointer to a container that will hold the result
[in]uriZero-terminated URI to parse. Must not be NULL
Precondition
uri != NULL
Returns
0 on success
-1 on parsing error