Liblinphone: linphone::Address Class Reference

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 class | Family { Inet = 0 , Inet6 = 1 , 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.
LINPHONECXX_PUBLIC linphone::Status | setDisplayName (const std::string &displayName)
| Sets the display name.
LINPHONECXX_PUBLIC std::string | getDomain () const
| Returns the domain name.
LINPHONECXX_PUBLIC linphone::Status | setDomain (const std::string &domain)
| Sets the domain.
LINPHONECXX_PUBLIC bool | isSip () const
| returns whether the address is a routable SIP address or not
LINPHONECXX_PUBLIC bool | isValid () const
| Returns if address is valid.
LINPHONECXX_PUBLIC std::string | getMethodParam () const
| Get the value of the method parameter.
LINPHONECXX_PUBLIC void | setMethodParam (const std::string &methodParam)
| Set the value of the method parameter.
LINPHONECXX_PUBLIC std::string | getPassword () const
| Get the password encoded in the address.
LINPHONECXX_PUBLIC void | setPassword (const std::string &password)
| Set the password encoded in the address.
LINPHONECXX_PUBLIC int | getPort () const
| Get port number as an integer value, 0 if not present.
LINPHONECXX_PUBLIC linphone::Status | setPort (int port)
| Sets the port number.
LINPHONECXX_PUBLIC std::string | getScheme () const
| Returns the address scheme, normally "sip".
LINPHONECXX_PUBLIC bool | getSecure () const
| Returns whether the address refers to a secure location (sips) or not.
LINPHONECXX_PUBLIC void | setSecure (bool enabled)
| Make the address refer to a secure location (sips scheme).
LINPHONECXX_PUBLIC linphone::TransportType | getTransport () const
| Get the transport.
LINPHONECXX_PUBLIC linphone::Status | setTransport (linphone::TransportType transport)
| Set a transport.
LINPHONECXX_PUBLIC void | setUriParams (const std::string &params)
| Set the value of the parameters of the URI of the address.
LINPHONECXX_PUBLIC std::string | getUsername () const
| Returns the username.
LINPHONECXX_PUBLIC linphone::Status | setUsername (const std::string &username)
| Sets the username.
LINPHONECXX_PUBLIC std::string | asString () const
| Returns the address as a string.
LINPHONECXX_PUBLIC std::string | asStringUriOnly () const
| Returns the SIP uri only as a string, that is display name is removed.
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::Address > | clone () const
| Clones a Address object.
LINPHONECXX_PUBLIC bool | equal (const std::shared_ptr< const linphone::Address > &address2) const
| Compare two Address taking the tags and headers into account.
LINPHONECXX_PUBLIC std::string | getHeader (const std::string &headerName) const
| Get the header encoded in the address.
LINPHONECXX_PUBLIC std::string | getParam (const std::string &paramName) const
| Get the value of a parameter of the address.
LINPHONECXX_PUBLIC std::string | getUriParam (const std::string &uriParamName) const
| Get the value of a parameter of the URI of the address.
LINPHONECXX_PUBLIC bool | hasParam (const std::string &paramName) const
| Tell whether a parameter is present in the address.
LINPHONECXX_PUBLIC bool | hasUriParam (const std::string &uriParamName) const
| Tell whether a parameter is present in the URI of the address.
LINPHONECXX_PUBLIC void | removeUriParam (const std::string &uriParamName)
| Removes the value of a parameter of the URI of the address.
LINPHONECXX_PUBLIC void | setHeader (const std::string &headerName, const std::string &headerValue)
| Set a header into the address.
LINPHONECXX_PUBLIC void | setParam (const std::string &paramName, const std::string &paramValue)
| Set the value of a parameter of the address.
LINPHONECXX_PUBLIC void | setUriParam (const std::string &uriParamName, const std::string &uriParamValue)
| Set the value of a parameter of the URI of the address.
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.

## 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 class linphone::Address::Family
| strong

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

  address2 | Address 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

  headerName | the 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

  paramName | The 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

  uriParamName | The 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

  paramName | The 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

  uriParamName | The 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

  uriParamName | The name of the parameter.

## ◆ setDisplayName()

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

Sets the display name.

Parameters

  displayName | the display name to set.

## ◆ setDomain()

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

Sets the domain.

Parameters

  domain | the 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

  headerName | the header name.
  headerValue | the header value.

## ◆ setMethodParam()

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

Set the value of the method parameter.

Parameters

  methodParam | the 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

  paramName | The name of the parameter.
  paramValue | The 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

  password | the password to set.

## ◆ setPort()

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

Sets the port number.

Parameters

  port | the 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

  enabled | true if address is requested to be secure.

## ◆ setTransport()

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

Set a transport.

Parameters

  transport | a 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

  uriParamName | The name of the parameter.
  uriParamValue | The 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

  params | The parameters string

## ◆ setUsername()

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

Sets the username.

Parameters

  username | the 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

  address2 | Address 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:

- address.hh