Liblinphone: linphone::Tunnel Class Reference

Liblinphone 5.2.0

Public Types | Public Member Functions | List of all members
linphone::Tunnel Class Reference

Linphone tunnel object. More...

`#include <tunnel.hh>`

Inheritance diagram for linphone::Tunnel:

## Public Types
enum class | Mode { Disable = 0 , Enable = 1 , Auto = 2 }
| Enum describing the tunnel modes. More...

## Public Member Functions
LINPHONECXX_PUBLIC | Tunnel (void *ptr, bool takeRef=true)
LINPHONECXX_PUBLIC _LinphoneTunnel * | cPtr ()
LINPHONECXX_PUBLIC bool | getActivated () const
| Returns whether the tunnel is activated.
LINPHONECXX_PUBLIC std::string | getDomain ()
| Get the domain.
LINPHONECXX_PUBLIC void | setDomain (const std::string &domain)
| Set the domain.
LINPHONECXX_PUBLIC bool | dualModeEnabled () const
| Get the dual tunnel client mode.
LINPHONECXX_PUBLIC void | enableDualMode (bool dualModeEnabled)
| Sets whether or not to use the dual tunnel client mode.
LINPHONECXX_PUBLIC Mode | getMode () const
| Get the tunnel mode.
LINPHONECXX_PUBLIC void | setMode (Mode mode)
| Set the tunnel mode.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::TunnelConfig > > | getServers () const
| Get added servers.
LINPHONECXX_PUBLIC bool | sipEnabled () const
| Check whether tunnel is set to transport SIP packets.
LINPHONECXX_PUBLIC void | enableSip (bool enable)
| Set whether SIP packets must be directly sent to a UA or pass through the tunnel.
LINPHONECXX_PUBLIC std::string | getUsername ()
| Get the username.
LINPHONECXX_PUBLIC void | setUsername (const std::string &username)
| Set the username.
LINPHONECXX_PUBLIC void | addServer (const std::shared_ptr< linphone::TunnelConfig > &tunnelConfig)
| Add a tunnel server configuration.
LINPHONECXX_PUBLIC void | cleanServers ()
| Remove all tunnel server addresses previously entered with addServer()
LINPHONECXX_PUBLIC bool | connected () const
| Check whether the tunnel is connected.
LINPHONECXX_PUBLIC void | reconnect ()
| Force reconnection to the tunnel server.
LINPHONECXX_PUBLIC void | removeServer (const std::shared_ptr< linphone::TunnelConfig > &tunnelConfig)
| Remove a tunnel server configuration.
LINPHONECXX_PUBLIC void | setHttpProxy (const std::string &host, int port, const std::string &username, const std::string &passwd)
| Set an optional http proxy to go through when connecting to tunnel server.
LINPHONECXX_PUBLIC void | setHttpProxyAuthInfo (const std::string &username, const std::string &passwd)
| Set authentication info for the http proxy.

## Detailed Description

Linphone tunnel object.

## Member Enumeration Documentation

## ◆ Mode

enum class linphone::Tunnel::Mode
| strong

Enum describing the tunnel modes.

Enumerator
Disable | The tunnel is disabled.
Enable | The tunnel is enabled.
Auto | The tunnel is enabled automatically if it is required.

## Member Function Documentation

## ◆ addServer()

LINPHONECXX_PUBLIC void linphone::Tunnel::addServer | ( | const std::shared_ptr< linphone::TunnelConfig > & | tunnelConfig | ) |

Add a tunnel server configuration.

Parameters

  tunnelConfig | TunnelConfig object

## ◆ cleanServers()

LINPHONECXX_PUBLIC void linphone::Tunnel::cleanServers | ( |  | ) |

Remove all tunnel server addresses previously entered with addServer()

## ◆ connected()

LINPHONECXX_PUBLIC bool linphone::Tunnel::connected | ( |  | ) | const

Check whether the tunnel is connected.

Returns
  A boolean value telling if the tunnel is connected

## ◆ dualModeEnabled()

LINPHONECXX_PUBLIC bool linphone::Tunnel::dualModeEnabled | ( |  | ) | const

Get the dual tunnel client mode.

Returns
  true if dual tunnel client mode is enabled, false otherwise

## ◆ enableDualMode()

LINPHONECXX_PUBLIC void linphone::Tunnel::enableDualMode | ( | bool | dualModeEnabled | ) |

