Module turn

The turn module contains TURN (rfc5766) client and server implementations.

Summary

Members Descriptions
namespacescy::turn

namespace scy::turn

Summary

Members Descriptions
classscy::turn::Client
classscy::turn::FiveTuple
classscy::turn::IAllocation
classscy::turn::Request
classscy::turn::Server TURN server rfc5766 implementation.
classscy::turn::ServerAllocation
classscy::turn::TCPAllocation
classscy::turn::TCPClient
classscy::turn::TCPConnectionPair
classscy::turn::UDPAllocation
classscy::turn::UDPClient
structscy::turn::ClientObserver
structscy::turn::ClientState
structscy::turn::Permission TURN permission for a user session.
structscy::turn::RelayConnectionBinding
structscy::turn::ServerObserver
structscy::turn::ServerOptions Configuration options for the TURN server.
structscy::turn::TCPClientObserver

class scy::turn::Client

class scy::turn::Client
  : public scy::Stateful< ClientState >
  : protected scy::turn::IAllocation

Summary

Members Descriptions
public Client(ClientObserver& observer,constOptions& options)
public virtual ~Client()
public virtual void initiate() Initiates the allocation sequence.
public virtual void shutdown() Shutdown the client and destroy the active allocation.
public virtual void sendAllocate() Sends the allocation request.
public virtual void addPermission(const IPList & peerIPs)
public virtual void addPermission(const std::string & ip)
public virtual void sendCreatePermission() Sends a CreatePermission request including all hosts.
public virtual void sendChannelBind(const std::string & peerIP)
public virtual void sendRefresh()
public virtual void sendData(const char * data,std::size_t size,constnet::Address& peerAddress)
public virtual bool handleResponse(conststun::Message& response)
public virtual void handleAllocateResponse(conststun::Message& response)
public virtual void handleAllocateErrorResponse(conststun::Message& response)
public virtual void handleCreatePermissionResponse(conststun::Message& response)
public virtual void handleCreatePermissionErrorResponse(conststun::Message& response)
public virtual void handleRefreshResponse(conststun::Message& response)
public virtual void handleDataIndication(conststun::Message& response)
public virtual int transportProtocol()
public virtualstun::Transaction* createTransaction(const net::Socket::Ptr & socket)
public virtual void authenticateRequest(stun::Message& request)
public virtual bool sendAuthenticatedTransaction(stun::Transaction* transaction)
public virtual bool removeTransaction(stun::Transaction* transaction)
publicnet::AddressmappedAddress() const
public virtualnet::AddressrelayedAddress() const
public bool closed() const
publicClientObserver& observer()
publicOptions& options()
public virtual void onSocketRecv(void * sender,constMutableBuffer& buffer,constnet::Address& peerAddress)
public virtual void onSocketConnect(void * sender)
public virtual void onSocketClose(void * sender)
public virtual void onTransactionProgress(void * sender,TransactionState& state,constTransactionState&)
public virtual void onStateChange(ClientState& state,constClientState& oldState)
public virtual void onTimer(void *)
protectedClientObserver& _observer
protectedOptions_options
protected net::Socket::Ptr _socket
protectedTimer_timer
protectednet::Address_mappedAddress
protectednet::Address_relayedAddress
protected std::string _realm
protected std::string _nonce
protected std::deque<stun::Message> _pendingIndications A list of queued Send indication packets awaiting server permissions.
protected std::vector<stun::Transaction* > _transactions A list containing currently active transactions.

Members

public Client(ClientObserver& observer,constOptions& options)

public virtual ~Client()

public virtual void initiate()

Initiates the allocation sequence.

public virtual void shutdown()

Shutdown the client and destroy the active allocation.

public virtual void sendAllocate()

Sends the allocation request.

public virtual void addPermission(const IPList & peerIPs)

public virtual void addPermission(const std::string & ip)

Peer permissions should be added/created before we kick off the allocation sequence, but may be added later.

public virtual void sendCreatePermission()

Sends a CreatePermission request including all hosts.

A CreatePermission request will be sent as soon as the Allocation is created, and at timer x intervals.

public virtual void sendChannelBind(const std::string & peerIP)

public virtual void sendRefresh()

public virtual void sendData(const char * data,std::size_t size,constnet::Address& peerAddress)

