Transaction
Transaction
#include <icy/stun/transaction.h>Inherits:
Transaction< Message >
STUN request/response transaction with timeout and retry logic. Extends the generic net::Transaction with STUN-specific transaction ID matching and response class inference (Success, Error, or Indication).
Lifetime is managed by IntrusivePtr. Create via makeIntrusive or wrap in IntrusivePtr immediately after construction.
Public Methods
| Return | Name | Description |
|---|---|---|
Transaction | Constructs a STUN transaction bound to a specific socket and peer. | |
bool | checkResponse | Checks that message is a valid response for the pending request. In addition to the base class check, verifies that the transaction IDs match. |
void | onResponse virtual | Called when a valid response is received. Infers the response class (SuccessResponse, ErrorResponse, or Indication) from the response attributes and delegates to the base class handler. |
Transaction
Transaction(const net::Socket::Ptr & socket, const net::Address & peerAddress, long timeout, int retries)Constructs a STUN transaction bound to a specific socket and peer.
Parameters
socketSocket used to send the request and receive the response.peerAddressRemote address of the STUN/TURN server.timeoutResponse timeout in milliseconds (default 10 s).retriesNumber of send retries before declaring failure (default 1).
checkResponse
bool checkResponse(const Message & message)Checks that message is a valid response for the pending request. In addition to the base class check, verifies that the transaction IDs match.
Parameters
messageIncoming STUN message to evaluate.
Returns
true if message is the expected response.
onResponse
virtual
virtual void onResponse()Called when a valid response is received. Infers the response class (SuccessResponse, ErrorResponse, or Indication) from the response attributes and delegates to the base class handler.
Public Types
| Name | Description |
|---|---|
Ptr |
Ptr
IntrusivePtr< Transaction > Ptr()