Liblinphone  3.11.1
Typedefs | Enumerations | Functions
SIP address parser API.

Typedefs

typedef struct SalAddress LinphoneAddress
 
typedef enum _LinphoneTransportType LinphoneTransportType
 

Enumerations

enum  _LinphoneTransportType {
  LinphoneTransportUdp,
  LinphoneTransportTcp,
  LinphoneTransportTls,
  LinphoneTransportDtls
}
 

Functions

LinphoneAddresslinphone_address_new (const char *addr)
 
LinphoneAddresslinphone_address_clone (const LinphoneAddress *addr)
 
LinphoneAddresslinphone_address_ref (LinphoneAddress *addr)
 
void linphone_address_unref (LinphoneAddress *addr)
 
const char * linphone_address_get_scheme (const LinphoneAddress *u)
 
const char * linphone_address_get_display_name (const LinphoneAddress *u)
 
const char * linphone_address_get_username (const LinphoneAddress *u)
 
const char * linphone_address_get_domain (const LinphoneAddress *u)
 
int linphone_address_get_port (const LinphoneAddress *u)
 
int linphone_address_set_display_name (LinphoneAddress *u, const char *display_name)
 
int linphone_address_set_username (LinphoneAddress *uri, const char *username)
 
int linphone_address_set_domain (LinphoneAddress *uri, const char *host)
 
int linphone_address_set_port (LinphoneAddress *uri, int port)
 
int linphone_address_set_transport (LinphoneAddress *uri, LinphoneTransportType type)
 
void linphone_address_clean (LinphoneAddress *uri)
 
LINPHONE_DEPRECATED bool_t linphone_address_is_secure (const LinphoneAddress *addr)
 
bool_t linphone_address_get_secure (const LinphoneAddress *addr)
 
void linphone_address_set_secure (LinphoneAddress *addr, bool_t enabled)
 
bool_t linphone_address_is_sip (const LinphoneAddress *uri)
 
LinphoneTransportType linphone_address_get_transport (const LinphoneAddress *uri)
 
const char * linphone_address_get_method_param (const LinphoneAddress *addr)
 
void linphone_address_set_method_param (LinphoneAddress *addr, const char *method)
 
char * linphone_address_as_string (const LinphoneAddress *u)
 
char * linphone_address_as_string_uri_only (const LinphoneAddress *u)
 
bool_t linphone_address_weak_equal (const LinphoneAddress *a1, const LinphoneAddress *a2)
 
bool_t linphone_address_equal (const LinphoneAddress *a1, const LinphoneAddress *a2)
 
void linphone_address_set_password (LinphoneAddress *addr, const char *passwd)
 
const char * linphone_address_get_password (const LinphoneAddress *addr)
 
void linphone_address_set_header (LinphoneAddress *addr, const char *header_name, const char *header_value)
 
bool_t linphone_address_has_param (const LinphoneAddress *addr, const char *name)
 
const char * linphone_address_get_param (const LinphoneAddress *addr, const char *name)
 
void linphone_address_set_param (LinphoneAddress *addr, const char *name, const char *value)
 
void linphone_address_set_params (LinphoneAddress *addr, const char *params)
 
void linphone_address_set_uri_param (LinphoneAddress *addr, const char *name, const char *value)
 
void linphone_address_set_uri_params (LinphoneAddress *addr, const char *params)
 
bool_t linphone_address_has_uri_param (const LinphoneAddress *addr, const char *name)
 
const char * linphone_address_get_uri_param (const LinphoneAddress *addr, const char *name)
 
LINPHONE_DEPRECATED void linphone_address_destroy (LinphoneAddress *u)
 
LinphoneAddresslinphone_core_create_address (LinphoneCore *lc, const char *address)
 

Detailed Description

This api is useful for manipulating SIP addresses ('from' or 'to' headers).

Typedef Documentation

§ LinphoneAddress

typedef struct SalAddress LinphoneAddress

Object that represents a SIP address.

The LinphoneAddress is an opaque object to represents SIP addresses, ie the content of SIP's 'from' and 'to' headers. A SIP address is made of display name, username, domain name, port, and various uri headers (such as tags). It looks like 'Alice <sip:alice.nosp@m.@exa.nosp@m.mple..nosp@m.net>'. The LinphoneAddress has methods to extract and manipulate all parts of the address. When some part of the address (for example the username) is empty, the accessor methods return NULL.

§ LinphoneTransportType

Enum describing transport type for LinphoneAddress.

Enumeration Type Documentation

§ _LinphoneTransportType

Enum describing transport type for LinphoneAddress.

Function Documentation

§ linphone_address_as_string()

char* linphone_address_as_string ( const LinphoneAddress u)

Returns the address as a string. The returned char * must be freed by the application. Use ms_free().

§ linphone_address_as_string_uri_only()

char* linphone_address_as_string_uri_only ( const LinphoneAddress u)

Returns the SIP uri only as a string, that is display name is removed. The returned char * must be freed by the application. Use ms_free().

§ linphone_address_clean()

void linphone_address_clean ( LinphoneAddress uri)

Removes address's tags and uri headers so that it is displayable to the user.

§ linphone_address_clone()

LinphoneAddress* linphone_address_clone ( const LinphoneAddress addr)

Clones a LinphoneAddress object.

§ linphone_address_destroy()