public virtual bool handleResponse(conststun::Message& response)

public virtual void handleAllocateResponse(conststun::Message& response)

public virtual void handleAllocateErrorResponse(conststun::Message& response)

public virtual void handleCreatePermissionResponse(conststun::Message& response)

public virtual void handleCreatePermissionErrorResponse(conststun::Message& response)

public virtual void handleRefreshResponse(conststun::Message& response)

public virtual void handleDataIndication(conststun::Message& response)

public virtual int transportProtocol()

public virtualstun::Transaction* createTransaction(const net::Socket::Ptr & socket)

public virtual void authenticateRequest(stun::Message& request)

public virtual bool sendAuthenticatedTransaction(stun::Transaction* transaction)

public virtual bool removeTransaction(stun::Transaction* transaction)

publicnet::AddressmappedAddress() const

public virtualnet::AddressrelayedAddress() const

public bool closed() const

publicClientObserver& observer()

publicOptions& options()

public virtual void onSocketRecv(void * sender,constMutableBuffer& buffer,constnet::Address& peerAddress)

public virtual void onSocketConnect(void * sender)

public virtual void onSocketClose(void * sender)

public virtual void onTransactionProgress(void * sender,TransactionState& state,constTransactionState&)

public virtual void onStateChange(ClientState& state,constClientState& oldState)

public virtual void onTimer(void *)

protectedClientObserver& _observer

protectedOptions_options

protected net::Socket::Ptr _socket

protectedTimer_timer

protectednet::Address_mappedAddress

protectednet::Address_relayedAddress

protected std::string _realm

protected std::string _nonce

protected std::deque<stun::Message> _pendingIndications

A list of queued Send indication packets awaiting server permissions.

protected std::vector<stun::Transaction* > _transactions

A list containing currently active transactions.

class scy::turn::FiveTuple

The 5-TUPLE consists of a local, a remote address, and the transport protocol used by the client to communicate with the server. +---------+ | | | External| / | Client | // | | / | | // +---------+ / // +-+ / | | / | | // +---------+ | | +---------+ / +---------+ | | |N| | | // | | | TURN | | | | |/ | External| | Client |----|A|----------| TURN |------------------| Client | | | | |^ ^| Server |^ ^| | | | |T|| || || || | +---------+ | || |+---------+| |+---------+ ^ | || | | | | | || | | | | +-+| | | | | | | | | | Internal Internal External External Client Remote Local Local Remote Performing Transport Transport Transport Transport Allocations Address Address Address Address

               |          |            |                |
               +-----+----+            +--------+-------+
                     |                          |
                     |                          |

                   Internal                External
                   5-Tuple                 5-tuple

Summary

Members Descriptions
public FiveTuple()
public FiveTuple(constnet::Address& remote,constnet::Address& local,net::TransportType transport)
public FiveTuple(constFiveTuple& r)
public inline constnet::Address& remote() const
public inline constnet::Address& local() const
public inline const net::TransportType & transport() const
public inline void remote(constnet::Address& remote)
public inline void local(constnet::Address& local)
public inline void transport(const net::TransportType & transport)
public bool operator==(constFiveTuple& r) const
public bool operator<(constFiveTuple& r) const
public std::string toString() const

Members

public FiveTuple()

public FiveTuple(constnet::Address& remote,constnet::Address& local,net::TransportType transport)

public FiveTuple(constFiveTuple& r)

public inline constnet::Address& remote() const

public inline constnet::Address& local() const

public inline const net::TransportType & transport() const

public inline void remote(constnet::Address& remote)

public inline void local(constnet::Address& local)

public inline void transport(const net::TransportType & transport)

public bool operator==(constFiveTuple& r) const

public bool operator<(constFiveTuple& r) const

public std::string toString() const

class scy::turn::IAllocation

All TURN operations revolve around allocations, and all TURN messages are associated with an allocation. An allocation conceptually consists of the following state data:

  • the relayed transport address;
  • the 5-tuple: (client's IP address, client's port, server IP address, server port, transport protocol);
  • the authentication information;
  • the time-to-expiry;

a list of permissions;

  • a list of channel to peer bindings.

