Liblinphone  5.3.0
Public Types | Public Member Functions | List of all members
linphone::Address Class Reference

Object that represents a parsed SIP address. More...

#include <address.hh>

Inheritance diagram for linphone::Address:

Public Types

enum  Family {
  Family::Inet = 0,
  Family::Inet6 = 1,
  Family::Unspec = 2
}
 Enum describing Ip family. More...
 

Public Member Functions

LINPHONECXX_PUBLIC Address (void *ptr, bool takeRef=true)
 
LINPHONECXX_PUBLIC _LinphoneAddress * cPtr ()
 
LINPHONECXX_PUBLIC std::string getDisplayName () const
 Returns the display name. More...
 
LINPHONECXX_PUBLIC linphone::Status setDisplayName (const std::string &displayName)
 Sets the display name. More...
 
LINPHONECXX_PUBLIC std::string getDomain () const
 Returns the domain name. More...
 
LINPHONECXX_PUBLIC linphone::Status setDomain (const std::string &domain)
 Sets the domain. More...
 
LINPHONECXX_PUBLIC bool isSip () const
 returns whether the address is a routable SIP address or not More...
 
LINPHONECXX_PUBLIC bool isValid () const
 Returns if address is valid. More...
 
LINPHONECXX_PUBLIC std::string getMethodParam () const
 Get the value of the method parameter. More...
 
LINPHONECXX_PUBLIC void setMethodParam (const std::string &methodParam)
 Set the value of the method parameter. More...
 
LINPHONECXX_PUBLIC std::string getPassword () const
 Get the password encoded in the address. More...
 
LINPHONECXX_PUBLIC void setPassword (const std::string &password)
 Set the password encoded in the address. More...
 
LINPHONECXX_PUBLIC int getPort () const
 Get port number as an integer value, 0 if not present. More...
 
LINPHONECXX_PUBLIC linphone::Status setPort (int port)
 Sets the port number. More...
 
LINPHONECXX_PUBLIC std::string getScheme () const
 Returns the address scheme, normally "sip". More...
 
LINPHONECXX_PUBLIC bool getSecure () const
 Returns whether the address refers to a secure location (sips) or not. More...
 
LINPHONECXX_PUBLIC void setSecure (bool enabled)
 Make the address refer to a secure location (sips scheme) More...
 
LINPHONECXX_PUBLIC linphone::TransportType getTransport () const
 Get the transport. More...
 
LINPHONECXX_PUBLIC linphone::Status setTransport (linphone::TransportType transport)
 Set a transport. More...
 
LINPHONECXX_PUBLIC void setUriParams (const std::string &params)
 Set the value of the parameters of the URI of the address. More...
 
LINPHONECXX_PUBLIC std::string getUsername () const
 Returns the username. More...
 
LINPHONECXX_PUBLIC linphone::Status setUsername (const std::string &username)
 Sets the username. More...
 
LINPHONECXX_PUBLIC std::string asString () const
 Returns the address as a string. More...
 
LINPHONECXX_PUBLIC std::string asStringUriOnly () const
 Returns the SIP uri only as a string, that is display name is removed. More...
 
LINPHONECXX_PUBLIC void clean ()
 Removes address's tags and uri headers so that it is displayable to the user.
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Addressclone () const
 Clones a Address object. More...
 
LINPHONECXX_PUBLIC bool equal (const std::shared_ptr< const linphone::Address > &address2) const
 Compare two Address taking the tags and headers into account. More...
 
LINPHONECXX_PUBLIC std::string getHeader (const std::string &headerName) const
 Get the header encoded in the address. More...
 
LINPHONECXX_PUBLIC std::string getParam (const std::string &paramName) const
 Get the value of a parameter of the address. More...
 
LINPHONECXX_PUBLIC std::string getUriParam (const std::string &uriParamName) const
 Get the value of a parameter of the URI of the address. More...
 
LINPHONECXX_PUBLIC bool hasParam (const std::string &paramName) const
 Tell whether a parameter is present in the address. More...
 
LINPHONECXX_PUBLIC bool hasUriParam (const std::string &uriParamName) const
 Tell whether a parameter is present in the URI of the address. More...
 
LINPHONECXX_PUBLIC void removeUriParam (const std::string &uriParamName)
 Removes the value of a parameter of the URI of the address. More...
 