LINPHONE_DEPRECATED void linphone_address_destroy ( LinphoneAddress u)

Destroys a LinphoneAddress object (actually calls linphone_address_unref()).

Deprecated:
Use linphone_address_unref() instead

§ linphone_address_equal()

bool_t linphone_address_equal ( const LinphoneAddress a1,
const LinphoneAddress a2 
)

Compare two LinphoneAddress taking the tags and headers into account.

Parameters
[in]a1LinphoneAddress object
[in]a2LinphoneAddress object
Returns
Boolean value telling if the LinphoneAddress objects are equal.
See also
linphone_address_weak_equal()

§ linphone_address_get_display_name()

const char* linphone_address_get_display_name ( const LinphoneAddress u)

Returns the display name.

§ linphone_address_get_domain()

const char* linphone_address_get_domain ( const LinphoneAddress u)

Returns the domain name.

§ linphone_address_get_method_param()

const char* linphone_address_get_method_param ( const LinphoneAddress addr)

Get the value of the method parameter

§ linphone_address_get_password()

const char* linphone_address_get_password ( const LinphoneAddress addr)

Get the password encoded in the address. It is used for basic authentication (not recommended).

Parameters
addrthe address
Returns
the password, if any, NULL otherwise.

§ linphone_address_get_port()

int linphone_address_get_port ( const LinphoneAddress u)

Get port number as an integer value, 0 if not present.

§ linphone_address_get_scheme()

const char* linphone_address_get_scheme ( const LinphoneAddress u)

Returns the address scheme, normally "sip".

§ linphone_address_get_secure()

bool_t linphone_address_get_secure ( const LinphoneAddress addr)

Returns true if address refers to a secure location (sips)

§ linphone_address_get_transport()

LinphoneTransportType linphone_address_get_transport ( const LinphoneAddress uri)

Get the transport.

§ linphone_address_get_username()

const char* linphone_address_get_username ( const LinphoneAddress u)

Returns the username.

§ linphone_address_is_secure()

LINPHONE_DEPRECATED bool_t linphone_address_is_secure ( const LinphoneAddress addr)

Returns true if address refers to a secure location (sips)

Deprecated:
use linphone_address_get_secure()

§ linphone_address_is_sip()

bool_t linphone_address_is_sip ( const LinphoneAddress uri)

returns true if address is a routable sip address

§ linphone_address_new()

LinphoneAddress* linphone_address_new ( const char *  addr)

Constructs a LinphoneAddress object by parsing the user supplied address, given as a string.

§ linphone_address_ref()

LinphoneAddress* linphone_address_ref ( LinphoneAddress addr)

Increment reference count of LinphoneAddress object.

§ linphone_address_set_display_name()

int linphone_address_set_display_name ( LinphoneAddress u,
const char *  display_name 
)

Sets the display name.

§ linphone_address_set_domain()

int linphone_address_set_domain ( LinphoneAddress uri,
const char *  host 
)

Sets the domain.

§ linphone_address_set_header()

void linphone_address_set_header ( LinphoneAddress addr,
const char *  header_name,
const char *  header_value 
)

Set a header into the address. Headers appear in the URI with '?', such as <sip:test@.nosp@m.linp.nosp@m.hone..nosp@m.org?SomeHeader=SomeValue>.

Parameters
addrthe address
header_namethe header name
header_valuethe header value

§ linphone_address_set_method_param()

void linphone_address_set_method_param ( LinphoneAddress addr,
const char *  method 
)

Set the value of the method parameter

§ linphone_address_set_password()

void linphone_address_set_password ( LinphoneAddress addr,
const char *  passwd 
)

Set the password encoded in the address. It is used for basic authentication (not recommended).

Parameters
addrthe LinphoneAddress
passwdthe password to set.

§ linphone_address_set_port()

int linphone_address_set_port ( LinphoneAddress uri,
int  port 
)

Sets the port number.

§ linphone_address_set_secure()

void linphone_address_set_secure ( LinphoneAddress addr,
bool_t  enabled 
)

Make the address refer to a secure location (sips scheme)

Parameters
[in]addrA LinphoneAddress object
[in]enabledTRUE if address is requested to be secure.

§ linphone_address_set_transport()

int linphone_address_set_transport ( LinphoneAddress uri,
LinphoneTransportType  type 
)

Set a transport.

§ linphone_address_set_username()

int linphone_address_set_username ( LinphoneAddress uri,
const char *  username 
)

Sets the username.

§ linphone_address_unref()

void linphone_address_unref ( LinphoneAddress addr)

Decrement reference count of LinphoneAddress object. When dropped to zero, memory is freed.

§ linphone_address_weak_equal()

bool_t linphone_address_weak_equal ( const LinphoneAddress a1,
const LinphoneAddress a2 
)

Compare two LinphoneAddress ignoring tags and headers, basically just domain, username, and port.

Parameters
[in]a1LinphoneAddress object
[in]a2LinphoneAddress object
Returns
Boolean value telling if the LinphoneAddress objects are equal.
See also
linphone_address_equal()

§ linphone_core_create_address()

LinphoneAddress* linphone_core_create_address ( LinphoneCore lc,
const char *  address 
)

Create a LinphoneAddress object by parsing the user supplied address, given as a string.

Parameters
[in]lcLinphoneCore object
[in]addressString containing the user supplied address
Returns
The create LinphoneAddress object