26#include <uriparser/Uri.h> 
   55    const char *
scheme, 
unsigned int scheme_size,
 
   56    const char *
user_info, 
unsigned int user_info_size,
 
   57    const char *
host, 
unsigned int host_size,
 
   58    const char *
port, 
unsigned int port_size,
 
   59    const char *
path, 
unsigned int path_size,
 
   60    const char *
query, 
unsigned int query_size)
 
   62#define SET_VALUE(param, field, size) \ 
   64         ast_copy_string(p, param, size); \ 
   66         p += size; } } while (0) 
   70        sizeof(*res) + scheme_size + user_info_size + host_size +
 
   71        port_size + path_size + query_size, 
NULL);
 
 
  122    return uri->user_info;
 
 
  148        *(
uri->scheme + strlen(
uri->scheme) - 1) == 
's';
 
 
  154    UriParserStateA 
state;
 
  157    unsigned int scheme_size, user_info_size, host_size;
 
  158    unsigned int port_size, path_size, query_size;
 
  159    const char *path_start, *path_end;
 
  162    if (uriParseUriA(&
state, 
uri) != URI_SUCCESS) {
 
  164        uriFreeUriMembersA(&uria);
 
  168    scheme_size = uria.scheme.first ?
 
  169        uria.scheme.afterLast - uria.scheme.first + 1 : 0;
 
  170    user_info_size = uria.userInfo.first ?
 
  171        uria.userInfo.afterLast - uria.userInfo.first + 1 : 0;
 
  172    host_size = uria.hostText.first ?
 
  173        uria.hostText.afterLast - uria.hostText.first + 1 : 0;
 
  174    port_size = uria.portText.first ?
 
  175        uria.portText.afterLast - uria.portText.first + 1 : 0;
 
  177    path_start = uria.pathHead && uria.pathHead->text.first ?
 
  178        uria.pathHead->text.first : 
NULL;
 
  179    path_end = path_start ? uria.pathTail->text.afterLast : 
NULL;
 
  180    path_size = path_end ? path_end - path_start + 1 : 0;
 
  182    query_size = uria.query.first ?
 
  183        uria.query.afterLast - uria.query.first + 1 : 0;
 
  186                  uria.userInfo.first, user_info_size,
 
  187                  uria.hostText.first, host_size,
 
  188                  uria.portText.first, port_size,
 
  189                  path_start, path_size,
 
  190                  uria.query.first, query_size);
 
  191    uriFreeUriMembersA(&uria);
 
  197#define SET_VALUES(value) \ 
  199    size_##value = p - uri + 1; \ 
  204    unsigned int size_scheme = 0, size_user_info = 0, size_host = 0;
 
  205    unsigned int size_port = 0, size_path = 0, size_query = 0;
 
  207    if ((p = strstr(
uri, 
"://"))) {
 
  209        size_scheme = p - 
uri + 1;
 
  213    if ((p = strchr(
uri, 
'@'))) {
 
  217    if ((p = strchr(
uri, 
':'))) {
 
  221    if ((p = strchr(
uri, 
'/'))) {
 
  229    if ((p = strchr(
uri, 
'?'))) {
 
  231        size_query = strlen(
query) + 1;
 
  238    } 
else if (*(
uri - 1) == 
':') {
 
  240    } 
else if (*(
uri - 1) == 
'/') {
 
 
  254                         const char *
port, 
const char *secure_port)
 
  273        sprintf(with_scheme, 
"%s://%s", 
scheme, 
uri);
 
 
Asterisk main include file. File version handling, generic pbx functions.
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
#define ast_malloc(len)
A wrapper for malloc()
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_alloc(data_size, destructor_fn)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
String manipulation functions.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Stores parsed uri information.
const char * ast_uri_path(const struct ast_uri *uri)
Retrieve the uri path.
const char * ast_uri_scheme(const struct ast_uri *uri)
Retrieve the uri scheme.
struct ast_uri * ast_uri_copy_replace(const struct ast_uri *uri, const char *scheme, const char *user_info, const char *host, const char *port, const char *path, const char *query)
Copy the given uri replacing any value in the new uri with any given.
int ast_uri_is_secure(const struct ast_uri *uri)
Retrieve if the uri is of a secure type.
#define SET_VALUE(param, field, size)
struct ast_uri * ast_uri_parse_http(const char *uri)
Parse the given http uri into a structure.
const char * ast_uri_port(const struct ast_uri *uri)
Retrieve the uri port.
static struct ast_uri * uri_parse_and_default(const char *uri, const char *scheme, const char *port, const char *secure_port)
struct ast_uri * ast_uri_parse_websocket(const char *uri)
Parse the given websocket uri into a structure.
#define SET_VALUES(value)
const char * ast_uri_query(const struct ast_uri *uri)
Retrieve the uri query parameters.
const char * ast_uri_user_info(const struct ast_uri *uri)
Retrieve the uri user information.
const char * ast_uri_host(const struct ast_uri *uri)
Retrieve the uri host.
struct ast_uri * ast_uri_create(const char *scheme, const char *user_info, const char *host, const char *port, const char *path, const char *query)
Create a uri with the given parameters.
char * ast_uri_make_host_with_port(const struct ast_uri *uri)
Retrieve a string of the host and port.
struct ast_uri * ast_uri_parse(const char *uri)
Parse the given uri into a structure.
static struct ast_uri * ast_uri_create_(const char *scheme, unsigned int scheme_size, const char *user_info, unsigned int user_info_size, const char *host, unsigned int host_size, const char *port, unsigned int port_size, const char *path, unsigned int path_size, const char *query, unsigned int query_size)
Construct a uri object with the given values.