FMLiveSwitchTurnServer Class Reference

An TURN/STUN server. More...

Instance Methods

(int) - allocationCount
 Gets the number of active allocations. More...
 
(int) - allocationPortMax
 Gets the maximum allowed port to be used when allocating sockets. More...
 
(int) - allocationPortMin
 Gets the minimum allowed port to be used when allocating sockets. More...
 
(FMLiveSwitchStunMessage *) - createExceptionResponseWithRequest:remoteAddress:error:
 Creates an exception response. More...
 
(long long) - defaultAllocateLifetime
 Gets the default lifetime for new allocations in seconds. More...
 
(long long) - defaultRefreshLifetime
 Gets the default lifetime for refreshed allocations in seconds. More...
 
(bool) - disableBypass
 Gets a value indicating whether to disable the in-memory bypass of the network when communicating between two relay candidates. More...
 
(NSMutableArray *) - forbiddenPeerCidrs
 Gets the list of forbidden peer CIDRs. More...
 
(bool) - forceDefaultAllocateLifetime
 Gets whether the server should force the default lifetime for new allocations (true) or allow clients to request their own lifetime within the min/max range (false). More...
 
(bool) - forceDefaultRefreshLifetime
 Gets whether the server should force the default lifetime for refreshed allocations (true) or allow clients to request their own lifetime within the min/max range (false). More...
 
(instancetype) - initWithAuthCallback:
 Initializes a new instance of the FMLiveSwitchTurnServer class. More...
 
(instancetype) - initWithAuthCallbackBlock:
 Initializes a new instance of the FMLiveSwitchTurnServer class. More...
 
(NSString *) - label
 Gets the label. More...
 
(long long) - maxAllocateLifetime
 Gets the maximum lifetime for new allocations in seconds. More...
 
(long long) - maxRefreshLifetime
 Gets the maximum lifetime for refreshed allocations in seconds. More...
 
(long long) - minAllocateLifetime
 Gets the minimum lifetime for new allocations in seconds. More...
 
(long long) - minRefreshLifetime
 Gets the minimum lifetime for refreshed allocations in seconds. More...
 
(NSString *) - nonce
 Gets the current nonce. More...
 
(bool) - processBuffer:udpServerSocket:tcpServerSocket:localAddress:remoteAddress:readLength:
 Processes the buffer. More...
 
(FMLiveSwitchStunMessage *) - processWithRequest:udpServerSocket:tcpServerSocket:localAddress:remoteAddress:
 Processes the specified request. More...
 
(NSString *) - realm
 Gets the realm used for this server. More...
 
(void) - setAllocationPortMax:
 Sets the maximum allowed port to be used when allocating sockets. More...
 
(void) - setAllocationPortMin:
 Sets the minimum allowed port to be used when allocating sockets. More...
 
(void) - setDefaultAllocateLifetime:
 Sets the default lifetime for new allocations in seconds. More...
 
(void) - setDefaultRefreshLifetime:
 Sets the default lifetime for refreshed allocations in seconds. More...
 
(void) - setDisableBypass:
 Sets a value indicating whether to disable the in-memory bypass of the network when communicating between two relay candidates. More...
 
(void) - setForbiddenPeerCidrs:
 Sets the list of forbidden peer CIDRs. More...
 
(void) - setForceDefaultAllocateLifetime:
 Sets whether the server should force the default lifetime for new allocations (true) or allow clients to request their own lifetime within the min/max range (false). More...
 
(void) - setForceDefaultRefreshLifetime:
 Sets whether the server should force the default lifetime for refreshed allocations (true) or allow clients to request their own lifetime within the min/max range (false). More...
 
(void) - setMaxAllocateLifetime:
 Sets the maximum lifetime for new allocations in seconds. More...
 
(void) - setMaxRefreshLifetime:
 Sets the maximum lifetime for refreshed allocations in seconds. More...
 
(void) - setRealm:
 Sets the realm used for this server. More...
 
(void) - setStaleNonceSecurity:
 Sets whether the server should enforce stale-nonce security by sending a 438 Stale Nonce in response to allocate requests with a stale or non-existent nonce. More...
 