The relayed transport address is the transport address allocated by the server for communicating with peers, while the 5-tuple describes the communication path between the client and the server. On the client, the 5-tuple uses the client's host transport address; on the server, the 5-tuple uses the client's server-reflexive transport address.

Both the relayed transport address and the 5-tuple MUST be unique across all allocations, so either one can be used to uniquely identify the allocation. The authentication information (e.g., username, password, realm, and nonce) is used to both verify subsequent requests and to compute the message integrity of responses. The username, realm, and nonce values are initially those used in the authenticated Allocate request that creates the allocation, though the server can change the nonce value during the lifetime of the allocation using a 438 (Stale Nonce) reply. Note that, rather than storing the password explicitly, for security reasons, it may be desirable for the server to store the key value, which is an MD5 hash over the username, realm, and password (see [RFC5389]).

The time-to-expiry is the time in seconds left until the allocation expires. Each Allocate or Refresh transaction sets this timer, which then ticks down towards 0. By default, each Allocate or Refresh transaction resets this timer to the default lifetime value of 600 seconds (10 minutes), but the client can request a different value in the Allocate and Refresh request. Allocations can only be refreshed using the Refresh request; sending data to a peer does not refresh an allocation. When an allocation expires, the state data associated with the allocation can be freed.

Summary

Members Descriptions
public IAllocation(constFiveTuple& tuple,const std::string & username,std::int64_t lifetime)
public virtual ~IAllocation()
public virtual void updateUsage(std::int64_t numBytes)
public virtual void setLifetime(std::int64_t lifetime) Sets the lifetime of the allocation and resets the timeout.
public virtual void setBandwidthLimit(std::int64_t numBytes) Sets the bandwidth limit in bytes for this allocation.
public virtual bool expired() const
public virtual bool deleted() const
public virtual std::int64_t bandwidthLimit() const
public virtual std::int64_t bandwidthUsed() const
public virtual std::int64_t bandwidthRemaining() const
public virtual std::int64_t timeRemaining() const
public virtualFiveTuple& tuple()
public virtual std::string username() const
public virtual std::int64_t lifetime() const
public virtual PermissionList permissions() const
publicnet::AddressrelayedAddress() const
public virtual void addPermission(const std::string & ip)
public virtual void addPermissions(const IPList & ips)
public virtual void removePermission(const std::string & ip)
public virtual void removeAllPermissions()
public virtual void removeExpiredPermissions()
public virtual bool hasPermission(const std::string & peerIP)
public inline virtual void print(std::ostream & os) const
protectedFiveTuple_tuple
protected std::string _username
protected PermissionList _permissions
protected std::int64_t _lifetime
protected std::int64_t _bandwidthLimit
protected std::int64_t _bandwidthUsed
protected time_t _createdAt
protected time_t _updatedAt
protected bool _deleted

Members

public IAllocation(constFiveTuple& tuple,const std::string & username,std::int64_t lifetime)

public virtual ~IAllocation()

public virtual void updateUsage(std::int64_t numBytes)

Updates the allocation's internal timeout and bandwidth usage each time the allocation is used.

public virtual void setLifetime(std::int64_t lifetime)

Sets the lifetime of the allocation and resets the timeout.

public virtual void setBandwidthLimit(std::int64_t numBytes)

Sets the bandwidth limit in bytes for this allocation.

public virtual bool expired() const

Returns true if the allocation is expired ie. is timed out or the bandwidth limit has been reached.

public virtual bool deleted() const

Returns true if the allocation's deleted flag is set and or if the allocation has expired.

This signifies that the allocation is ready to be destroyed via async garbage collection. See Server::onTimer() and Client::onTimer()

public virtual std::int64_t bandwidthLimit() const

public virtual std::int64_t bandwidthUsed() const

public virtual std::int64_t bandwidthRemaining() const

public virtual std::int64_t timeRemaining() const

public virtualFiveTuple& tuple()

public virtual std::string username() const

public virtual std::int64_t lifetime() const

public virtual PermissionList permissions() const

publicnet::AddressrelayedAddress() const

public virtual void addPermission(const std::string & ip)

public virtual void addPermissions(const IPList & ips)

public virtual void removePermission(const std::string & ip)

public virtual void removeAllPermissions()

public virtual void removeExpiredPermissions()

public virtual bool hasPermission(const std::string & peerIP)

public inline virtual void print(std::ostream & os) const

