FMLiveSwitchStunServer Class Reference

A STUN server. More...

Instance Methods

(FMLiveSwitchFunction1< FMLiveSwitchDatagramSocketCreateArgs *, FMLiveSwitchDatagramSocket * > *) - createDatagramSocket
 Gets the create callback to create a datagram socket. More...
 
(FMLiveSwitchStunMessage *) - createErrorResponseWithRequest:remoteAddress:errorMessage:
 Creates an error response with a ganeric Stun server error. More...
 
(FMLiveSwitchStunMessage *) - createExceptionResponseWithRequest:remoteAddress:error:
 Creates an exception response. More...
 
(FMLiveSwitchFunction1< FMLiveSwitchStreamSocketCreateArgs *, FMLiveSwitchStreamSocket * > *) - createStreamSocket
 Gets the create callback to create a stream socket. More...
 
(bool) - disableTcp
 Gets whether to prevent the server from listening for TCP requests. More...
 
(bool) - disableTls
 Gets whether to prevent the server from listening for TLS requests. More...
 
(bool) - disableUdp
 Gets whether to prevent the server from listening for UDP requests. More...
 
(NSString *) - getPrefixWithUdp:secure:
 Gets a prefix. More...
 
(instancetype) - init
 Initializes a new instance of the FMLiveSwitchSerializable class. More...
 
(NSString *) - label
 Gets the label. More...
 
(FMLiveSwitchServerAddress *) - localTcpAddress
 Gets the local TCP address. More...
 
(NSMutableArray *) - localTcpAddresses
 Gets the local TCP addresses. More...
 
(FMLiveSwitchServerAddress *) - localUdpAddress
 Gets the local UDP address. More...
 
(NSMutableArray *) - localUdpAddresses
 Gets the local UDP addresses. More...
 
(bool) - processBuffer:udpServerSocket:tcpServerSocket:localAddress:remoteAddress:readLength:
 Processes the buffer. More...
 
(FMLiveSwitchStunMessage *) - processWithRequest:udpServerSocket:tcpServerSocket:localAddress:remoteAddress:
 Processes the specified request. More...
 
(void) - setCreateDatagramSocket:
 Sets the create callback to create a datagram socket. More...
 
(FMLiveSwitchDatagramSocketCreateArgs *) - setCreateDatagramSocketBlock
 Sets the create callback to create a datagram socket. More...
 
(void) - setCreateDatagramSocketBlock:
 Sets the create callback to create a datagram socket. More...
 
(void) - setCreateStreamSocket:
 Sets the create callback to create a stream socket. More...
 
(FMLiveSwitchStreamSocketCreateArgs *) - setCreateStreamSocketBlock
 Sets the create callback to create a stream socket. More...
 
(void) - setCreateStreamSocketBlock:
 Sets the create callback to create a stream socket. More...
 
(void) - setDisableTcp:
 Sets whether to prevent the server from listening for TCP requests. More...
 
(void) - setDisableTls:
 Sets whether to prevent the server from listening for TLS requests. More...
 
(void) - setDisableUdp:
 Sets whether to prevent the server from listening for UDP requests. More...
 
(void) - setStreamSendTimeout:
 Sets timeout for asynchronous data sending over stream sockets in ms. More...
 
(bool) - start
 Starts the server. More...
 
(bool) - startWithUdpAddresses:
 Starts the server. More...
 
(bool) - startWithUdpAddresses:tcpAddresses:
 Starts the server. More...
 
(bool) - startWithUdpAddresses:tcpAddresses:tlsAddresses:
 Starts the server. More...
 
(bool) - stop
 Stops the server. More...
 
(int) - streamSendTimeout
 Gets timeout for asynchronous data sending over stream sockets in ms. More...
 
(NSMutableArray *) - tcpAddresses
 Gets the TCP server addresses. More...
 
(NSMutableArray *) - tlsAddresses
 Gets the TLS server addresses. More...
 
