Data Structures | Defines | Enumerations | Functions

sofia-sip/url.h File Reference

URL struct and helper functions. More...

#include <sofia-sip/su_alloc.h>
Include dependency graph for url.h:

Go to the source code of this file.

Data Structures

struct  url_t
 URL structure. More...
union  url_string_t
 Type to present either a parsed URL or string. More...

Defines

#define URL_H
 Defined when <sofia-sip/url.h> has been included.
#define URL_INIT_AS(type)
 Initializer for an url_t structure.
#define URL_PORT(u)
 Return the URL port string, using default port if none present.
#define URL_STRING_P(u)
 Test if a pointer to url_string_t is a string (not a pointer to a url_t structure).
#define URL_IS_STRING(u)
 Test if a pointer to url_string_t is a string (not a pointer to a url_t structure).
#define URL_STRING_MAKE(s)
 Cast a string to a url_string_t.
#define URL_PRINT_FORMAT
 Format string used when printing url with printf().
#define URL_PRINT_ARGS(u)
 Argument list used when printing url with printf().
#define URL_E(buf, end, url)
 Encode a URL: use buf up to end.
#define URL_DUP(buf, end, dst, src)
 Duplicate the url: use buf up to end.

Enumerations

enum  url_type_e {
  url_invalid,
  url_unknown,
  url_any,
  url_sip,
  url_sips,
  url_tel,
  url_fax,
  url_modem,
  url_http,
  url_https,
  url_ftp,
  url_file,
  url_rtsp,
  url_rtspu,
  url_mailto,
  url_im,
  url_pres,
  url_cid,
  url_msrp,
  url_msrps,
  url_wv
}
 

Recognized URL schemes (value of url_t.url_type).

More...
enum  { URL_MAXLEN }

Functions

url_turl_make (su_home_t *h, char const *str)
 Convert a string to a url struct.
url_turl_format (su_home_t *h, char const *fmt,...)
 Convert a string formatting result to a url struct.
char * url_as_string (su_home_t *home, url_t const *url)
 Convert url_t to a string allocated from home.
url_turl_hdup (su_home_t *h, url_t const *src)
 Duplicate the url to memory allocated via home.
int url_sanitize (url_t *u)
 Sanitize a URL.
char const * url_scheme (enum url_type_e type)
 Get URL scheme by type.
int url_cmp (url_t const *a, url_t const *b)
 Compare two URLs lazily.
int url_cmp_all (url_t const *a, url_t const *b)
 Compare two URLs conservatively.
isize_t url_param (char const *params, char const *tag, char value[], isize_t vlen)
 Search for a parameter.
int url_has_param (url_t const *url, char const *name)
 Check for a parameter.
isize_t url_have_param (char const *params, char const *tag)
 Check for a presence of a parameter in string.
int url_param_add (su_home_t *h, url_t *url, char const *param)
 Add a parameter.
int url_strip_transport (url_t *u)
 Strip transport-specific stuff away from URI.
char * url_strip_param_string (char *params, char const *name)
 Strip parameter away from URI.
int url_have_transport (url_t const *u)
 Test if url has any transport-specific stuff.
char * url_query_as_header_string (su_home_t *home, char const *query)
 Convert a URL query to a header string.
int url_reserved_p (char const *s)
 Test if string contains url-reserved characters.
char * url_escape (char *d, char const *s, char const reserved[])
 Escape a string.
isize_t url_esclen (char const *s, char const reserved[])
 Calculate length of string when escaped.
size_t url_unescape_to (char *d, char const *s, size_t n)
 Unescape characters from string.
char * url_unescape (char *d, char const *s)
 Unescape a string.
void url_init (url_t *url, enum url_type_e type)
 Init a url structure as given type.
char const * url_port_default (enum url_type_e url_type)
 Return default port number corresponding to the url type.
char const * url_tport_default (enum url_type_e url_type)
 Return default transport name corresponding to the url type.
char const * url_port (url_t const *u)
 Return the URL port string, using default port if not present.
int url_string_p (url_string_t const *url)
 Test if a pointer to url_string_t is a string (not a pointer to a url_t structure).
int url_is_string (url_string_t const *url)
 Test if a pointer to url_string_t is a string (not a pointer to a url_t structure).
void url_update (struct su_md5_t *md5, url_t const *url)
 Update MD5 sum with URL contents.
void url_digest (void *hash, int hsize, url_t const *, char const *key)
 Calculate a digest from URL contents.
int url_d (url_t *url, char *s)
 Decode a URL.
isize_t url_len (url_t const *url)
 Calculate the encoding length of URL.
issize_t url_e (char buffer[], isize_t n, url_t const *url)
 Encode a URL.
isize_t url_xtra (url_t const *url)
 Calculate the size of srings attached to the url.
issize_t url_dup (char *, isize_t, url_t *dst, url_t const *src)
 Duplicate the url in the provided memory area.

Detailed Description

URL struct and helper functions.

Author:
Pekka Pessi <Pekka.Pessi@nokia-email.address.hidden>
Date:
Created: Thu Jun 8 19:28:55 2000 ppessi

Define Documentation

#define URL_H

Defined when <sofia-sip/url.h> has been included.