protectedFiveTuple_tuple

protected std::string _username

protected PermissionList _permissions

protected std::int64_t _lifetime

protected std::int64_t _bandwidthLimit

protected std::int64_t _bandwidthUsed

protected time_t _createdAt

protected time_t _updatedAt

protected bool _deleted

class scy::turn::Request

class scy::turn::Request
  : public scy::stun::Message

Summary

Members Descriptions
public net::TransportType transport
publicnet::AddresslocalAddress
publicnet::AddressremoteAddress
public std::string hash
public inline Request(conststun::Message& message,net::TransportType transport,constnet::Address& localAddress,constnet::Address& remoteAddress)

Members

public net::TransportType transport

publicnet::AddresslocalAddress

publicnet::AddressremoteAddress

public std::string hash

public inline Request(conststun::Message& message,net::TransportType transport,constnet::Address& localAddress,constnet::Address& remoteAddress)

class scy::turn::Server

TURN server rfc5766 implementation.

Summary

Members Descriptions
public Server(ServerObserver& observer,constServerOptions& options)
public virtual ~Server()
public virtual void start()
public virtual void stop()
public void handleRequest(Request& request,AuthenticationState state)
public void handleAuthorizedRequest(Request& request)
public void handleBindingRequest(Request& request)
public void handleAllocateRequest(Request& request)
public void handleConnectionBindRequest(Request& request)
public void respond(Request& request,stun::Message& response)
public void respondError(Request& request,int errorCode,const char * errorDesc)
public ServerAllocationMap allocations() const
public void addAllocation(ServerAllocation* alloc)
public void removeAllocation(ServerAllocation* alloc)
publicServerAllocation* getAllocation(constFiveTuple& tuple)
publicTCPAllocation* getTCPAllocation(const std::uint32_t & connectionID)
public net::TCPSocket::Ptr getTCPSocket(constnet::Address& remoteAddr)
public void releaseTCPSocket(net::Socket* socket)
publicServerObserver& observer()
publicServerOptions& options()
publicnet::UDPSocket& udpSocket()
publicnet::TCPSocket& tcpSocket()
publicTimer& timer()
public void onTCPAcceptConnection(void * sender,const net::TCPSocket::Ptr & sock)
public void onTCPSocketClosed(void * sender)
public void onSocketRecv(void * sender,constMutableBuffer& buffer,constnet::Address& peerAddress)
public void onTimer(void *)

Members

public Server(ServerObserver& observer,constServerOptions& options)

public virtual ~Server()

public virtual void start()

public virtual void stop()

public void handleRequest(Request& request,AuthenticationState state)

public void handleAuthorizedRequest(Request& request)

public void handleBindingRequest(Request& request)

public void handleAllocateRequest(Request& request)

public void handleConnectionBindRequest(Request& request)

public void respond(Request& request,stun::Message& response)

public void respondError(Request& request,int errorCode,const char * errorDesc)

public ServerAllocationMap allocations() const

public void addAllocation(ServerAllocation* alloc)

public void removeAllocation(ServerAllocation* alloc)

publicServerAllocation* getAllocation(constFiveTuple& tuple)

publicTCPAllocation* getTCPAllocation(const std::uint32_t & connectionID)

public net::TCPSocket::Ptr getTCPSocket(constnet::Address& remoteAddr)

public void releaseTCPSocket(net::Socket* socket)

publicServerObserver& observer()

publicServerOptions& options()

publicnet::UDPSocket& udpSocket()

publicnet::TCPSocket& tcpSocket()

publicTimer& timer()

public void onTCPAcceptConnection(void * sender,const net::TCPSocket::Ptr & sock)

public void onTCPSocketClosed(void * sender)

public void onSocketRecv(void * sender,constMutableBuffer& buffer,constnet::Address& peerAddress)

public void onTimer(void *)

class scy::turn::ServerAllocation

class scy::turn::ServerAllocation
  : public scy::turn::IAllocation

Summary

Members Descriptions
public ServerAllocation(Server& server,constFiveTuple& tuple,const std::string & username,std::int64_t lifetime)
public virtual bool handleRequest(Request& request)
public virtual void handleRefreshRequest(Request& request)
public virtual void handleCreatePermission(Request& request)
public virtual bool onTimer()
public virtual std::int64_t timeRemaining() const
public virtual std::int64_t maxTimeRemaining() const
public virtualServer& server()
public virtual void print(std::ostream & os) const
protected std::uint32_t _maxLifetime
protectedServer& _server
protected virtual ~ServerAllocation()

