Client
#include <icy/turn/client/client.h>
class ClientDefined in src/turn/include/icy/turn/client/client.h:124
- Inherits
Stateful< ClientState >,IAllocation
List of all members
| Name | Kind | Owner |
|---|---|---|
Client | function | Declared here |
~Client | function | Declared here |
start | function | Declared here |
stop | function | Declared here |
sendAllocate | function | Declared here |
addPermission | function | Declared here |
addPermission | function | Declared here |
sendCreatePermission | function | Declared here |
sendChannelBind | function | Declared here |
sendRefresh | function | Declared here |
sendData | function | Declared here |
handleResponse | function | Declared here |
handleAllocateResponse | function | Declared here |
handleAllocateErrorResponse | function | Declared here |
handleCreatePermissionResponse | function | Declared here |
handleCreatePermissionErrorResponse | function | Declared here |
handleRefreshResponse | function | Declared here |
handleDataIndication | function | Declared here |
transportProtocol | function | Declared here |
createTransaction | function | Declared here |
authenticateRequest | function | Declared here |
sendAuthenticatedTransaction | function | Declared here |
removeTransaction | function | Declared here |
mappedAddress | function | Declared here |
relayedAddress | function | Declared here |
closed | function | Declared here |
observer | function | Declared here |
options | function | Declared here |
addPermission | function | Declared here |
addPermission | function | Declared here |
hasPermission | function | Declared here |
hasPermission | function | Declared here |
removePermission | function | Declared here |
removePermission | function | Declared here |
_observer | variable | Declared here |
_options | variable | Declared here |
_socket | variable | Declared here |
_timer | variable | Declared here |
_error | variable | Declared here |
_mappedAddress | variable | Declared here |
_relayedAddress | variable | Declared here |
_realm | variable | Declared here |
_nonce | variable | Declared here |
_pendingIndications | variable | Declared here |
_transactions | variable | Declared here |
setError | function | Declared here |
onSocketConnect | function | Declared here |
onSocketRecv | function | Declared here |
onSocketClose | function | Declared here |
onTransactionProgress | function | Declared here |
onStateChange | function | Declared here |
onTimer | function | Declared here |
StateChange | variable | Inherited from Stateful |
Stateful | function | Inherited from Stateful |
~Stateful | function | Inherited from Stateful |
stateEquals | function | Inherited from Stateful |
stateBetween | function | Inherited from Stateful |
state | function | Inherited from Stateful |
state | function | Inherited from Stateful |
_state | variable | Inherited from Stateful |
beforeStateChange | function | Inherited from Stateful |
onStateChange | function | Inherited from Stateful |
setState | function | Inherited from Stateful |
setState | function | Inherited from Stateful |
operator<< | friend | Inherited from IAllocation |
IAllocation | function | Inherited from IAllocation |
~IAllocation | function | Inherited from IAllocation |
IAllocation | function | Inherited from IAllocation |
operator= | function | Inherited from IAllocation |
IAllocation | function | Inherited from IAllocation |
operator= | function | Inherited from IAllocation |
updateUsage | function | Inherited from IAllocation |
setLifetime | function | Inherited from IAllocation |
setBandwidthLimit | function | Inherited from IAllocation |
expired | function | Inherited from IAllocation |
deleted | function | Inherited from IAllocation |
bandwidthLimit | function | Inherited from IAllocation |
bandwidthUsed | function | Inherited from IAllocation |
bandwidthRemaining | function | Inherited from IAllocation |
timeRemaining | function | Inherited from IAllocation |
tuple | function | Inherited from IAllocation |
username | function | Inherited from IAllocation |
lifetime | function | Inherited from IAllocation |
permissions | function | Inherited from IAllocation |
relayedAddress | function | Inherited from IAllocation |
addPermission | function | Inherited from IAllocation |
addPermission | function | Inherited from IAllocation |
addPermissions | function | Inherited from IAllocation |
removePermission | function | Inherited from IAllocation |
removePermission | function | Inherited from IAllocation |
removeAllPermissions | function | Inherited from IAllocation |
removeExpiredPermissions | function | Inherited from IAllocation |
hasPermission | function | Inherited from IAllocation |
hasPermission | function | Inherited from IAllocation |
print | function | Inherited from IAllocation |
_tuple | variable | Inherited from IAllocation |
_username | variable | Inherited from IAllocation |
_permissions | variable | Inherited from IAllocation |
_lifetime | variable | Inherited from IAllocation |
_bandwidthLimit | variable | Inherited from IAllocation |
_bandwidthUsed | variable | Inherited from IAllocation |
_createdAt | variable | Inherited from IAllocation |
_updatedAt | variable | Inherited from IAllocation |
_deleted | variable | Inherited from IAllocation |
Inherited from Stateful
| Kind | Name | Description |
|---|---|---|
variable | StateChange | Signals when the state changes. |
function | Stateful inline | |
function | ~Stateful virtual inline | |
function | stateEquals virtual const inline | Returns true if the current state ID equals the given ID. |
function | stateBetween virtual const inline | Returns true if the current state ID is in the inclusive range [lid, rid]. |
function | state virtual inline | Returns a mutable reference to the current state. |
function | state virtual const inline | Returns a copy of the current state. |
variable | _state | |
function | beforeStateChange virtual inline | Override to handle pre state change logic. Return false to prevent state change. |
function | onStateChange virtual inline | Override to handle post state change logic. |
function | setState virtual inline | Sets the state and sends the state signal if the state change was successful. |
function | setState virtual inline | Sets the state and sends the state signal if the state change was successful. |
Inherited from IAllocation
| Kind | Name | Description |
|---|---|---|
friend | operator<< inline | |
function | IAllocation | |
function | ~IAllocation virtual | |
function | IAllocation | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | IAllocation | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | updateUsage virtual | Updates the last-activity timestamp and accumulates bandwidth usage. Call this whenever data is relayed through the allocation. |
function | setLifetime virtual | Sets the allocation lifetime in seconds and resets the activity timestamp, effectively extending the expiry from the current moment. |
function | setBandwidthLimit virtual | Sets the maximum number of bytes this allocation may relay in its lifetime. Pass 0 to disable bandwidth limiting. |
function | expired virtual const | |
function | deleted virtual const | Returns true if the allocation's deleted flag is set and or if the allocation has expired. |
function | bandwidthLimit virtual const | |
function | bandwidthUsed virtual const | |
function | bandwidthRemaining virtual const | |
function | timeRemaining virtual const | |
function | tuple virtual | |
function | username virtual const | |
function | lifetime virtual const | |
function | permissions virtual const | |
function | relayedAddress virtual const | |
function | addPermission virtual | Adds a permission for ip, or refreshes the existing one. |
function | addPermission virtual | Adds a permission for address, or refreshes the existing one. The port is ignored; TURN permissions are IP-only. |
function | addPermissions virtual | Adds (or refreshes) permissions for multiple IPs. |
function | removePermission virtual | Removes the permission for ip if present. |
function | removePermission virtual | Removes the permission for address if present. The port is ignored; TURN permissions are IP-only. |
function | removeAllPermissions virtual | Removes all permissions from the list. |
function | removeExpiredPermissions virtual | Removes any permissions whose 5-minute lifetime has elapsed. |
function | hasPermission virtual | Checks whether a permission exists for peerIP. Local addresses (192.168.x.x and 127.x.x.x) are always permitted. |
function | hasPermission virtual | Checks whether a permission exists for peerAddress. The port is ignored; TURN permissions are IP-only. |
function | print virtual const inline | |
variable | _tuple | |
variable | _username | |
variable | _permissions | |
variable | _lifetime | |
variable | _bandwidthLimit | |
variable | _bandwidthUsed | |
variable | _createdAt | |
variable | _updatedAt | |
variable | _deleted |
Public Methods
| Return | Name | Description |
|---|---|---|
Client | ||
~Client virtual | ||
void | start virtual | Connects the socket to the TURN server and starts the allocation sequence. Permissions must be added via addPermission() before calling this. |
void | stop virtual | Stops the timer, cancels pending transactions, and closes the socket. |
void | sendAllocate virtual | Sends an Allocate request to the server with the configured transport and lifetime. On first call the server will typically respond with a 401 challenge; the client re-sends with credentials automatically. |
void | addPermission virtual | Adds multiple peer IP addresses to the permission list. |
void | addPermission virtual override | Adds a single peer IP to the permission list, or refreshes it if already present. Permissions should be added before start(); they may also be added later, in which case a new CreatePermission request is required. |
void | sendCreatePermission virtual | Sends a CreatePermission request for all IPs currently in the permission list. Called automatically after allocation succeeds and periodically by the timer to refresh expiring permissions. |
void | sendChannelBind virtual | Channel bindings (RFC 5766 Section 11) are intentionally not implemented. They are a bandwidth optimization that replaces STUN-framed Send/Data indications with a compact 4-byte ChannelData header. This only benefits high-throughput media relay scenarios; in practice, media flows directly via ICE/DTLS rather than through this TURN client's data path, so the optimization is not worth the complexity (channel number allocation, 10-minute binding refresh timers, ChannelData wire framing). Data relay uses sendData() with Send Indications instead. |
void | sendRefresh virtual | Sends a Refresh request to extend the allocation lifetime. Called automatically by the timer when roughly one-third of the lifetime remains. |
void | sendData virtual | Sends a Send Indication to relay data to peerAddress through the TURN server. If permissions are still being negotiated the indication is queued and flushed once CreatePermission succeeds. |
bool | handleResponse virtual | Dispatches an incoming STUN/TURN response to the appropriate handler. |
void | handleAllocateResponse virtual | Processes a successful Allocate response; extracts mapped/relayed addresses and advances the state to Authorizing, then sends CreatePermission. |
void | handleAllocateErrorResponse virtual | Handles an Allocate error response; manages the 401 challenge/re-send flow and sets the client to Failed for unrecoverable errors. |
void | handleCreatePermissionResponse virtual | Handles a successful CreatePermission response; flushes queued Send Indications and advances state to Success. |
void | handleCreatePermissionErrorResponse virtual | Handles a failed CreatePermission response; clears all permissions and sets the client to Failed. |
void | handleRefreshResponse virtual | Handles a Refresh response; updates the stored lifetime. |
void | handleDataIndication virtual | Handles an incoming Data Indication; extracts peer address and data and forwards to ClientObserver::onRelayDataReceived(). |
int | transportProtocol virtual | |
stun::Transaction::Ptr | createTransaction virtual | Creates a new STUN transaction, registers the progress callback, and adds it to the active transaction list. |
void | authenticateRequest virtual | Adds STUN long-term credential attributes (Username, Realm, Nonce, MessageIntegrity) to request if the realm has been received from the server. |
bool | sendAuthenticatedTransaction virtual | Calls authenticateRequest() then sends the transaction. |
stun::Transaction::Ptr | removeTransaction virtual | Removes a transaction from the active list. The IntrusivePtr keeps the object alive until the caller's copy is released. |
net::Address | mappedAddress const | |
net::Address | relayedAddress virtual const override | |
bool | closed const | |
ClientObserver & | observer | |
const Options & | options const | |
void | addPermission virtual | Adds a permission for ip, or refreshes the existing one. |
void | addPermission virtual | Adds a permission for address, or refreshes the existing one. The port is ignored; TURN permissions are IP-only. |
bool | hasPermission virtual | Checks whether a permission exists for peerIP. Local addresses (192.168.x.x and 127.x.x.x) are always permitted. |
bool | hasPermission virtual | Checks whether a permission exists for peerAddress. The port is ignored; TURN permissions are IP-only. |
void | removePermission virtual | Removes the permission for ip if present. |
void | removePermission virtual | Removes the permission for address if present. The port is ignored; TURN permissions are IP-only. |
Client
Client(ClientObserver & observer, const Options & options, const net::Socket::Ptr & socket)Defined in src/turn/include/icy/turn/client/client.h:161
Parameters
| Parameter | Type | Description |
|---|---|---|
observer | ClientObserver & | Observer to receive lifecycle and data callbacks. |
options | const Options & | Configuration for this client instance. |
socket | const net::Socket::Ptr & | Underlying transport socket (TCP or UDP). |
~Client
virtual
virtual ~Client()Defined in src/turn/include/icy/turn/client/client.h:162
start
virtual
virtual void start()Defined in src/turn/include/icy/turn/client/client.h:166
Connects the socket to the TURN server and starts the allocation sequence. Permissions must be added via addPermission() before calling this.
Reimplemented by
stop
virtual
virtual void stop()Defined in src/turn/include/icy/turn/client/client.h:169
Stops the timer, cancels pending transactions, and closes the socket.
Reimplemented by
sendAllocate
virtual
virtual void sendAllocate()Defined in src/turn/include/icy/turn/client/client.h:175
Sends an Allocate request to the server with the configured transport and lifetime. On first call the server will typically respond with a 401 challenge; the client re-sends with credentials automatically.
addPermission
virtual
virtual void addPermission(const IPList & peerIPs)Defined in src/turn/include/icy/turn/client/client.h:179
Adds multiple peer IP addresses to the permission list.
Parameters
| Parameter | Type | Description |
|---|---|---|
peerIPs | const IPList & | List of IPv4 address strings to permit. |
addPermission
virtual override
virtual void addPermission(const std::string & ip) overrideDefined in src/turn/include/icy/turn/client/client.h:186
Adds a single peer IP to the permission list, or refreshes it if already present. Permissions should be added before start(); they may also be added later, in which case a new CreatePermission request is required.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
ip | const std::string & | IPv4 address string of the permitted peer. |
sendCreatePermission
virtual
virtual void sendCreatePermission()Defined in src/turn/include/icy/turn/client/client.h:191
Sends a CreatePermission request for all IPs currently in the permission list. Called automatically after allocation succeeds and periodically by the timer to refresh expiring permissions.
sendChannelBind
virtual
virtual void sendChannelBind(const std::string & peerIP)Defined in src/turn/include/icy/turn/client/client.h:202
Channel bindings (RFC 5766 Section 11) are intentionally not implemented. They are a bandwidth optimization that replaces STUN-framed Send/Data indications with a compact 4-byte ChannelData header. This only benefits high-throughput media relay scenarios; in practice, media flows directly via ICE/DTLS rather than through this TURN client's data path, so the optimization is not worth the complexity (channel number allocation, 10-minute binding refresh timers, ChannelData wire framing). Data relay uses sendData() with Send Indications instead.
Parameters
| Parameter | Type | Description |
|---|---|---|
peerIP | const std::string & | Unused; always throws std::logic_error. |
sendRefresh
virtual
virtual void sendRefresh()Defined in src/turn/include/icy/turn/client/client.h:207
Sends a Refresh request to extend the allocation lifetime. Called automatically by the timer when roughly one-third of the lifetime remains.
sendData
virtual
virtual void sendData(const char * data, size_t size, const net::Address & peerAddress)Defined in src/turn/include/icy/turn/client/client.h:215
Sends a Send Indication to relay data to peerAddress through the TURN server. If permissions are still being negotiated the indication is queued and flushed once CreatePermission succeeds.
Reimplemented by
Parameters
| Parameter | Type | Description |
|---|---|---|
data | const char * | Pointer to the payload to relay. |
size | size_t | Number of bytes to relay. |
peerAddress | const net::Address & | Destination peer address (must have an active permission). |
handleResponse
virtual
virtual bool handleResponse(const stun::Message & response)Defined in src/turn/include/icy/turn/client/client.h:220
Dispatches an incoming STUN/TURN response to the appropriate handler.
Returns
true if the message was handled, false if it was unrecognised.
Reimplemented by
Parameters
| Parameter | Type | Description |
|---|---|---|
response | const stun::Message & | Received STUN message. |
handleAllocateResponse
virtual
virtual void handleAllocateResponse(const stun::Message & response)Defined in src/turn/include/icy/turn/client/client.h:225
Processes a successful Allocate response; extracts mapped/relayed addresses and advances the state to Authorizing, then sends CreatePermission.
Parameters
| Parameter | Type | Description |
|---|---|---|
response | const stun::Message & | Allocate success response from the server. |
handleAllocateErrorResponse
virtual
virtual void handleAllocateErrorResponse(const stun::Message & response)Defined in src/turn/include/icy/turn/client/client.h:230
Handles an Allocate error response; manages the 401 challenge/re-send flow and sets the client to Failed for unrecoverable errors.
Parameters
| Parameter | Type | Description |
|---|---|---|
response | const stun::Message & | Allocate error response from the server. |
handleCreatePermissionResponse
virtual
virtual void handleCreatePermissionResponse(const stun::Message & response)Defined in src/turn/include/icy/turn/client/client.h:235
Handles a successful CreatePermission response; flushes queued Send Indications and advances state to Success.
Parameters
| Parameter | Type | Description |
|---|---|---|
response | const stun::Message & | CreatePermission success response from the server. |
handleCreatePermissionErrorResponse
virtual
virtual void handleCreatePermissionErrorResponse(const stun::Message & response)Defined in src/turn/include/icy/turn/client/client.h:240
Handles a failed CreatePermission response; clears all permissions and sets the client to Failed.
Parameters
| Parameter | Type | Description |
|---|---|---|
response | const stun::Message & | CreatePermission error response from the server. |
handleRefreshResponse
virtual
virtual void handleRefreshResponse(const stun::Message & response)Defined in src/turn/include/icy/turn/client/client.h:244
Handles a Refresh response; updates the stored lifetime.
Parameters
| Parameter | Type | Description |
|---|---|---|
response | const stun::Message & | Refresh response from the server. |
handleDataIndication
virtual
virtual void handleDataIndication(const stun::Message & response)Defined in src/turn/include/icy/turn/client/client.h:249
Handles an incoming Data Indication; extracts peer address and data and forwards to ClientObserver::onRelayDataReceived().
Parameters
| Parameter | Type | Description |
|---|---|---|
response | const stun::Message & | Data Indication message from the server. |
transportProtocol
virtual
virtual int transportProtocol()Defined in src/turn/include/icy/turn/client/client.h:253
Returns
The IANA protocol number for the underlying transport (kProtocolUDP or kProtocolTCP).
Reimplemented by
createTransaction
virtual
virtual stun::Transaction::Ptr createTransaction(const net::Socket::Ptr & socket = nullptr)Defined in src/turn/include/icy/turn/client/client.h:259
Creates a new STUN transaction, registers the progress callback, and adds it to the active transaction list.
Returns
IntrusivePtr to the new transaction.
Parameters
| Parameter | Type | Description |
|---|---|---|
socket | const net::Socket::Ptr & | Optional override socket; uses the control socket if nullptr. |
authenticateRequest
virtual
virtual void authenticateRequest(stun::Message & request)Defined in src/turn/include/icy/turn/client/client.h:264
Adds STUN long-term credential attributes (Username, Realm, Nonce, MessageIntegrity) to request if the realm has been received from the server.
Parameters
| Parameter | Type | Description |
|---|---|---|
request | stun::Message & | Message to decorate with authentication attributes. |
sendAuthenticatedTransaction
virtual
virtual bool sendAuthenticatedTransaction(stun::Transaction * transaction)Defined in src/turn/include/icy/turn/client/client.h:269
Calls authenticateRequest() then sends the transaction.
Returns
true if the send succeeded.
Parameters
| Parameter | Type | Description |
|---|---|---|
transaction | stun::Transaction * | Transaction whose request to authenticate and send. |
removeTransaction
virtual
virtual stun::Transaction::Ptr removeTransaction(stun::Transaction * transaction)Defined in src/turn/include/icy/turn/client/client.h:275
Removes a transaction from the active list. The IntrusivePtr keeps the object alive until the caller's copy is released.
Returns
The removed Ptr, or nullptr if not found.
Parameters
| Parameter | Type | Description |
|---|---|---|
transaction | stun::Transaction * | Transaction to remove. |
mappedAddress
const
net::Address mappedAddress() constDefined in src/turn/include/icy/turn/client/client.h:278
Returns
The server-reflexive (mapped) address assigned by the TURN server.
relayedAddress
virtual const override
virtual net::Address relayedAddress() const overrideDefined in src/turn/include/icy/turn/client/client.h:281
Returns
The relayed transport address assigned by the TURN server.
Reimplements
closed
const
bool closed() constDefined in src/turn/include/icy/turn/client/client.h:284
Returns
true when the client is in the None or Failed state.
observer
ClientObserver & observer()Defined in src/turn/include/icy/turn/client/client.h:287
Returns
Reference to the observer provided at construction.
options
const
const Options & options() constDefined in src/turn/include/icy/turn/client/client.h:290
Returns
Reference to the immutable options struct.
addPermission
virtual
virtual void addPermission(const std::string & ip)Defined in src/turn/include/icy/turn/client/client.h:154
Adds a permission for ip, or refreshes the existing one.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
ip | const std::string & | IPv4 address string to permit. |
addPermission
virtual
virtual void addPermission(const net::Address & address)Defined in src/turn/include/icy/turn/client/client.h:154
Adds a permission for address, or refreshes the existing one. The port is ignored; TURN permissions are IP-only.
Reimplements
hasPermission
virtual
virtual bool hasPermission(const std::string & peerIP)Defined in src/turn/include/icy/turn/client/client.h:155
Checks whether a permission exists for peerIP. Local addresses (192.168.x.x and 127.x.x.x) are always permitted.
Returns
true if a valid (non-expired) permission exists.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
peerIP | const std::string & | IPv4 address string to check. |
hasPermission
virtual
virtual bool hasPermission(const net::Address & peerAddress)Defined in src/turn/include/icy/turn/client/client.h:155
Checks whether a permission exists for peerAddress. The port is ignored; TURN permissions are IP-only.
Reimplements
removePermission
virtual
virtual void removePermission(const std::string & ip)Defined in src/turn/include/icy/turn/client/client.h:156
Removes the permission for ip if present.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
ip | const std::string & | IPv4 address string to remove. |
removePermission
virtual
virtual void removePermission(const net::Address & address)Defined in src/turn/include/icy/turn/client/client.h:156
Removes the permission for address if present. The port is ignored; TURN permissions are IP-only.
Reimplements
Protected Attributes
| Return | Name | Description |
|---|---|---|
ClientObserver & | _observer | |
Options | _options | |
net::SocketEmitter | _socket | |
Timer | _timer | |
icy::Error | _error | |
net::Address | _mappedAddress | |
net::Address | _relayedAddress | |
std::string | _realm | |
std::string | _nonce | |
std::deque< stun::Message > | _pendingIndications | A list of queued Send indication packets awaiting server permissions. |
std::vector< stun::Transaction::Ptr > | _transactions | A list containing currently active transactions. |
_observer
ClientObserver & _observerType: ClientObserver &
Defined in src/turn/include/icy/turn/client/client.h:324
_options
Options _optionsType: Options
Defined in src/turn/include/icy/turn/client/client.h:325
_socket
net::SocketEmitter _socketType: net::SocketEmitter
Defined in src/turn/include/icy/turn/client/client.h:326
_timer
Timer _timerType: Timer
Defined in src/turn/include/icy/turn/client/client.h:327
_error
icy::Error _errorType: icy::Error
Defined in src/turn/include/icy/turn/client/client.h:328
_mappedAddress
net::Address _mappedAddressType: net::Address
Defined in src/turn/include/icy/turn/client/client.h:329
_relayedAddress
net::Address _relayedAddressType: net::Address
Defined in src/turn/include/icy/turn/client/client.h:330
_realm
std::string _realmDefined in src/turn/include/icy/turn/client/client.h:332
_nonce
std::string _nonceDefined in src/turn/include/icy/turn/client/client.h:333
_pendingIndications
std::deque< stun::Message > _pendingIndicationsType: std::deque< stun::Message >
Defined in src/turn/include/icy/turn/client/client.h:336
A list of queued Send indication packets awaiting server permissions.
_transactions
std::vector< stun::Transaction::Ptr > _transactionsType: std::vector< stun::Transaction::Ptr >
Defined in src/turn/include/icy/turn/client/client.h:339
A list containing currently active transactions.
Protected Methods
| Return | Name | Description |
|---|---|---|
void | setError virtual | Sets the error field and transitions the client to the Failed state. |
bool | onSocketConnect virtual | Socket connect callback; starts the timer and sends the first Allocate request. |
bool | onSocketRecv virtual | Socket receive callback; parses STUN messages from the buffer and dispatches them. |
bool | onSocketClose virtual | Socket close callback; shuts down the client and records the socket error. |
void | onTransactionProgress virtual | STUN transaction state-change callback; handles Success and Failed outcomes. |
void | onStateChange override | Forwards state-change events to the observer. |
void | onTimer virtual | Periodic timer callback; re-allocates on expiry or refreshes when lifetime is below one-third remaining. Also calls ClientObserver::onTimer(). |
setError
virtual
virtual void setError(const icy::Error & error)Defined in src/turn/include/icy/turn/client/client.h:295
Sets the error field and transitions the client to the Failed state.
Parameters
| Parameter | Type | Description |
|---|---|---|
error | const icy::Error & | Error descriptor. |
onSocketConnect
virtual
virtual bool onSocketConnect(net::Socket & socket)Defined in src/turn/include/icy/turn/client/client.h:299
Socket connect callback; starts the timer and sends the first Allocate request.
Parameters
| Parameter | Type | Description |
|---|---|---|
socket | net::Socket & | The connected socket. |
onSocketRecv
virtual
virtual bool onSocketRecv(net::Socket & socket, const MutableBuffer & buffer, const net::Address & peerAddress)Defined in src/turn/include/icy/turn/client/client.h:305
Socket receive callback; parses STUN messages from the buffer and dispatches them.
Parameters
| Parameter | Type | Description |
|---|---|---|
socket | net::Socket & | The receiving socket. |
buffer | const MutableBuffer & | Received data. |
peerAddress | const net::Address & | Source address of the received data. |
onSocketClose
virtual
virtual bool onSocketClose(net::Socket & socket)Defined in src/turn/include/icy/turn/client/client.h:309
Socket close callback; shuts down the client and records the socket error.
Parameters
| Parameter | Type | Description |
|---|---|---|
socket | net::Socket & | The closed socket. |
onTransactionProgress
virtual
virtual void onTransactionProgress(void * sender, TransactionState & state, const TransactionState &)Defined in src/turn/include/icy/turn/client/client.h:314
STUN transaction state-change callback; handles Success and Failed outcomes.
Parameters
| Parameter | Type | Description |
|---|---|---|
sender | void * | Pointer to the stun::Transaction that changed state. |
state | TransactionState & | The new transaction state. |
onStateChange
override
void onStateChange(ClientState & state, const ClientState & oldState) overrideDefined in src/turn/include/icy/turn/client/client.h:317
Forwards state-change events to the observer.
onTimer
virtual
virtual void onTimer()Defined in src/turn/include/icy/turn/client/client.h:321
Periodic timer callback; re-allocates on expiry or refreshes when lifetime is below one-third remaining. Also calls ClientObserver::onTimer().