LINPHONECXX_PUBLIC void setHeader (const std::string &headerName, const std::string &headerValue)
 Set a header into the address. More...
 
LINPHONECXX_PUBLIC void setParam (const std::string &paramName, const std::string &paramValue)
 Set the value of a parameter of the address. More...
 
LINPHONECXX_PUBLIC void setUriParam (const std::string &uriParamName, const std::string &uriParamValue)
 Set the value of a parameter of the URI of the address. More...
 
LINPHONECXX_PUBLIC bool weakEqual (const std::shared_ptr< const linphone::Address > &address2) const
 Compare two Address ignoring tags and headers, basically just domain, username, and port. More...
 

Detailed Description

Object that represents a parsed SIP address.

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>'. You can create an address using Factory::createAddress() or Core::interpretUrl() and both will return a nullptr object if it doesn't match the grammar defined by the standard. This object is used in almost every other major objects to identity people (including yourself) & servers. The Address has methods to extract and manipulate all parts of the address.

Member Enumeration Documentation

◆ Family

Enum describing Ip family.

Enumerator
Inet 

IpV4.

Inet6 

IpV6.

Unspec 

Unknown.

Member Function Documentation

◆ asString()

LINPHONECXX_PUBLIC std::string linphone::Address::asString ( ) const

Returns the address as a string.

The returned char * must be freed by the application. Use ms_free().

Returns
a string representation of the address.

◆ asStringUriOnly()

LINPHONECXX_PUBLIC std::string linphone::Address::asStringUriOnly ( ) const

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().

Returns
a string representation of the address.

◆ clone()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Address> linphone::Address::clone ( ) const

Clones a Address object.

Returns
a new Address object.

◆ equal()

LINPHONECXX_PUBLIC bool linphone::Address::equal ( const std::shared_ptr< const linphone::Address > &  address2) const

Compare two Address taking the tags and headers into account.

Parameters
address2Address object.
Returns
Boolean value telling if the Address objects are equal.
See also
weakEqual()

◆ getDisplayName()

LINPHONECXX_PUBLIC std::string linphone::Address::getDisplayName ( ) const

Returns the display name.

Returns
the display name if any, nullptr otherwise.

◆ getDomain()

LINPHONECXX_PUBLIC std::string linphone::Address::getDomain ( ) const

Returns the domain name.

Returns
the domain name if any, nullptr otherwise.

◆ getHeader()

LINPHONECXX_PUBLIC std::string linphone::Address::getHeader ( const std::string &  headerName) const

Get the header encoded in the address.

Parameters
headerNamethe header name.
Returns
the header value or nullptr if it doesn't exists.

◆ getMethodParam()

LINPHONECXX_PUBLIC std::string linphone::Address::getMethodParam ( ) const

Get the value of the method parameter.

Returns
the value of the parameter or nullptr.

◆ getParam()

LINPHONECXX_PUBLIC std::string linphone::Address::getParam ( const std::string &  paramName) const

Get the value of a parameter of the address.

Parameters
paramNameThe name of the parameter.
Returns
The value of the parameter or nullptr if it doesn't exists.

◆ getPassword()

LINPHONECXX_PUBLIC std::string linphone::Address::getPassword ( ) const

Get the password encoded in the address.

It is used for basic authentication (not recommended).

Returns
the password if any, nullptr otherwise.

◆ getPort()

LINPHONECXX_PUBLIC int linphone::Address::getPort ( ) const

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

Returns
the port set in the address or 0 if not present.

◆ getScheme()

LINPHONECXX_PUBLIC std::string linphone::Address::getScheme ( ) const

Returns the address scheme, normally "sip".

Returns
the scheme if any, nullptr otherwise.

◆ getSecure()

LINPHONECXX_PUBLIC bool linphone::Address::getSecure ( ) const

Returns whether the address refers to a secure location (sips) or not.

Returns
true if address refers to a secure location, false otherwise

◆ getTransport()

LINPHONECXX_PUBLIC linphone::TransportType linphone::Address::getTransport ( ) const

Get the transport.

Returns
a TransportType, default value if not set is UDP.

◆ getUriParam()

LINPHONECXX_PUBLIC std::string linphone::Address::getUriParam ( const std::string &  uriParamName) const

Get the value of a parameter of the URI of the address.

Parameters
uriParamNameThe name of the parameter.
Returns
The value of the parameter or nullptr if it doesn't exists.