Members

public ServerAllocation(Server& server,constFiveTuple& tuple,const std::string & username,std::int64_t lifetime)

public virtual bool handleRequest(Request& request)

public virtual void handleRefreshRequest(Request& request)

public virtual void handleCreatePermission(Request& request)

public virtual bool onTimer()

Asynchronous timer callback for updating the allocation permissions and state etc. If this call returns false the allocation will be deleted.

public virtual std::int64_t timeRemaining() const

public virtual std::int64_t maxTimeRemaining() const

public virtualServer& server()

public virtual void print(std::ostream & os) const

protected std::uint32_t _maxLifetime

protectedServer& _server

protected virtual ~ServerAllocation()

IMPORTANT: The destructor should never be called directly as the allocation is deleted via the timer callback. See onTimer()

class scy::turn::TCPAllocation

class scy::turn::TCPAllocation
  : public scy::turn::ServerAllocation

Summary

Members Descriptions
public TCPAllocation(Server& server,const net::Socket::Ptr & control,constFiveTuple& tuple,const std::string & username,const std::uint32_t & lifetime)
public virtual ~TCPAllocation()
public virtual bool handleRequest(Request& request)
public void handleConnectRequest(Request& request)
public void handleConnectionBindRequest(Request& request)
public void sendPeerConnectResponse(TCPConnectionPair* pair,bool success) Sends a Connect request response to control.
public int sendToControl(stun::Message& message)
publicnet::TCPSocket& control()
public virtualnet::AddressrelayedAddress() const
publicTCPConnectionPairMap& pairs()
public virtual bool onTimer()
public void onPeerAccept(void * sender,const net::TCPSocket::Ptr & sock) Accepts incoming peer sockets for ConnectionBind requests.
public void onControlClosed(void * sender)
protected net::TCPSocket::Ptr _control
protected net::TCPSocket::Ptr _acceptor
protectedTCPConnectionPairMap_pairs

Members

public TCPAllocation(Server& server,const net::Socket::Ptr & control,constFiveTuple& tuple,const std::string & username,const std::uint32_t & lifetime)

public virtual ~TCPAllocation()

public virtual bool handleRequest(Request& request)

public void handleConnectRequest(Request& request)

public void handleConnectionBindRequest(Request& request)

public void sendPeerConnectResponse(TCPConnectionPair* pair,bool success)

Sends a Connect request response to control.

public int sendToControl(stun::Message& message)

publicnet::TCPSocket& control()

public virtualnet::AddressrelayedAddress() const

publicTCPConnectionPairMap& pairs()

public virtual bool onTimer()

Asynchronous timer callback for updating the allocation permissions and state etc. If this call returns false the allocation will be deleted.

public void onPeerAccept(void * sender,const net::TCPSocket::Ptr & sock)

Accepts incoming peer sockets for ConnectionBind requests.

public void onControlClosed(void * sender)

Callback for handling controll connection destruction. The allocation will be deleted.

protected net::TCPSocket::Ptr _control

protected net::TCPSocket::Ptr _acceptor

protectedTCPConnectionPairMap_pairs

class scy::turn::TCPClient

class scy::turn::TCPClient
  : public scy::turn::Client

Summary

Members Descriptions
public TCPClient(TCPClientObserver& observer,constClient::Options& options)
public virtual ~TCPClient()
public virtual void initiate() Initiates the allocation sequence.
public virtual void shutdown() Shutdown the client and destroy the active allocation.
public virtual void sendConnectRequest(constnet::Address& peerAddress)
public virtual void sendData(const char * data,std::size_t size,constnet::Address& peerAddress)
public virtual bool handleResponse(conststun::Message& response)
public virtual void handleConnectResponse(conststun::Message& response)
public virtual void handleConnectErrorResponse(conststun::Message& response)
public virtual void handleConnectionBindResponse(conststun::Message& response)
public virtual void handleConnectionBindErrorResponse(conststun::Message& response)
public virtual void handleConnectionAttemptIndication(conststun::Message& response)
public virtual bool createAndBindConnection(std::uint32_t connectionID,constnet::Address& peerAddress)
public virtual void onRelayConnectionConnect(void * sender)
public virtual void onRelayDataReceived(void * sender,constMutableBuffer& buffer,constnet::Address& peerAddress)
public virtual void onRelayConnectionError(void * sender,constError& error)
public virtual void onRelayConnectionClosed(void * sender)
public void freeConnection(constnet::Address& peerAddress)
public virtual int transportProtocol()
publicConnectionManager& connections()
public inline virtual const char * className() const
protectedTCPClientObserver& _observer
protectedConnectionManager_connections

