TURN module (rfc5766)

ClientObserver

Abstract observer interface for TURN client events.

#include <icy/turn/client/client.h>

struct ClientObserver

Defined in src/turn/include/icy/turn/client/client.h:69

Subclassed by
TCPClientObserver

Abstract observer interface for TURN client events. Callers subclass this to receive allocation lifecycle and data relay callbacks.

Public Methods

ReturnNameDescription
voidonClientStateChange virtualCalled whenever the client's state machine transitions to a new state.
voidonRelayDataReceived virtualCalled when relayed data is received from a peer via a Data Indication.
voidonAllocationFailed virtual inlineCalled when the server rejects an Allocate request with an error.
voidonAllocationDeleted virtual inlineCalled when the server confirms deletion of the allocation.
voidonAllocationPermissionsCreated virtual inlineCalled after a CreatePermission request succeeds.
voidonTransactionResponse virtual inlineAll received transaction responses will be routed here after local processing so the observer can easily implement extra functionality.
voidonTimer virtual inlineFires after the client's internal timer callback. Handy for performing extra async cleanup tasks.

onClientStateChange

virtual

virtual void onClientStateChange(Client & client, ClientState & state, const ClientState & oldState)

Defined in src/turn/include/icy/turn/client/client.h:75

Called whenever the client's state machine transitions to a new state.

Parameters

ParameterTypeDescription
clientClient &The client that changed state.
stateClientState &The new state.
oldStateconst ClientState &The previous state.

onRelayDataReceived

virtual

virtual void onRelayDataReceived(Client & client, const char * data, size_t size, const net::Address & peerAddress)

Defined in src/turn/include/icy/turn/client/client.h:82

Called when relayed data is received from a peer via a Data Indication.

Parameters

ParameterTypeDescription
clientClient &The owning client.
dataconst char *Pointer to the received payload bytes.
sizesize_tNumber of bytes in data.
peerAddressconst net::Address &Source address of the remote peer.

onAllocationFailed

virtual inline

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

Defined in src/turn/include/icy/turn/client/client.h:88

Called when the server rejects an Allocate request with an error.

Parameters

ParameterTypeDescription
clientClient &The owning client.
errorCodeintSTUN error code (e.g. 401, 438).
reasonconst std::string &Human-readable error reason string.

onAllocationDeleted

virtual inline

virtual inline void onAllocationDeleted(Client & client, const stun::Transaction & transaction)

Defined in src/turn/include/icy/turn/client/client.h:93

Called when the server confirms deletion of the allocation.

Parameters

ParameterTypeDescription
clientClient &The owning client.
transactionconst stun::Transaction &The completed Refresh transaction (lifetime == 0).

onAllocationPermissionsCreated

virtual inline

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

Defined in src/turn/include/icy/turn/client/client.h:98

Called after a CreatePermission request succeeds.

Parameters

ParameterTypeDescription
clientClient &The owning client.
permissionsconst PermissionList &The full list of active permissions after this update.

onTransactionResponse

virtual inline

virtual inline void onTransactionResponse(Client & client, const stun::Transaction & transaction)

Defined in src/turn/include/icy/turn/client/client.h:104

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

Parameters

ParameterTypeDescription
clientClient &The owning client.
transactionconst stun::Transaction &The completed transaction (request + response accessible).

onTimer

virtual inline

virtual inline void onTimer(Client & client)

Defined in src/turn/include/icy/turn/client/client.h:109

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

Parameters

ParameterTypeDescription
clientClient &The owning client.