TURN module (rfc5766)

TCPClientObserver

Observer interface for TCP TURN client events (RFC 6062).

TCPClientObserver

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

Inherits: ClientObserver

Observer interface for TCP TURN client events (RFC 6062). Extends ClientObserver with callbacks specific to TCP relay connections.

Public Methods

ReturnNameDescription
voidonRelayConnectionCreatedCalled when a ConnectionBind succeeds and the relay pipe is live.
voidonRelayConnectionError virtual inlineCalled when an error occurs on a relay connection socket.
voidonRelayConnectionClosedCalled when a relay connection socket is closed.
voidonRelayConnectionBindingFailed virtual inlineCalled when a Connect request (client-initiated) or a ConnectionBind handshake fails for the given peer.
boolonPeerConnectionAttempt virtual inlineCalled when the server sends a ConnectionAttempt indication indicating that a remote peer wants to connect. Return true to accept the connection (proceeds with ConnectionBind), or false to reject it.

onRelayConnectionCreated

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

Called when a ConnectionBind succeeds and the relay pipe is live.

Parameters

  • client The owning TCP client.

  • socket The TCP socket that is now connected to the TURN server and ready for direct data transfer to/from the peer.

  • peerAddress The remote peer address associated with this connection.


onRelayConnectionError

virtual inline

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

Called when an error occurs on a relay connection socket.

Parameters

  • client The owning TCP client.

  • socket The affected socket.

  • peerAddress The remote peer address for this connection.


onRelayConnectionClosed

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

Called when a relay connection socket is closed.

Parameters

  • client The owning TCP client.

  • socket The closed socket.

  • peerAddress The remote peer address for this connection.


onRelayConnectionBindingFailed

virtual inline

virtual inline void onRelayConnectionBindingFailed(TCPClient & client, const net::Address & peerAddress)

Called when a Connect request (client-initiated) or a ConnectionBind handshake fails for the given peer.

Parameters

  • client The owning TCP client.

  • peerAddress The peer address whose binding failed.


onPeerConnectionAttempt

virtual inline

virtual inline bool onPeerConnectionAttempt(TCPClient & client, const net::Address & peerAddress)

Called when the server sends a ConnectionAttempt indication indicating that a remote peer wants to connect. Return true to accept the connection (proceeds with ConnectionBind), or false to reject it.

Parameters

  • client The owning TCP client.

  • peerAddress The address of the connecting peer.

Returns

true to accept and bind, false to ignore.