(bool) - staleNonceSecurity
 Gets whether the server should enforce stale-nonce security by sending a 438 Stale Nonce in response to allocate requests with a stale or non-existent nonce. More...
 
(bool) - startWithUdpAddresses:tcpAddresses:tlsAddresses:
 Starts the server. More...
 
(bool) - stop
 Stops the server. More...
 
- Instance Methods inherited from FMLiveSwitchStunServer
(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...
 
(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...
 
(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...
 
(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...
 
(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

(FMLiveSwitchTurnServer *) + turnServerWithAuthCallback:
 Initializes a new instance of the FMLiveSwitchTurnServer class. More...
 
(FMLiveSwitchTurnServer *) + turnServerWithAuthCallbackBlock:
 Initializes a new instance of the FMLiveSwitchTurnServer class. More...
 
- Class Methods inherited from FMLiveSwitchStunServer
(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

An TURN/STUN server.

Method Documentation

◆ allocationCount

- (int) allocationCount

Gets the number of active allocations.

◆ allocationPortMax

- (int) allocationPortMax

Gets the maximum allowed port to be used when allocating sockets.

The default value is 65535.

◆ allocationPortMin

- (int) allocationPortMin

Gets the minimum allowed port to be used when allocating sockets.

The default value is 49152.

◆ createExceptionResponseWithRequest:remoteAddress:error:

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

Creates an exception response.

Parameters
requestThe request.
remoteAddressThe remote address.
errorThe error.

Implements FMLiveSwitchStunServer.

◆ defaultAllocateLifetime

- (long long) defaultAllocateLifetime

Gets the default lifetime for new allocations in seconds.

Defaults to 600 (10 minutes).

◆ defaultRefreshLifetime

- (long long) defaultRefreshLifetime

Gets the default lifetime for refreshed allocations in seconds.

Defaults to 600 (10 minutes).

◆ disableBypass

- (bool) disableBypass

Gets a value indicating whether to disable the in-memory bypass of the network when communicating between two relay candidates.

◆ forbiddenPeerCidrs

- (NSMutableArray*) forbiddenPeerCidrs

Gets the list of forbidden peer CIDRs.

Addresses matching this list are banned from receiving relayed data packets.

◆ forceDefaultAllocateLifetime

- (bool) forceDefaultAllocateLifetime

Gets whether the server should force the default lifetime for new allocations (true) or allow clients to request their own lifetime within the min/max range (false).

Defaults to false.

◆ forceDefaultRefreshLifetime

- (bool) forceDefaultRefreshLifetime

Gets whether the server should force the default lifetime for refreshed allocations (true) or allow clients to request their own lifetime within the min/max range (false).

Defaults to false.

◆ initWithAuthCallback:

- (instancetype) initWithAuthCallback: (FMLiveSwitchFunction1< FMLiveSwitchTurnAuthArgs *, FMLiveSwitchTurnAuthResult * > *)  authCallback

Initializes a new instance of the FMLiveSwitchTurnServer class.

Parameters
authCallbackThe authentication callback.

◆ initWithAuthCallbackBlock:

- (instancetype) initWithAuthCallbackBlock: (FMLiveSwitchTurnAuthResult *(^)(FMLiveSwitchTurnAuthArgs *))  authCallbackBlock

Initializes a new instance of the FMLiveSwitchTurnServer class.

Parameters
authCallbackBlockThe authentication callback.

◆ label

- (NSString*) label

Gets the label.

Implements FMLiveSwitchStunServer.

◆ maxAllocateLifetime

- (long long) maxAllocateLifetime

Gets the maximum lifetime for new allocations in seconds.

Defaults to 3600 (1 hour).

◆ maxRefreshLifetime

- (long long) maxRefreshLifetime

Gets the maximum lifetime for refreshed allocations in seconds.

Defaults to 3600 (1 hour).

◆ minAllocateLifetime

- (long long) minAllocateLifetime

Gets the minimum lifetime for new allocations in seconds.

Equal to 600 (10 minutes).

◆ minRefreshLifetime

- (long long) minRefreshLifetime

Gets the minimum lifetime for refreshed allocations in seconds.

Equal to 600 (10 minutes).

◆ nonce

- (NSString*) nonce

Gets the current nonce.

◆ 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.

Implements FMLiveSwitchStunServer.

◆ 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.

Implements FMLiveSwitchStunServer.

◆ realm

- (NSString*) realm

Gets the realm used for this server.

◆ setAllocationPortMax:

- (void) setAllocationPortMax: (int)  value

Sets the maximum allowed port to be used when allocating sockets.

The default value is 65535.

◆ setAllocationPortMin:

- (void) setAllocationPortMin: (int)  value

Sets the minimum allowed port to be used when allocating sockets.

The default value is 49152.

◆ setDefaultAllocateLifetime:

- (void) setDefaultAllocateLifetime: (long long)  value

Sets the default lifetime for new allocations in seconds.

Defaults to 600 (10 minutes).

◆ setDefaultRefreshLifetime:

- (void) setDefaultRefreshLifetime: (long long)  value

Sets the default lifetime for refreshed allocations in seconds.

Defaults to 600 (10 minutes).

◆ setDisableBypass:

- (void) setDisableBypass: (bool)  value

Sets a value indicating whether to disable the in-memory bypass of the network when communicating between two relay candidates.

◆ setForbiddenPeerCidrs:

- (void) setForbiddenPeerCidrs: (NSMutableArray *)  value

Sets the list of forbidden peer CIDRs.

Addresses matching this list are banned from receiving relayed data packets.

◆ setForceDefaultAllocateLifetime:

- (void) setForceDefaultAllocateLifetime: (bool)  value

Sets whether the server should force the default lifetime for new allocations (true) or allow clients to request their own lifetime within the min/max range (false).

Defaults to false.

◆ setForceDefaultRefreshLifetime:

- (void) setForceDefaultRefreshLifetime: (bool)  value

Sets whether the server should force the default lifetime for refreshed allocations (true) or allow clients to request their own lifetime within the min/max range (false).

Defaults to false.

◆ setMaxAllocateLifetime:

- (void) setMaxAllocateLifetime: (long long)  value

Sets the maximum lifetime for new allocations in seconds.

Defaults to 3600 (1 hour).

◆ setMaxRefreshLifetime:

- (void) setMaxRefreshLifetime: (long long)  value

Sets the maximum lifetime for refreshed allocations in seconds.

Defaults to 3600 (1 hour).

◆ setRealm:

- (void) setRealm: (NSString *)  value

Sets the realm used for this server.

◆ setStaleNonceSecurity:

- (void) setStaleNonceSecurity: (bool)  value

Sets whether the server should enforce stale-nonce security by sending a 438 Stale Nonce in response to allocate requests with a stale or non-existent nonce.

◆ staleNonceSecurity

- (bool) staleNonceSecurity

Gets whether the server should enforce stale-nonce security by sending a 438 Stale Nonce in response to allocate requests with a stale or non-existent nonce.

◆ 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.

Implements FMLiveSwitchStunServer.

◆ stop

- (bool) stop

Stops the server.

Implements FMLiveSwitchStunServer.

◆ turnServerWithAuthCallback:

+ (FMLiveSwitchTurnServer*) turnServerWithAuthCallback: (FMLiveSwitchFunction1< FMLiveSwitchTurnAuthArgs *, FMLiveSwitchTurnAuthResult * > *)  authCallback

Initializes a new instance of the FMLiveSwitchTurnServer class.

Parameters
authCallbackThe authentication callback.

◆ turnServerWithAuthCallbackBlock:

+ (FMLiveSwitchTurnServer*) turnServerWithAuthCallbackBlock: (FMLiveSwitchTurnAuthResult *(^)(FMLiveSwitchTurnAuthArgs *))  authCallbackBlock

Initializes a new instance of the FMLiveSwitchTurnServer class.

Parameters
authCallbackBlockThe authentication callback.