(NSMutableArray *) - udpAddresses
 Gets the UDP server addresses. More...
 
- Instance Methods inherited from FMLiveSwitchDynamic
(NSMutableDictionary< NSString *, id > *) - dynamicProperties
 Gets all dynamic properties on this instance. More...
 
(id- getDynamicValueWithKey:
 Gets a property value from the local cache. More...
 
(void) - setDynamicValueWithKey:value:
 Sets a property value in the local cache. More...
 
(bool) - unsetDynamicValueWithKey:
 Removes a property value from the local cache. More...
 

Class Methods

(FMLiveSwitchStunServer *) + stunServer
 
- Class Methods inherited from FMLiveSwitchDynamic
(FMLiveSwitchDynamic *) + dynamic
 
- Class Methods inherited from FMLiveSwitchSerializable
(FMLiveSwitchSerializable *) + serializable
 Initializes a new instance of the FMLiveSwitchSerializable class. More...
 

Detailed Description

A STUN server.

Method Documentation

◆ createDatagramSocket

- (FMLiveSwitchFunction1<FMLiveSwitchDatagramSocketCreateArgs*,FMLiveSwitchDatagramSocket*>*) createDatagramSocket

Gets the create callback to create a datagram socket.

◆ createErrorResponseWithRequest:remoteAddress:errorMessage:

- (FMLiveSwitchStunMessage*) createErrorResponseWithRequest: (FMLiveSwitchStunMessage *)  request
remoteAddress: (FMLiveSwitchTransportAddress *)  remoteAddress
errorMessage: (NSString *)  errorMessage 

Creates an error response with a ganeric Stun server error.

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

◆ createExceptionResponseWithRequest:remoteAddress:error:

- (FMLiveSwitchStunMessage*) createExceptionResponseWithRequest: (FMLiveSwitchStunMessage *)  request
remoteAddress: (FMLiveSwitchTransportAddress *)  remoteAddress
error: (FMLiveSwitchStunError *)  error 

Creates an exception response.

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

Implemented in FMLiveSwitchTurnServer.

◆ createStreamSocket

- (FMLiveSwitchFunction1<FMLiveSwitchStreamSocketCreateArgs*,FMLiveSwitchStreamSocket*>*) createStreamSocket

Gets the create callback to create a stream socket.

◆ disableTcp

- (bool) disableTcp

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

◆ disableTls

- (bool) disableTls

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

◆ disableUdp

- (bool) disableUdp

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

◆ getPrefixWithUdp:secure:

- (NSString*) getPrefixWithUdp: (bool)  udp
secure: (bool)  secure 

Gets a prefix.

◆ init

- (instancetype) init

Initializes a new instance of the FMLiveSwitchSerializable class.

Implements FMLiveSwitchDynamic.

◆ label

- (NSString*) label

Gets the label.

Implemented in FMLiveSwitchTurnServer.

◆ localTcpAddress

- (FMLiveSwitchServerAddress*) localTcpAddress

Gets the local TCP address.

◆ localTcpAddresses

- (NSMutableArray*) localTcpAddresses

Gets the local TCP addresses.

◆ localUdpAddress

- (FMLiveSwitchServerAddress*) localUdpAddress

Gets the local UDP address.

◆ localUdpAddresses

- (NSMutableArray*) localUdpAddresses

Gets the local UDP addresses.

◆ processBuffer:udpServerSocket:tcpServerSocket:localAddress:remoteAddress:readLength:

- (bool) processBuffer: (FMLiveSwitchDataBuffer *)  buffer
udpServerSocket: (FMLiveSwitchDatagramSocket *)  udpServerSocket
tcpServerSocket: (FMLiveSwitchStreamSocket *)  tcpServerSocket
localAddress: (FMLiveSwitchServerAddress *)  localAddress
remoteAddress: (FMLiveSwitchTransportAddress *)  remoteAddress
readLength: (int *)  readLength 

Processes the buffer.

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

Implemented in FMLiveSwitchTurnServer.

◆ processWithRequest:udpServerSocket:tcpServerSocket:localAddress:remoteAddress:

- (FMLiveSwitchStunMessage*) processWithRequest: (FMLiveSwitchStunMessage *)  request
udpServerSocket: (FMLiveSwitchDatagramSocket *)  udpServerSocket
tcpServerSocket: (FMLiveSwitchStreamSocket *)  tcpServerSocket
localAddress: (FMLiveSwitchServerAddress *)  localAddress
remoteAddress: (FMLiveSwitchTransportAddress *)  remoteAddress 

Processes the specified request.

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

Implemented in FMLiveSwitchTurnServer.

◆ setCreateDatagramSocket:

- (void) setCreateDatagramSocket: (FMLiveSwitchFunction1< FMLiveSwitchDatagramSocketCreateArgs *, FMLiveSwitchDatagramSocket * > *)  value

Sets the create callback to create a datagram socket.

◆ setCreateDatagramSocketBlock

- (FMLiveSwitchDatagramSocketCreateArgs*) setCreateDatagramSocketBlock

Sets the create callback to create a datagram socket.

◆ setCreateDatagramSocketBlock:

- (void) setCreateDatagramSocketBlock: (FMLiveSwitchDatagramSocket *(^)(FMLiveSwitchDatagramSocketCreateArgs *))  valueBlock

Sets the create callback to create a datagram socket.

◆ setCreateStreamSocket:

- (void) setCreateStreamSocket: (FMLiveSwitchFunction1< FMLiveSwitchStreamSocketCreateArgs *, FMLiveSwitchStreamSocket * > *)  value

Sets the create callback to create a stream socket.

◆ setCreateStreamSocketBlock

- (FMLiveSwitchStreamSocketCreateArgs*) setCreateStreamSocketBlock

Sets the create callback to create a stream socket.

◆ setCreateStreamSocketBlock:

- (void) setCreateStreamSocketBlock: (FMLiveSwitchStreamSocket *(^)(FMLiveSwitchStreamSocketCreateArgs *))  valueBlock

Sets the create callback to create a stream socket.

◆ setDisableTcp:

- (void) setDisableTcp: (bool)  value

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

◆ setDisableTls:

- (void) setDisableTls: (bool)  value

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

◆ setDisableUdp:

- (void) setDisableUdp: (bool)  value

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

◆ setStreamSendTimeout:

- (void) setStreamSendTimeout: (int)  value

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

Defaults to unset.

◆ start

- (bool) start

Starts the server.

◆ startWithUdpAddresses:

- (bool) startWithUdpAddresses: (NSMutableArray *)  udpAddresses

Starts the server.

Parameters
udpAddressesThe UDP addresses to listen on.

◆ startWithUdpAddresses:tcpAddresses:

- (bool) startWithUdpAddresses: (NSMutableArray *)  udpAddresses
tcpAddresses: (NSMutableArray *)  tcpAddresses 

Starts the server.

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

◆ startWithUdpAddresses:tcpAddresses:tlsAddresses:

- (bool) startWithUdpAddresses: (NSMutableArray *)  udpAddresses
tcpAddresses: (NSMutableArray *)  tcpAddresses
tlsAddresses: (NSMutableArray *)  tlsAddresses 

Starts the server.

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

Implemented in FMLiveSwitchTurnServer.

◆ stop

- (bool) stop

Stops the server.

Implemented in FMLiveSwitchTurnServer.

◆ streamSendTimeout

- (int) streamSendTimeout

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

Defaults to unset.

◆ stunServer

+ (FMLiveSwitchStunServer*) stunServer

◆ tcpAddresses

- (NSMutableArray*) tcpAddresses

Gets the TCP server addresses.

◆ tlsAddresses

- (NSMutableArray*) tlsAddresses

Gets the TLS server addresses.

◆ udpAddresses

- (NSMutableArray*) udpAddresses

Gets the UDP server addresses.