Members

public TCPClient(TCPClientObserver& observer,constClient::Options& options)

public virtual ~TCPClient()

public virtual void initiate()

Initiates the allocation sequence.

public virtual void shutdown()

Shutdown the client and destroy the active allocation.

public virtual void sendConnectRequest(constnet::Address& peerAddress)

public virtual void sendData(const char * data,std::size_t size,constnet::Address& peerAddress)

public virtual bool handleResponse(conststun::Message& response)

public virtual void handleConnectResponse(conststun::Message& response)

public virtual void handleConnectErrorResponse(conststun::Message& response)

public virtual void handleConnectionBindResponse(conststun::Message& response)

public virtual void handleConnectionBindErrorResponse(conststun::Message& response)

public virtual void handleConnectionAttemptIndication(conststun::Message& response)

public virtual bool createAndBindConnection(std::uint32_t connectionID,constnet::Address& peerAddress)

public virtual void onRelayConnectionConnect(void * sender)

public virtual void onRelayDataReceived(void * sender,constMutableBuffer& buffer,constnet::Address& peerAddress)

public virtual void onRelayConnectionError(void * sender,constError& error)

public virtual void onRelayConnectionClosed(void * sender)

public void freeConnection(constnet::Address& peerAddress)

public virtual int transportProtocol()

publicConnectionManager& connections()

public inline virtual const char * className() const

protectedTCPClientObserver& _observer

protectedConnectionManager_connections

class scy::turn::TCPConnectionPair

Summary

Members Descriptions
publicTCPAllocation& allocation
public net::TCPSocket::Ptr client The client socket, nullptr to start.
public net::TCPSocket::Ptr peer The client socket, nullptr to start.
public Buffer earlyPeerData Stores early peer > client data.
public std::uint32_t connectionID The unique connection ID.
public bool isDataConnection True when p2p relay is flowing.
publicTimeouttimeout The ConnectionBind request timeout counter.
public stun::TransactionID transactionID
public TCPConnectionPair(TCPAllocation& allocation)
public virtual ~TCPConnectionPair()
public bool doPeerConnect(constnet::Address& peerAddr)
public bool makeDataConnection()
public void setPeerSocket(const net::TCPSocket::Ptr & socket)
public void setClientSocket(const net::TCPSocket::Ptr & socket)
public void onPeerConnectSuccess(void * sender) Connection success callback for Connect request.
public void onPeerConnectError(void * sender,constError& error) Connection error callback for Connect request.
public void onClientDataReceived(void * sender,constMutableBuffer& buffer,constnet::Address& peerAddress)
public void onPeerDataReceived(void * sender,constMutableBuffer& buffer,constnet::Address& peerAddress)
public void onConnectionClosed(void * sender)
public void startTimeout()
public bool expired() const Return true if the peer ConnectionBind request timed out.

Members

publicTCPAllocation& allocation

public net::TCPSocket::Ptr client

The client socket, nullptr to start.

public net::TCPSocket::Ptr peer

The client socket, nullptr to start.

public Buffer earlyPeerData

Stores early peer > client data.

public std::uint32_t connectionID

The unique connection ID.

public bool isDataConnection

True when p2p relay is flowing.

publicTimeouttimeout

The ConnectionBind request timeout counter.

public stun::TransactionID transactionID

public TCPConnectionPair(TCPAllocation& allocation)

public virtual ~TCPConnectionPair()

public bool doPeerConnect(constnet::Address& peerAddr)

Initiates an outgoing TCP connection to the peer for Connect requests.

public bool makeDataConnection()

Binds the client <> peer relay pipe once the ConnectionBind request is successfull.

