Package org.linphone.core
Interface NatPolicy
public interface NatPolicy
Policy to use to pass through NATs/firewalls.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear a NAT policy (deactivate all protocols and unset the STUN server).clone()
Clone an existingNatPolicy
object.getCore()
Returns theCore
object managing this nat policy, if any.long
Gets the native pointer used by this class to make native method calls.Get the mandatory v4 IP address to use with this NAT policy as server-reflexive
candidate for ICE.Get the mandatory v6 IP address to use with this NAT policy as server-reflexive
candidate for ICE.Get the STUN/TURN server to use with this NAT policy.Get the username used to authenticate with the STUN/TURN server.Gets the object stored in this object user's databoolean
Tell whether ICE is enabled.boolean
Tell whether STUN is enabled.boolean
Tells whether TCP TURN transport is enabled.boolean
Tells whether TLS TURN transport is enabled.boolean
Tell whether TURN is enabled.boolean
Tells whether UDP TURN transport is enabled.boolean
Tell whether uPnP is enabled.void
Start a STUN server DNS resolution.void
setIceEnabled
(boolean enable) Enable ICE.void
setNatV4Address
(String v4Address) Set the mandatory v4 IP address to use with this NAT policy as server-reflexive
candidate for ICE.void
setNatV6Address
(String v4Address) Set the mandatory v6 IP address to use with this NAT policy as server-reflexive
candidate for ICE.void
setStunEnabled
(boolean enable) Enable STUN.void
setStunServer
(String stunServer) Set the STUN/TURN server to use with this NAT policy.void
setStunServerUsername
(String username) Set the username used to authenticate with the STUN/TURN server.void
setTcpTurnTransportEnabled
(boolean enable) Enable TCP TURN transport.void
setTlsTurnTransportEnabled
(boolean enable) Enable TLS TURN transport.void
setTurnEnabled
(boolean enable) Enable TURN.void
setUdpTurnTransportEnabled
(boolean enable) Enable UDP TURN transport.void
setUpnpEnabled
(boolean enable) Enable uPnP.void
setUserData
(Object data) Sets the object to store in this object user's datatoString()
-
Method Details
-
getCore
- Returns:
- the
Core
object associated.
-
isIceEnabled
boolean isIceEnabled()Tell whether ICE is enabled.
- Returns:
- Boolean value telling whether ICE is enabled.
-
setIceEnabled
void setIceEnabled(boolean 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.
-
getNatV4Address
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.
-
setNatV4Address
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.
-
getNatV6Address
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.
-
setNatV6Address
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.
-
isStunEnabled
boolean isStunEnabled()Tell whether STUN is enabled.
- Returns:
- Boolean value telling whether STUN is enabled.
-
setStunEnabled
void setStunEnabled(boolean enable) Enable STUN.
If TURN is also enabled, TURN will be used instead of STUN.- Parameters:
enable
- Boolean value telling whether to enable STUN.
-
getStunServer
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.
-
setStunServer
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.
-
getStunServerUsername
Get the username used to authenticate with the STUN/TURN server.
The authentication will search for aAuthInfo
with this username. If it
is not set the username of the currently usedProxyConfig
is used to
search for a LinphoneAuthInfo.- Returns:
- The username used to authenticate with the STUN/TURN server.
-
setStunServerUsername
Set the username used to authenticate with the STUN/TURN server.
The authentication will search for aAuthInfo
with this username. If it
is not set the username of the currently usedProxyConfig
is used to
search for a LinphoneAuthInfo.- Parameters:
username
- The username used to authenticate with the STUN/TURN server.
-
isTcpTurnTransportEnabled
boolean isTcpTurnTransportEnabled()Tells whether TCP TURN transport is enabled.
Used when TURN is enabled.- Returns:
- Boolean value telling whether TCP TURN transport is enabled.
-
setTcpTurnTransportEnabled
void setTcpTurnTransportEnabled(boolean enable) Enable TCP TURN transport.
Used when TURN is enabled.- Parameters:
enable
- Boolean value telling whether to enable TCP TURN transport.
-
isTlsTurnTransportEnabled
boolean isTlsTurnTransportEnabled()Tells whether TLS TURN transport is enabled.
Used when TURN is enabled.- Returns:
- Boolean value telling whether TLS TURN transport is enabled.
-
setTlsTurnTransportEnabled
void setTlsTurnTransportEnabled(boolean enable) Enable TLS TURN transport.
Used when TURN is enabled.- Parameters:
enable
- Boolean value telling whether to enable TLS TURN transport.
-
isTurnEnabled
boolean isTurnEnabled()Tell whether TURN is enabled.
- Returns:
- Boolean value telling whether TURN is enabled.
-
setTurnEnabled
void setTurnEnabled(boolean enable) Enable TURN.
If STUN is also enabled, it is ignored and TURN is used.- Parameters:
enable
- Boolean value telling whether to enable TURN.
-
isUdpTurnTransportEnabled
boolean isUdpTurnTransportEnabled()Tells whether UDP TURN transport is enabled.
Used when TURN is enabled.- Returns:
- Boolean value telling whether UDP TURN transport is enabled.
-
setUdpTurnTransportEnabled
void setUdpTurnTransportEnabled(boolean enable) Enable UDP TURN transport.
Used when TURN is enabled.- Parameters:
enable
- Boolean value telling whether to enable UDP TURN transport.
-
isUpnpEnabled
boolean isUpnpEnabled()Tell whether uPnP is enabled.
- Returns:
- Boolean value telling whether uPnP is enabled.
-
setUpnpEnabled
void setUpnpEnabled(boolean 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.
-
clear
void clear()Clear a NAT policy (deactivate all protocols and unset the STUN server).
-
clone
- Returns:
- A clone of the original
NatPolicy
object.
-
resolveStunServer
void resolveStunServer()Start a STUN server DNS resolution.
-
setUserData
Sets the object to store in this object user's data- Parameters:
data
- the object to store
-
getUserData
Object getUserData()Gets the object stored in this object user's data- Returns:
- the object store if any, null otherwise
-
getNativePointer
long getNativePointer()Gets the native pointer used by this class to make native method calls.- Returns:
- the nativer pointer, as long
-
toString
String toString()
-