linphone::NatPolicy Class Reference

Policy to use to pass through NATs/firewalls. More...

`#include <nat_policy.hh>`

Inheritance diagram for linphone::NatPolicy:

## Public Member Functions

LINPHONECXX_PUBLIC | NatPolicy (void *ptr, bool takeRef=true)
LINPHONECXX_PUBLIC _LinphoneNatPolicy * | cPtr ()
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > | getCore () const
| Returns the Core object managing this nat policy, if any.
LINPHONECXX_PUBLIC bool | iceEnabled () const
| Tell whether ICE is enabled.
LINPHONECXX_PUBLIC void | enableIce (bool enable)
| Enable ICE.
LINPHONECXX_PUBLIC std::string | getNatV4Address () const
| Get the mandatory v4 IP address to use with this NAT policy as server-reflexive candidate for ICE.
LINPHONECXX_PUBLIC void | setNatV4Address (const std::string &v4Address)
| Set the mandatory v4 IP address to use with this NAT policy as server-reflexive candidate for ICE.
LINPHONECXX_PUBLIC std::string | getNatV6Address () const
| Get the mandatory v6 IP address to use with this NAT policy as server-reflexive candidate for ICE.
LINPHONECXX_PUBLIC void | setNatV6Address (const std::string &v4Address)
| Set the mandatory v6 IP address to use with this NAT policy as server-reflexive candidate for ICE.
LINPHONECXX_PUBLIC bool | stunEnabled () const
| Tell whether STUN is enabled.
LINPHONECXX_PUBLIC void | enableStun (bool enable)
| Enable STUN.
LINPHONECXX_PUBLIC std::string | getStunServer () const
| Get the STUN/TURN server to use with this NAT policy.
LINPHONECXX_PUBLIC void | setStunServer (const std::string &stunServer)
| Set the STUN/TURN server to use with this NAT policy.
LINPHONECXX_PUBLIC std::string | getStunServerUsername () const
| Get the username used to authenticate with the STUN/TURN server.
LINPHONECXX_PUBLIC void | setStunServerUsername (const std::string &username)
| Set the username used to authenticate with the STUN/TURN server.
LINPHONECXX_PUBLIC bool | tcpTurnTransportEnabled () const
| Tells whether TCP TURN transport is enabled.
LINPHONECXX_PUBLIC void | enableTcpTurnTransport (bool enable)
| Enable TCP TURN transport.
LINPHONECXX_PUBLIC bool | tlsTurnTransportEnabled () const
| Tells whether TLS TURN transport is enabled.
LINPHONECXX_PUBLIC void | enableTlsTurnTransport (bool enable)
| Enable TLS TURN transport.
LINPHONECXX_PUBLIC bool | turnEnabled () const
| Tell whether TURN is enabled.
LINPHONECXX_PUBLIC void | enableTurn (bool enable)
| Enable TURN.
LINPHONECXX_PUBLIC bool | udpTurnTransportEnabled () const
| Tells whether UDP TURN transport is enabled.
LINPHONECXX_PUBLIC void | enableUdpTurnTransport (bool enable)
| Enable UDP TURN transport.
LINPHONECXX_PUBLIC bool | upnpEnabled () const
| Tell whether uPnP is enabled.
LINPHONECXX_PUBLIC void | enableUpnp (bool enable)
| Enable uPnP.
LINPHONECXX_PUBLIC void | clear ()
| Clear a NAT policy (deactivate all protocols and unset the STUN server).
LINPHONECXX_PUBLIC std::shared_ptr< linphone::NatPolicy > | clone () const
| Clone an existing NatPolicy object.
LINPHONECXX_PUBLIC void | resolveStunServer ()
| Start a STUN server DNS resolution.

## Detailed Description

Policy to use to pass through NATs/firewalls.

## Member Function Documentation

## clone()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::NatPolicy > linphone::NatPolicy::clone | ( |  | ) | const

Clone an existing NatPolicy object.

Returns
  A clone of the original NatPolicy object.

## enableIce()

LINPHONECXX_PUBLIC void linphone::NatPolicy::enableIce | ( | bool | enable | ) |

Enable ICE.

ICE can be enabled without STUN/TURN, in which case only the local candidates will be used.

Parameters

  enable | Boolean value telling whether to enable ICE.

## enableStun()

LINPHONECXX_PUBLIC void linphone::NatPolicy::enableStun | ( | bool | enable | ) |

Enable STUN.

If TURN is also enabled, TURN will be used instead of STUN.

Parameters

  enable | Boolean value telling whether to enable STUN.

## enableTcpTurnTransport()

LINPHONECXX_PUBLIC void linphone::NatPolicy::enableTcpTurnTransport | ( | bool | enable | ) |

Enable TCP TURN transport.

Used when TURN is enabled.

Parameters

  enable | Boolean value telling whether to enable TCP TURN transport.

## enableTlsTurnTransport()

LINPHONECXX_PUBLIC void linphone::NatPolicy::enableTlsTurnTransport | ( | bool | enable | ) |

Enable TLS TURN transport.

Used when TURN is enabled.

Parameters

  enable | Boolean value telling whether to enable TLS TURN transport.

## enableTurn()

LINPHONECXX_PUBLIC void linphone::NatPolicy::enableTurn | ( | bool | enable | ) |

Enable TURN.

If STUN is also enabled, it is ignored and TURN is used.

Parameters

  enable | Boolean value telling whether to enable TURN.

## enableUdpTurnTransport()

LINPHONECXX_PUBLIC void linphone::NatPolicy::enableUdpTurnTransport | ( | bool | enable | ) |

