libtools
Classes | Functions
URL parsing

Just wrapper around http://uriparser.sourceforge.net/. More...

Classes

struct  url
 parserd URL, see url_parse() More...
 

Functions

struct urlurl_parse (const char *s, struct url **u)
 Parse string as URL. More...
 
void url_free (struct url *u)
 Free memory used by URL structure. More...
 
int url2sockaddr (struct url *u, struct sockaddr_storage *sa)
 Set socket address according to URL. More...
 
socklen_t sockaddr_size (const struct sockaddr_storage *sa)
 Return real size of socket address. More...
 

Detailed Description

Just wrapper around http://uriparser.sourceforge.net/.

For more details about syntax of URL please take a look:

Function Documentation

socklen_t sockaddr_size ( const struct sockaddr_storage *  sa)

Return real size of socket address.

Parameters
[in]sapointer to socket address storage
Returns
real size of socket address
int url2sockaddr ( struct url u,
struct sockaddr_storage *  sa 
)

Set socket address according to URL.

Parameters
[in]upointer to URL structure
[out]sapointer to socket address structure
Returns
on success, zero is returned
Return values
-1error occurred

Support next schemes:

  • http Internet sockets
  • unix sockets for local interprocess communication
  • local alias for unix sockets
void url_free ( struct url u)

Free memory used by URL structure.

Parameters
[in]upointer to URL structure
struct url* url_parse ( const char *  s,
struct url **  u 
)

Parse string as URL.

Parameters
[in]sURL string
[out]upointer to URL parsed parts
Returns
pointer to URL structure
Return values
NULLerror occurred

Parsed URL will be extracted to struct url.

For more details about syntax of URL please take a look: