#include <icy/turn/server/udpallocation.h>Inherits:
ServerAllocation
Server-side UDP TURN allocation that relays datagrams to permitted peers. Binds a dedicated UDP relay socket for peer communication and forwards incoming datagrams to the client as Data Indications.
| Return | Name | Description |
|---|---|---|
UDPAllocation | Binds the relay UDP socket and registers the peer receive callback. | |
bool | onPeerDataReceived | Receive callback for the relay UDP socket; validates permissions, updates bandwidth usage, and forwards data to the client as a Data Indication. |
bool | handleRequest virtual | Extends the base handler with Send Indication support. |
void | handleSendIndication | Handles a Send Indication from the client; validates permissions and relays the DATA attribute payload to the peer via the relay socket. Silently discards on permission or attribute errors. |
ssize_t | send | Sends raw data to peerAddress via the relay UDP socket. Updates bandwidth usage and returns -1 if the allocation is expired. |
net::Address | relayedAddress virtual const | #### Returns |
UDPAllocation(Server & server, const FiveTuple & tuple, const std::string & username, const uint32_t & lifetime)Binds the relay UDP socket and registers the peer receive callback.
server Owning TURN server.
tuple 5-tuple identifying this allocation.
username Authenticated username from the Allocate request.
lifetime Initial lifetime in seconds.
bool onPeerDataReceived(net::Socket & socket, const MutableBuffer & buffer, const net::Address & peerAddress)Receive callback for the relay UDP socket; validates permissions, updates bandwidth usage, and forwards data to the client as a Data Indication.
socket The relay socket.
buffer Received datagram.
peerAddress Source address of the peer datagram.
virtual
virtual bool handleRequest(Request & request)Extends the base handler with Send Indication support.
request Incoming STUN request or indication.true if handled.
void handleSendIndication(Request & request)Handles a Send Indication from the client; validates permissions and relays the DATA attribute payload to the peer via the relay socket. Silently discards on permission or attribute errors.
request Incoming Send Indication.ssize_t send(const char * data, size_t size, const net::Address & peerAddress)Sends raw data to peerAddress via the relay UDP socket. Updates bandwidth usage and returns -1 if the allocation is expired.
data Payload bytes to relay.
size Number of bytes.
peerAddress Destination peer address.
Number of bytes sent, or -1 if the quota is exhausted.
virtual const
virtual net::Address relayedAddress() constThe bound address of the relay UDP socket.
| Return | Name | Description |
|---|---|---|
net::SocketEmitter | _relaySocket |
net::SocketEmitter _relaySocket