◆ getUsername()

LINPHONECXX_PUBLIC std::string linphone::Address::getUsername ( ) const

Returns the username.

Returns
the username name if any, nullptr otherwise.

◆ hasParam()

LINPHONECXX_PUBLIC bool linphone::Address::hasParam ( const std::string &  paramName) const

Tell whether a parameter is present in the address.

Parameters
paramNameThe name of the parameter.
Returns
A boolean value telling whether the parameter is present in the address

◆ hasUriParam()

LINPHONECXX_PUBLIC bool linphone::Address::hasUriParam ( const std::string &  uriParamName) const

Tell whether a parameter is present in the URI of the address.

Parameters
uriParamNameThe name of the parameter.
Returns
A boolean value telling whether the parameter is present in the URI of the address

◆ isSip()

LINPHONECXX_PUBLIC bool linphone::Address::isSip ( ) const

returns whether the address is a routable SIP address or not

Returns
true if it is a routable SIP address, false otherwise

◆ isValid()

LINPHONECXX_PUBLIC bool linphone::Address::isValid ( ) const

Returns if address is valid.

Returns
the scheme if any, nullptr otherwise.

◆ removeUriParam()

LINPHONECXX_PUBLIC void linphone::Address::removeUriParam ( const std::string &  uriParamName)

Removes the value of a parameter of the URI of the address.

Parameters
uriParamNameThe name of the parameter.

◆ setDisplayName()

LINPHONECXX_PUBLIC linphone::Status linphone::Address::setDisplayName ( const std::string &  displayName)

Sets the display name.

Parameters
displayNamethe display name to set.

◆ setDomain()

LINPHONECXX_PUBLIC linphone::Status linphone::Address::setDomain ( const std::string &  domain)

Sets the domain.

Parameters
domainthe domain to set.

◆ setHeader()

LINPHONECXX_PUBLIC void linphone::Address::setHeader ( const std::string &  headerName,
const std::string &  headerValue 
)

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
headerNamethe header name.
headerValuethe header value.

◆ setMethodParam()

LINPHONECXX_PUBLIC void linphone::Address::setMethodParam ( const std::string &  methodParam)

Set the value of the method parameter.

Parameters
methodParamthe value to set to the method parameter.

◆ setParam()

LINPHONECXX_PUBLIC void linphone::Address::setParam ( const std::string &  paramName,
const std::string &  paramValue 
)

Set the value of a parameter of the address.

Parameters
paramNameThe name of the parameter.
paramValueThe new value of the parameter.

◆ setPassword()

LINPHONECXX_PUBLIC void linphone::Address::setPassword ( const std::string &  password)

Set the password encoded in the address.

It is used for basic authentication (not recommended).

Parameters
passwordthe password to set.

◆ setPort()

LINPHONECXX_PUBLIC linphone::Status linphone::Address::setPort ( int  port)

Sets the port number.

Parameters
portthe port to set in the address

◆ setSecure()

LINPHONECXX_PUBLIC void linphone::Address::setSecure ( bool  enabled)

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

Parameters
enabledtrue if address is requested to be secure.

◆ setTransport()

LINPHONECXX_PUBLIC linphone::Status linphone::Address::setTransport ( linphone::TransportType  transport)

Set a transport.

Parameters
transporta TransportType

◆ setUriParam()

LINPHONECXX_PUBLIC void linphone::Address::setUriParam ( const std::string &  uriParamName,
const std::string &  uriParamValue 
)

Set the value of a parameter of the URI of the address.

Parameters
uriParamNameThe name of the parameter.
uriParamValueThe new value of the parameter.

◆ setUriParams()

LINPHONECXX_PUBLIC void linphone::Address::setUriParams ( const std::string &  params)

Set the value of the parameters of the URI of the address.

Parameters
paramsThe parameters string

◆ setUsername()

LINPHONECXX_PUBLIC linphone::Status linphone::Address::setUsername ( const std::string &  username)

Sets the username.

Parameters
usernamethe username to set.

◆ weakEqual()

LINPHONECXX_PUBLIC bool linphone::Address::weakEqual ( const std::shared_ptr< const linphone::Address > &  address2) const

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

Parameters
address2Address object.
Returns
Boolean value telling if the Address objects are equal.
See also
equal()

The documentation for this class was generated from the following file: