fm.liveswitch.StunServer Class Reference

A STUN server. More...

Public Member Functions

fm.liveswitch.IFunction1< fm.liveswitch.DatagramSocketCreateArgs, fm.liveswitch.DatagramSocketgetCreateDatagramSocket ()
 Gets the create callback to create a datagram socket. More...
 
fm.liveswitch.IFunction1< fm.liveswitch.StreamSocketCreateArgs, fm.liveswitch.StreamSocketgetCreateStreamSocket ()
 Gets the create callback to create a stream socket. More...
 
boolean getDisableTcp ()
 Gets whether to prevent the server from listening for TCP requests. More...
 
boolean getDisableTls ()
 Gets whether to prevent the server from listening for TLS requests. More...
 
boolean getDisableUdp ()
 Gets whether to prevent the server from listening for UDP requests. More...
 
fm.liveswitch.ServerAddress getLocalTcpAddress ()
 Gets the local TCP address. More...
 
fm.liveswitch.ServerAddress[] getLocalTcpAddresses ()
 Gets the local TCP addresses. More...
 
fm.liveswitch.ServerAddress getLocalUdpAddress ()
 Gets the local UDP address. More...
 
fm.liveswitch.ServerAddress[] getLocalUdpAddresses ()
 Gets the local UDP addresses. More...
 
int getStreamSendTimeout ()
 Gets timeout for asynchronous data sending over stream sockets in ms. More...
 
fm.liveswitch.ServerAddress[] getTcpAddresses ()
 Gets the TCP server addresses. More...
 
fm.liveswitch.ServerAddress[] getTlsAddresses ()
 Gets the TLS server addresses. More...
 
fm.liveswitch.ServerAddress[] getUdpAddresses ()
 Gets the UDP server addresses. More...
 
void setCreateDatagramSocket (fm.liveswitch.IFunction1< fm.liveswitch.DatagramSocketCreateArgs, fm.liveswitch.DatagramSocket > value)
 Sets the create callback to create a datagram socket. More...
 
void setCreateStreamSocket (fm.liveswitch.IFunction1< fm.liveswitch.StreamSocketCreateArgs, fm.liveswitch.StreamSocket > value)
 Sets the create callback to create a stream socket. More...
 
void setDisableTcp (boolean value)
 Sets whether to prevent the server from listening for TCP requests. More...
 
void setDisableTls (boolean value)
 Sets whether to prevent the server from listening for TLS requests. More...
 
void setDisableUdp (boolean value)
 Sets whether to prevent the server from listening for UDP requests. More...
 
void setStreamSendTimeout (int value)
 Sets timeout for asynchronous data sending over stream sockets in ms. More...
 
boolean start ()
 Starts the server. More...
 
boolean start (fm.liveswitch.ServerAddress[] udpAddresses)
 Starts the server. More...
 
boolean start (fm.liveswitch.ServerAddress[] udpAddresses, fm.liveswitch.ServerAddress[] tcpAddresses)
 Starts the server. More...
 
boolean start (fm.liveswitch.ServerAddress[] udpAddresses, fm.liveswitch.ServerAddress[] tcpAddresses, fm.liveswitch.ServerAddress[] tlsAddresses)
 Starts the server. More...
 
boolean stop ()
 Stops the server. More...
 
 StunServer ()
 
- Public Member Functions inherited from fm.liveswitch.Dynamic
java.util.HashMap< String, Object > getDynamicProperties ()
 Gets all dynamic properties on this instance. More...
 
Object getDynamicValue (String key)
 Gets a property value from the local cache. More...
 
void setDynamicValue (String key, Object value)
 Sets a property value in the local cache. More...
 
boolean unsetDynamicValue (String key)
 Removes a property value from the local cache. More...
 

Protected Member Functions

fm.liveswitch.stun.Message createErrorResponse (fm.liveswitch.stun.Message request, fm.liveswitch.TransportAddress remoteAddress, String errorMessage)
 Creates an error response with a ganeric Stun server error. More...
 
fm.liveswitch.stun.Message createExceptionResponse (fm.liveswitch.stun.Message request, fm.liveswitch.TransportAddress remoteAddress, fm.liveswitch.stun.Error error)
 Creates an exception response. More...
 
String getLabel ()
 Gets the label. More...
 
String getPrefix (boolean udp, boolean secure)
 Gets a prefix. More...
 
fm.liveswitch.stun.Message process (fm.liveswitch.stun.Message request, fm.liveswitch.DatagramSocket udpServerSocket, fm.liveswitch.StreamSocket tcpServerSocket, fm.liveswitch.ServerAddress localAddress, fm.liveswitch.TransportAddress remoteAddress)
 Processes the specified request. More...
 
boolean processBuffer (fm.liveswitch.DataBuffer buffer, fm.liveswitch.DatagramSocket udpServerSocket, fm.liveswitch.StreamSocket tcpServerSocket, fm.liveswitch.ServerAddress localAddress, fm.liveswitch.TransportAddress remoteAddress, fm.liveswitch.IntegerHolder readLength)
 Processes the buffer. More...
 
- Protected Member Functions inherited from fm.liveswitch.Dynamic
 Dynamic ()
 
- Protected Member Functions inherited from fm.liveswitch.Serializable
boolean getIsDirty ()
 Gets a value indicating whether this instance is dirty. More...
 
 Serializable ()
 Initializes a new instance of the fm.liveswitch.Serializable class. More...
 
void setIsDirty (boolean value)
 Sets a value indicating whether this instance is dirty. More...
 

Detailed Description

A STUN server.

Constructor & Destructor Documentation

◆ StunServer()

fm.liveswitch.StunServer.StunServer ( )

Member Function Documentation

◆ createErrorResponse()

fm.liveswitch.stun.Message fm.liveswitch.StunServer.createErrorResponse ( fm.liveswitch.stun.Message  request,
fm.liveswitch.TransportAddress  remoteAddress,
String  errorMessage 
)
protected

Creates an error response with a ganeric Stun server error.

Parameters
requestThe request.
remoteAddressThe remote address.
errorMessageThe erro messager.

◆ createExceptionResponse()

fm.liveswitch.stun.Message fm.liveswitch.StunServer.createExceptionResponse ( fm.liveswitch.stun.Message  request,
fm.liveswitch.TransportAddress  remoteAddress,
fm.liveswitch.stun.Error  error 
)
protected

Creates an exception response.

Parameters
requestThe request.
remoteAddressThe remote address.
errorThe Stun error.

Reimplemented in fm.liveswitch.TurnServer.

◆ getCreateDatagramSocket()

Gets the create callback to create a datagram socket.

◆ getCreateStreamSocket()

Gets the create callback to create a stream socket.

◆ getDisableTcp()

boolean fm.liveswitch.StunServer.getDisableTcp ( )

Gets whether to prevent the server from listening for TCP requests.

◆ getDisableTls()

boolean fm.liveswitch.StunServer.getDisableTls ( )

Gets whether to prevent the server from listening for TLS requests.

◆ getDisableUdp()

boolean fm.liveswitch.StunServer.getDisableUdp ( )

Gets whether to prevent the server from listening for UDP requests.

◆ getLabel()

String fm.liveswitch.StunServer.getLabel ( )
protected

Gets the label.

Reimplemented in fm.liveswitch.TurnServer.

◆ getLocalTcpAddress()

fm.liveswitch.ServerAddress fm.liveswitch.StunServer.getLocalTcpAddress ( )

Gets the local TCP address.

◆ getLocalTcpAddresses()

fm.liveswitch.ServerAddress [] fm.liveswitch.StunServer.getLocalTcpAddresses ( )

Gets the local TCP addresses.

◆ getLocalUdpAddress()

fm.liveswitch.ServerAddress fm.liveswitch.StunServer.getLocalUdpAddress ( )

Gets the local UDP address.

◆ getLocalUdpAddresses()

fm.liveswitch.ServerAddress [] fm.liveswitch.StunServer.getLocalUdpAddresses ( )

Gets the local UDP addresses.

◆ getPrefix()

String fm.liveswitch.StunServer.getPrefix ( boolean  udp,
boolean  secure 
)
protected

Gets a prefix.

◆ getStreamSendTimeout()

int fm.liveswitch.StunServer.getStreamSendTimeout ( )

Gets timeout for asynchronous data sending over stream sockets in ms.

Defaults to unset.

◆ getTcpAddresses()

fm.liveswitch.ServerAddress [] fm.liveswitch.StunServer.getTcpAddresses ( )

Gets the TCP server addresses.

◆ getTlsAddresses()

