GATE
Loading...
Searching...
No Matches
uris.h File Reference

URI and URL parsing and creation functions. More...

#include "gate/gate_core_api.h"
#include "gate/gatetypes.h"
#include "gate/strings.h"

Functions

GATE_CORE_API gate_result_t gate_uri_init (gate_uri_t *uri)
 Initializes an empty URI object.
 
GATE_CORE_API gate_result_t gate_uri_copy (gate_uri_t *target, gate_uri_t const *src)
 Initializes an URI object by copying data from another URI object.
 
GATE_CORE_API gate_result_t gate_uri_destroy (gate_uri_t *uri)
 Destroys the URI object by releasing all its contained strings.
 
GATE_CORE_API gate_result_t gate_uri_parse (gate_uri_t *uri, gate_string_t const *text)
 Initializes an URI object by parsing a text string.
 
GATE_CORE_API gate_result_t gate_uri_to_string (gate_uri_t const *uri, gate_string_t *text, gate_bool_t absolute_path_only)
 Creates a string from the contents of the given URI object.
 
GATE_CORE_API gate_result_t gate_uri_escape (gate_string_t const *src, gate_string_t *dest)
 Performs an URI string ESCAPE conversion.
 
GATE_CORE_API gate_result_t gate_uri_unescape (gate_string_t const *src, gate_string_t *dest)
 Performs an URI string UNESCAPE conversion.
 
GATE_CORE_API gate_result_t gate_uri_parse_user_info (gate_string_t const *src, gate_string_t *username, gate_string_t *password)
 Parses an URI's userinfo field and creates username and password tokens from it.
 
GATE_CORE_API gate_result_t gate_uri_build_user_info (gate_string_t const *username, gate_string_t const *password, gate_string_t *user_info)
 Generates an URI's userinfo field from username and password parameters.
 
GATE_CORE_API gate_result_t gate_uri_parse_path (gate_string_t const *path, gate_string_t *abs_path, gate_string_t *query_part)
 Parses an absolute path and splits it into path and query component.
 

Detailed Description

URI and URL parsing and creation functions.

Function Documentation

◆ gate_uri_init()

GATE_CORE_API gate_result_t gate_uri_init ( gate_uri_t * uri)

Initializes an empty URI object.

Parameters
[out]uriPointer to URI object to be initialized
Returns
GATE_RESULT_* code

◆ gate_uri_copy()

GATE_CORE_API gate_result_t gate_uri_copy ( gate_uri_t * target,
gate_uri_t const * src )

Initializes an URI object by copying data from another URI object.

Parameters
[out]targetPointer to target URI object to be initialized
[in]srcPointer to source URI object to copy content from
Returns
GATE_RESULT_* code

◆ gate_uri_destroy()

GATE_CORE_API gate_result_t gate_uri_destroy ( gate_uri_t * uri)

Destroys the URI object by releasing all its contained strings.

Parameters
[in]uriPointer to target URI object to be destroyed
Returns
GATE_RESULT_* code

◆ gate_uri_parse()

GATE_CORE_API gate_result_t gate_uri_parse ( gate_uri_t * uri,
gate_string_t const * text )

Initializes an URI object by parsing a text string.

Parameters
[out]uriPointer to target URI object to be initialized
[in]textPointer to source string to be parsed
Returns
GATE_RESULT_* code

◆ gate_uri_to_string()

GATE_CORE_API gate_result_t gate_uri_to_string ( gate_uri_t const * uri,
gate_string_t * text,
gate_bool_t absolute_path_only )

Creates a string from the contents of the given URI object.

Parameters
[in]uriPointer to source URI object
[out]textPointer to target string to be initialized with URI's content
[in]absolute_path_onlyIf TRUE, only the path part is exported - schema, user and host is skipped
Returns
GATE_RESULT_* code

◆ gate_uri_escape()

GATE_CORE_API gate_result_t gate_uri_escape ( gate_string_t const * src,
gate_string_t * dest )

Performs an URI string ESCAPE conversion.

Parameters
[in]srcPointer to plain input string to be escaped
[out]destPointer to target string to be initialized with escaped content
Returns
GATE_RESULT_* code

◆ gate_uri_unescape()

GATE_CORE_API gate_result_t gate_uri_unescape ( gate_string_t const * src,
gate_string_t * dest )

Performs an URI string UNESCAPE conversion.

Parameters
[in]srcPointer to escaped input string to be unescaped
[out]destPointer to target string to be initialized with plain content
Returns
GATE_RESULT_* code

◆ gate_uri_parse_user_info()

GATE_CORE_API gate_result_t gate_uri_parse_user_info ( gate_string_t const * src,
gate_string_t * username,
gate_string_t * password )

Parses an URI's userinfo field and creates username and password tokens from it.

Parameters
[in]srcPointer to encoded userinfo string
[out]usernamePointer to target string to be initialized with username content
[out]passwordPointer to target string to be initialized with password content
Returns
GATE_RESULT_* code

◆ gate_uri_build_user_info()

GATE_CORE_API gate_result_t gate_uri_build_user_info ( gate_string_t const * username,
gate_string_t const * password,
gate_string_t * user_info )

Generates an URI's userinfo field from username and password parameters.

Parameters
[in]usernamePointer to plain username content
[in]passwordPointer to plain password content
[out]user_infoPointer to target string to be initialized with encoded userinfo
Returns
GATE_RESULT_* code

◆ gate_uri_parse_path()

GATE_CORE_API gate_result_t gate_uri_parse_path ( gate_string_t const * path,
gate_string_t * abs_path,
gate_string_t * query_part )

Parses an absolute path and splits it into path and query component.

Parameters
[in]pathPointer to string to be parsed
[out]abs_pathPointer to output absolute path value
[out]query_partPointer to output query value
Returns
GATE_RESULT_* code