Enable UDP TURN transport.

Used when TURN is enabled.

Parameters

  enable | Boolean value telling whether to enable UDP TURN transport.

## enableUpnp()

LINPHONECXX_PUBLIC void linphone::NatPolicy::enableUpnp | ( | bool | enable | ) |

Enable uPnP.

This has the effect to disable every other policies (ICE, STUN and TURN).

Parameters

  enable | Boolean value telling whether to enable uPnP.

## getCore()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > linphone::NatPolicy::getCore | ( |  | ) | const

Returns the Core object managing this nat policy, if any.

Returns
  the Core object associated.

## getNatV4Address()

LINPHONECXX_PUBLIC std::string linphone::NatPolicy::getNatV4Address | ( |  | ) | const

Get the mandatory v4 IP address to use with this NAT policy as server-reflexive candidate for ICE.

Used when STUN or TURN are enabled.

Returns
  the nat v4 address.

## getNatV6Address()

LINPHONECXX_PUBLIC std::string linphone::NatPolicy::getNatV6Address | ( |  | ) | const

Get the mandatory v6 IP address to use with this NAT policy as server-reflexive candidate for ICE.

Used when STUN or TURN are enabled.

Returns
  the nat v4 address.

## getStunServer()

LINPHONECXX_PUBLIC std::string linphone::NatPolicy::getStunServer | ( |  | ) | const

Get the STUN/TURN server to use with this NAT policy.

Used when STUN or TURN are enabled.

Returns
  The STUN server used by this NAT policy.

## getStunServerUsername()

LINPHONECXX_PUBLIC std::string linphone::NatPolicy::getStunServerUsername | ( |  | ) | const

Get the username used to authenticate with the STUN/TURN server.

The authentication will search for a AuthInfo with this username. If it is not set the username of the currently used ProxyConfig is used to search for a LinphoneAuthInfo.

Returns
  The username used to authenticate with the STUN/TURN server.

## iceEnabled()

LINPHONECXX_PUBLIC bool linphone::NatPolicy::iceEnabled | ( |  | ) | const

Tell whether ICE is enabled.

Returns
  Boolean value telling whether ICE is enabled.

## setNatV4Address()

LINPHONECXX_PUBLIC void linphone::NatPolicy::setNatV4Address | ( | const std::string & | v4Address | ) |

Set the mandatory v4 IP address to use with this NAT policy as server-reflexive candidate for ICE.

The IP address is used only if no stun server is set for server-reflexive candidate gathering. Using this method is useful when Liblinphone is used in a server product, when the server does not own the public IP address. Used when STUN or TURN are enabled.

Parameters

  v4Address | The STUN server to use with this NAT policy.

## setNatV6Address()

LINPHONECXX_PUBLIC void linphone::NatPolicy::setNatV6Address | ( | const std::string & | v4Address | ) |

Set the mandatory v6 IP address to use with this NAT policy as server-reflexive candidate for ICE.

The IP address is used only if no stun server is set for server-reflexive candidate gathering. Using this method is useful when Liblinphone is used in a server product, when the server does not own the public IP address. Used when STUN or TURN are enabled.

Parameters

  v4Address | The STUN server to use with this NAT policy.

## setStunServer()

LINPHONECXX_PUBLIC void linphone::NatPolicy::setStunServer | ( | const std::string & | stunServer | ) |

Set the STUN/TURN server to use with this NAT policy.

Used when STUN or TURN are enabled.

Parameters

  stunServer | The STUN server to use with this NAT policy.

## setStunServerUsername()

LINPHONECXX_PUBLIC void linphone::NatPolicy::setStunServerUsername | ( | const std::string & | username | ) |

Set the username used to authenticate with the STUN/TURN server.

The authentication will search for a AuthInfo with this username. If it is not set the username of the currently used ProxyConfig is used to search for a LinphoneAuthInfo.

Parameters

  username | The username used to authenticate with the STUN/TURN server.

## stunEnabled()

LINPHONECXX_PUBLIC bool linphone::NatPolicy::stunEnabled | ( |  | ) | const

Tell whether STUN is enabled.

Returns
  Boolean value telling whether STUN is enabled.

## tcpTurnTransportEnabled()

LINPHONECXX_PUBLIC bool linphone::NatPolicy::tcpTurnTransportEnabled | ( |  | ) | const

Tells whether TCP TURN transport is enabled.

Used when TURN is enabled.

Returns
  Boolean value telling whether TCP TURN transport is enabled.

## tlsTurnTransportEnabled()

LINPHONECXX_PUBLIC bool linphone::NatPolicy::tlsTurnTransportEnabled | ( |  | ) | const

Tells whether TLS TURN transport is enabled.

Used when TURN is enabled.

Returns
  Boolean value telling whether TLS TURN transport is enabled.

## turnEnabled()

LINPHONECXX_PUBLIC bool linphone::NatPolicy::turnEnabled | ( |  | ) | const

Tell whether TURN is enabled.

Returns
  Boolean value telling whether TURN is enabled.

## udpTurnTransportEnabled()

LINPHONECXX_PUBLIC bool linphone::NatPolicy::udpTurnTransportEnabled | ( |  | ) | const

Tells whether UDP TURN transport is enabled.

Used when TURN is enabled.

Returns
  Boolean value telling whether UDP TURN transport is enabled.

## upnpEnabled()

LINPHONECXX_PUBLIC bool linphone::NatPolicy::upnpEnabled | ( |  | ) | const

Tell whether uPnP is enabled.

Returns
  Boolean value telling whether uPnP is enabled.

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

- nat_policy.hh