fm.liveswitch.ServerAddress [] fm.liveswitch.StunServer.getTlsAddresses ( )

Gets the TLS server addresses.

◆ getUdpAddresses()

fm.liveswitch.ServerAddress [] fm.liveswitch.StunServer.getUdpAddresses ( )

Gets the UDP server addresses.

◆ process()

fm.liveswitch.stun.Message fm.liveswitch.StunServer.process ( fm.liveswitch.stun.Message  request,
fm.liveswitch.DatagramSocket  udpServerSocket,
fm.liveswitch.StreamSocket  tcpServerSocket,
fm.liveswitch.ServerAddress  localAddress,
fm.liveswitch.TransportAddress  remoteAddress 
)
protected

Processes the specified request.

Parameters
requestThe request.
udpServerSocketThe UDP server socket.
tcpServerSocketThe TCP server socket.
localAddressThe local address.
remoteAddressThe remote address.

Reimplemented in fm.liveswitch.TurnServer.

◆ processBuffer()

boolean fm.liveswitch.StunServer.processBuffer ( fm.liveswitch.DataBuffer  buffer,
fm.liveswitch.DatagramSocket  udpServerSocket,
fm.liveswitch.StreamSocket  tcpServerSocket,
fm.liveswitch.ServerAddress  localAddress,
fm.liveswitch.TransportAddress  remoteAddress,
fm.liveswitch.IntegerHolder  readLength 
)
protected

Processes the buffer.

Parameters
bufferThe buffer.
udpServerSocketThe UDP server socket.
tcpServerSocketThe TCP server socket.
localAddressThe local address.
remoteAddressThe remote address.
readLengthLength of the read.

Reimplemented in fm.liveswitch.TurnServer.

◆ setCreateDatagramSocket()

void fm.liveswitch.StunServer.setCreateDatagramSocket ( fm.liveswitch.IFunction1< fm.liveswitch.DatagramSocketCreateArgs, fm.liveswitch.DatagramSocket value)

Sets the create callback to create a datagram socket.

◆ setCreateStreamSocket()

void fm.liveswitch.StunServer.setCreateStreamSocket ( fm.liveswitch.IFunction1< fm.liveswitch.StreamSocketCreateArgs, fm.liveswitch.StreamSocket value)

Sets the create callback to create a stream socket.

◆ setDisableTcp()

void fm.liveswitch.StunServer.setDisableTcp ( boolean  value)

Sets whether to prevent the server from listening for TCP requests.

◆ setDisableTls()

void fm.liveswitch.StunServer.setDisableTls ( boolean  value)

Sets whether to prevent the server from listening for TLS requests.

◆ setDisableUdp()

void fm.liveswitch.StunServer.setDisableUdp ( boolean  value)

Sets whether to prevent the server from listening for UDP requests.

◆ setStreamSendTimeout()

void fm.liveswitch.StunServer.setStreamSendTimeout ( int  value)

Sets timeout for asynchronous data sending over stream sockets in ms.

Defaults to unset.

◆ start() [1/4]

boolean fm.liveswitch.StunServer.start ( )

Starts the server.

◆ start() [2/4]

boolean fm.liveswitch.StunServer.start ( fm.liveswitch.ServerAddress[]  udpAddresses)

Starts the server.

Parameters
udpAddressesThe UDP addresses to listen on.

◆ start() [3/4]

boolean fm.liveswitch.StunServer.start ( fm.liveswitch.ServerAddress[]  udpAddresses,
fm.liveswitch.ServerAddress[]  tcpAddresses 
)

Starts the server.

Parameters
udpAddressesThe UDP addresses to listen on.
tcpAddressesThe TCP addresses to listen on.

◆ start() [4/4]

boolean fm.liveswitch.StunServer.start ( fm.liveswitch.ServerAddress[]  udpAddresses,
fm.liveswitch.ServerAddress[]  tcpAddresses,
fm.liveswitch.ServerAddress[]  tlsAddresses 
)

Starts the server.

Parameters
udpAddressesThe UDP addresses to listen on.
tcpAddressesThe TCP addresses to listen on.
tlsAddressesThe TLS addresses to listen on.

Reimplemented in fm.liveswitch.TurnServer.

◆ stop()

boolean fm.liveswitch.StunServer.stop ( )

Stops the server.

Reimplemented in fm.liveswitch.TurnServer.