#define URL_INIT_AS (   type  ) 

Initializer for an url_t structure.

The macro URL_INIT_AS() is used to initialize a url_t structure with a known url type:

   url_t urls[2] = { URL_INIT_AS(sip), URL_INIT_AS(http) };
#define URL_IS_STRING (   u  ) 

Test if a pointer to url_string_t is a string (not a pointer to a url_t structure).

#define URL_PORT (   u  ) 

Return the URL port string, using default port if none present.

#define URL_STRING_P (   u  ) 

Test if a pointer to url_string_t is a string (not a pointer to a url_t structure).


Enumeration Type Documentation

anonymous enum
Enumerator:
URL_MAXLEN 

Maximum size of a URL.

enum url_type_e

Recognized URL schemes (value of url_t.url_type).

See also:
<http://www.iana.org/assignments/uri-schemes.html>
Enumerator:
url_invalid 

Invalid url.

url_unknown 

Unknown scheme.

url_any 

"*"

url_sip 

"sip:".

See also:
RFC 3261
url_sips 

"sips:".

See also:
RFC 3261
url_tel 

"tel:"

See also:
RFC3966
url_fax 

"fax:".

Note:
Obsolete.
See also:
RFC 2806
url_modem 

"modem:".

Note:
Obsolete.
See also:
RFC 2806
url_http 

"http:".

See also:
RFC 2616, RFC 3986
url_https 

"https:".

See also:
RFC 2618, RFC 3986
url_ftp 

"ftp:".

See also:
RFC 1738
url_file 

"file:"

See also:
RFC 1738
url_rtsp 

"rtsp:"

See also:
RFC 2326
url_rtspu 

"rtspu:"

See also:
RFC 2326
url_mailto 

"mailto:"

See also:
RFC 2368
url_im 

"im:" (simple instant messaging).

See also:
RFC 3860
url_pres 

"pres:" (simple presence).

See also:
RFC 3859
url_cid 

"cid:" (Content-ID).

See also:
RFC 2392
url_msrp 

"msrp:" (message session relay)

url_msrps 

"msrps:" (new in 1.12.2)

url_wv 

"wv:" (Wireless village)


Function Documentation

int url_cmp ( url_t const *  a,
url_t const *  b 
)

Compare two URLs lazily.

int url_cmp_all ( url_t const *  a,
url_t const *  b 
)

Compare two URLs conservatively.

int url_d ( url_t url,
char *  s 
)

Decode a URL.

void url_digest ( void *  hash,
int  hsize,
url_t const *  ,
char const *  key 
)

Calculate a digest from URL contents.

issize_t url_dup ( char *  ,
isize_t  ,
url_t dst,
url_t const *  src 
)

Duplicate the url in the provided memory area.

issize_t url_e ( char  buffer[],
isize_t  n,
url_t const *  url 
)

Encode a URL.

char* url_escape ( char *  d,
char const *  s,
char const   reserved[] 
)

Escape a string.

isize_t url_esclen ( char const *  s,
char const   reserved[] 
)

Calculate length of string when escaped.

url_t* url_format ( su_home_t h,
char const *  fmt,
  ... 
)

Convert a string formatting result to a url struct.

int url_has_param ( url_t const *  url,
char const *  name 
)

Check for a parameter.

isize_t url_have_param ( char const *  params,
char const *  tag 
)

Check for a presence of a parameter in string.

int url_have_transport ( url_t const *  u  ) 

Test if url has any transport-specific stuff.

int url_is_string ( url_string_t const *  url  ) 

Test if a pointer to url_string_t is a string (not a pointer to a url_t structure).

isize_t url_len ( url_t const *  url  ) 

Calculate the encoding length of URL.

url_t* url_make ( su_home_t h,
char const *  str 
)

Convert a string to a url struct.

isize_t url_param ( char const *  params,
char const *  tag,
char  value[],
isize_t  vlen 
)

Search for a parameter.

int url_param_add ( su_home_t h,
url_t url,
char const *  param 
)

Add a parameter.

char const* url_port ( url_t const *  u  ) 

Return the URL port string, using default port if not present.

char const* url_port_default ( enum url_type_e  url_type  ) 

Return default port number corresponding to the url type.

char* url_query_as_header_string ( su_home_t home,
char const *  query 
)

Convert a URL query to a header string.

int url_reserved_p ( char const *  s  ) 

Test if string contains url-reserved characters.

int url_sanitize ( url_t u  ) 

Sanitize a URL.

char const* url_scheme ( enum url_type_e  type  ) 

Get URL scheme by type.

int url_string_p ( url_string_t const *  url  ) 

Test if a pointer to url_string_t is a string (not a pointer to a url_t structure).

char* url_strip_param_string ( char *  params,
char const *  name 
)

Strip parameter away from URI.

int url_strip_transport ( url_t u  ) 

Strip transport-specific stuff away from URI.

void url_update ( struct su_md5_t md5,
url_t const *  url 
)

Update MD5 sum with URL contents.

isize_t url_xtra ( url_t const *  url  ) 

Calculate the size of srings attached to the url.

 All Data Structures Files Functions Variables Enumerations Enumerator Defines

Sofia-SIP 1.12.11 - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.