public void setPeerSocket(const net::TCPSocket::Ptr & socket)

public void setClientSocket(const net::TCPSocket::Ptr & socket)

public void onPeerConnectSuccess(void * sender)

Connection success callback for Connect request.

public void onPeerConnectError(void * sender,constError& error)

Connection error callback for Connect request.

public void onClientDataReceived(void * sender,constMutableBuffer& buffer,constnet::Address& peerAddress)

public void onPeerDataReceived(void * sender,constMutableBuffer& buffer,constnet::Address& peerAddress)

public void onConnectionClosed(void * sender)

Callback for handing either client or peer connections which result in the destruction of the TCPConnectionPair.

public void startTimeout()

Starts the ConnectionBind request timeout.

If no ConnectionBind request associated with this peer data connection is received after 30 seconds, the peer data connection MUST be closed.

public bool expired() const

Return true if the peer ConnectionBind request timed out.

class scy::turn::UDPAllocation

class scy::turn::UDPAllocation
  : public scy::turn::ServerAllocation

Summary

Members Descriptions
public UDPAllocation(Server& server,constFiveTuple& tuple,const std::string & username,const std::uint32_t & lifetime)
public virtual ~UDPAllocation()
public void onPeerDataReceived(void *,constMutableBuffer& buffer,constnet::Address& peerAddress)
public virtual bool handleRequest(Request& request)
public void handleSendIndication(Request& request)
public int send(const char * data,std::size_t size,constnet::Address& peerAddress)
public virtualnet::AddressrelayedAddress() const

Members

public UDPAllocation(Server& server,constFiveTuple& tuple,const std::string & username,const std::uint32_t & lifetime)

public virtual ~UDPAllocation()

public void onPeerDataReceived(void *,constMutableBuffer& buffer,constnet::Address& peerAddress)

public virtual bool handleRequest(Request& request)

public void handleSendIndication(Request& request)

public int send(const char * data,std::size_t size,constnet::Address& peerAddress)

public virtualnet::AddressrelayedAddress() const

class scy::turn::UDPClient

class scy::turn::UDPClient
  : public scy::turn::Client

Summary

Members Descriptions
public UDPClient(ClientObserver& observer,constOptions& options)
public virtual ~UDPClient()

Members

public UDPClient(ClientObserver& observer,constOptions& options)

public virtual ~UDPClient()

struct scy::turn::ClientObserver

Summary

Members Descriptions
public void onClientStateChange(Client& client,ClientState& state,constClientState& oldState)
public void onRelayDataReceived(Client& client,const char * data,std::size_t size,constnet::Address& peerAddress)
public inline virtual void onAllocationCreated(Client& client,conststun::Transaction& transaction)
public inline virtual void onAllocationFailed(Client& client,int errorCode,const std::string & reason)
public inline virtual void onAllocationDeleted(Client& client,conststun::Transaction& transaction)
public inline virtual void onAllocationPermissionsCreated(Client& client,const PermissionList & permissions)
public inline virtual void onTransactionResponse(Client& client,conststun::Transaction& transaction)
public inline virtual void onTimer(Client& client)

Members

public void onClientStateChange(Client& client,ClientState& state,constClientState& oldState)

public void onRelayDataReceived(Client& client,const char * data,std::size_t size,constnet::Address& peerAddress)

public inline virtual void onAllocationCreated(Client& client,conststun::Transaction& transaction)

public inline virtual void onAllocationFailed(Client& client,int errorCode,const std::string & reason)

public inline virtual void onAllocationDeleted(Client& client,conststun::Transaction& transaction)

public inline virtual void onAllocationPermissionsCreated(Client& client,const PermissionList & permissions)

public inline virtual void onTransactionResponse(Client& client,conststun::Transaction& transaction)

All received transaction responses will be routed here after local processing so the observer can easily implement extra functionality.

public inline virtual void onTimer(Client& client)

Fires after the client's internal timer callback. Handy for performing extra async cleanup tasks.

struct scy::turn::ClientState

struct scy::turn::ClientState
  : public scy::State

Summary

Members Descriptions
public inline virtual std::string toString() const

Members

public inline virtual std::string toString() const

struct scy::turn::Permission

TURN permission for a user session.

Summary