Sets whether or not to use the dual tunnel client mode.

By default this feature is disabled. After enabling it, add a server with 2 hosts and 2 ports for the feature to work.

Parameters

  dualModeEnabled | true to enable it, false to disable it

## ◆ enableSip()

LINPHONECXX_PUBLIC void linphone::Tunnel::enableSip | ( | bool | enable | ) |

Set whether SIP packets must be directly sent to a UA or pass through the tunnel.

Parameters

  enable | If true, SIP packets shall pass through the tunnel

## ◆ getActivated()

LINPHONECXX_PUBLIC bool linphone::Tunnel::getActivated | ( |  | ) | const

Returns whether the tunnel is activated.

If mode is set to auto, this gives indication whether the automatic detection determined that tunnel was necessary or not.

Returns
  true if tunnel is in use, false otherwise.

## ◆ getDomain()

LINPHONECXX_PUBLIC std::string linphone::Tunnel::getDomain | ( |  | ) |

Get the domain.

Returns
  The domain.

## ◆ getMode()

LINPHONECXX_PUBLIC Mode linphone::Tunnel::getMode | ( |  | ) | const

Get the tunnel mode.

Returns
  The current Mode

## ◆ getServers()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::TunnelConfig > > linphone::Tunnel::getServers | ( |  | ) | const

Get added servers.

Returns
  The list of servers.

## ◆ getUsername()

LINPHONECXX_PUBLIC std::string linphone::Tunnel::getUsername | ( |  | ) |

Get the username.

Returns
  The username.

## ◆ reconnect()

LINPHONECXX_PUBLIC void linphone::Tunnel::reconnect | ( |  | ) |

Force reconnection to the tunnel server.

This method is useful when the device switches from wifi to Edge/3G or vice versa. In most cases the tunnel client socket won't be notified promptly that its connection is now zombie, so it is recommended to call this method that will cause the lost connection to be closed and new connection to be issued.

## ◆ removeServer()

LINPHONECXX_PUBLIC void linphone::Tunnel::removeServer | ( | const std::shared_ptr< linphone::TunnelConfig > & | tunnelConfig | ) |

Remove a tunnel server configuration.

Parameters

  tunnelConfig | TunnelConfig object

## ◆ setDomain()

LINPHONECXX_PUBLIC void linphone::Tunnel::setDomain | ( | const std::string & | domain | ) |

Set the domain.

Required for tunnel TLS client authentification. Certificate Altname or CName should be sip:<tunnel_username><tunnel_domain>

Parameters

  domain | The domain.

## ◆ setHttpProxy()

LINPHONECXX_PUBLIC void linphone::Tunnel::setHttpProxy | ( | const std::string & | host,
|  | int | port,
|  | const std::string & | username,
|  | const std::string & | passwd
| ) |  |

Set an optional http proxy to go through when connecting to tunnel server.

Parameters

  passwd | Optional http proxy password. Use nullptr if not needed.

## ◆ setHttpProxyAuthInfo()

LINPHONECXX_PUBLIC void linphone::Tunnel::setHttpProxyAuthInfo | ( | const std::string & | username,
|  | const std::string & | passwd
| ) |  |

Set authentication info for the http proxy.

Parameters

  passwd | Password

## ◆ setMode()

LINPHONECXX_PUBLIC void linphone::Tunnel::setMode | ( | Mode | mode | ) |

Set the tunnel mode.

The tunnel mode can be 'enable', 'disable' or 'auto' If the mode is set to 'auto', the tunnel manager will try to established an RTP session with the tunnel server on the UdpMirrorPort. If the connection fail, the tunnel is automatically activated whereas the tunnel is automatically disabled if the connection succeed.

Parameters

  mode | The desired Mode

## ◆ setUsername()

LINPHONECXX_PUBLIC void linphone::Tunnel::setUsername | ( | const std::string & | username | ) |

Set the username.

Required for tunnel TLS client authentification. Certificate Altname or CName should be sip:<tunnel_username><tunnel_domain>

Parameters

  username | The username.

## ◆ sipEnabled()

LINPHONECXX_PUBLIC bool linphone::Tunnel::sipEnabled | ( |  | ) | const

Check whether tunnel is set to transport SIP packets.

Returns
  A boolean value telling whether SIP packets shall pass through the tunnel

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

- tunnel.hh