Members Descriptions
public std::string ip
publicTimeouttimeout
public inline Permission(const std::string & ip)
public inline void refresh()
public inline bool operator==(const std::string & r) const

Members

public std::string ip

publicTimeouttimeout

public inline Permission(const std::string & ip)

public inline void refresh()

public inline bool operator==(const std::string & r) const

struct scy::turn::RelayConnectionBinding

Summary

Members Descriptions
public std::uint32_t connectionID
publicnet::AddresspeerAddress

Members

public std::uint32_t connectionID

publicnet::AddresspeerAddress

struct scy::turn::ServerObserver

The ServerObserver receives callbacks for and is responsible for managing allocation and bandwidth quotas, authentication methods and authentication.

Summary

Members Descriptions
public void onServerAllocationCreated(Server* server,IAllocation* alloc)
public void onServerAllocationRemoved(Server* server,IAllocation* alloc)
public AuthenticationState authenticateRequest(Server* server,Request& request)

Members

public void onServerAllocationCreated(Server* server,IAllocation* alloc)

public void onServerAllocationRemoved(Server* server,IAllocation* alloc)

public AuthenticationState authenticateRequest(Server* server,Request& request)

The observer class can implement authentication using the long-term credential mechanism of [RFC5389]. The class design is such that authentication can be preformed asynchronously against a remote database, or locally. The default implementation returns true to all requests.

To mitigate either intentional or unintentional denial-of-service attacks against the server by clients with valid usernames and passwords, it is RECOMMENDED that the server impose limits on both the number of allocations active at one time for a given username and on the amount of bandwidth those allocations can use. The server should reject new allocations that would exceed the limit on the allowed number of allocations active at one time with a 486 (Allocation Quota Exceeded) (see Section 6.2), and should discard application data traffic that exceeds the bandwidth quota.

struct scy::turn::ServerOptions

Configuration options for the TURN server.

Summary

Members Descriptions
public std::string software
public std::string realm
public std::uint32_t allocationDefaultLifetime
public std::uint32_t allocationMaxLifetime
public int allocationMaxPermissions
public int timerInterval
public int earlyMediaBufferSize
publicnet::AddresslistenAddr The TCP and UDP bind() address.
public std::string externalIP The external public facing IP address of the server.
public bool enableTCP
public bool enableUDP
public inline ServerOptions()

Members

public std::string software

public std::string realm

public std::uint32_t allocationDefaultLifetime

public std::uint32_t allocationMaxLifetime

public int allocationMaxPermissions

public int timerInterval

public int earlyMediaBufferSize

publicnet::AddresslistenAddr

The TCP and UDP bind() address.

public std::string externalIP

The external public facing IP address of the server.

public bool enableTCP

public bool enableUDP

public inline ServerOptions()

struct scy::turn::TCPClientObserver

struct scy::turn::TCPClientObserver
  : public scy::turn::ClientObserver

Summary

Members Descriptions
public inline virtual void onRelayConnectionCreated(TCPClient& client,const net::TCPSocket::Ptr & socket,constnet::Address& peerAddress)
public inline virtual void onRelayConnectionError(TCPClient& client,const net::TCPSocket::Ptr & socket,constnet::Address& peerAddress)
public inline virtual void onRelayConnectionClosed(TCPClient& client,const net::TCPSocket::Ptr & socket,constnet::Address& peerAddress)
public inline virtual void onRelayConnectionBindingFailed(TCPClient& client,constnet::Address& peerAddress)
public inline virtual bool onPeerConnectionAttempt(TCPClient& client,constnet::Address& peerAddress)

Members

public inline virtual void onRelayConnectionCreated(TCPClient& client,const net::TCPSocket::Ptr & socket,constnet::Address& peerAddress)

public inline virtual void onRelayConnectionError(TCPClient& client,const net::TCPSocket::Ptr & socket,constnet::Address& peerAddress)

public inline virtual void onRelayConnectionClosed(TCPClient& client,const net::TCPSocket::Ptr & socket,constnet::Address& peerAddress)

public inline virtual void onRelayConnectionBindingFailed(TCPClient& client,constnet::Address& peerAddress)

public inline virtual bool onPeerConnectionAttempt(TCPClient& client,constnet::Address& peerAddress)

results matching ""

    No results matching ""