UDPAllocation
UDPAllocation
#include <icy/turn/server/udpallocation.h>class UDPAllocationDefined in src/turn/include/icy/turn/server/udpallocation.h:31
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.
List of all members
| Name | Kind | Owner |
|---|---|---|
UDPAllocation | function | Declared here |
~UDPAllocation | function | Declared here |
onPeerDataReceived | function | Declared here |
handleRequest | function | Declared here |
handleSendIndication | function | Declared here |
send | function | Declared here |
relayedAddress | function | Declared here |
_relaySocket | variable | Declared here |
Server | friend | Inherited from ServerAllocation |
ServerAllocation | function | Inherited from ServerAllocation |
~ServerAllocation | function | Inherited from ServerAllocation |
handleRequest | function | Inherited from ServerAllocation |
handleRefreshRequest | function | Inherited from ServerAllocation |
handleCreatePermission | function | Inherited from ServerAllocation |
onTimer | function | Inherited from ServerAllocation |
timeRemaining | function | Inherited from ServerAllocation |
maxTimeRemaining | function | Inherited from ServerAllocation |
hasPermission | function | Inherited from ServerAllocation |
hasPermission | function | Inherited from ServerAllocation |
server | function | Inherited from ServerAllocation |
print | function | Inherited from ServerAllocation |
refreshDeleteRequested | function | Inherited from ServerAllocation |
_maxLifetime | variable | Inherited from ServerAllocation |
_server | variable | Inherited from ServerAllocation |
_permissionPolicy | variable | Inherited from ServerAllocation |
_refreshDeleteRequested | variable | Inherited from ServerAllocation |
ServerAllocation | function | Inherited from ServerAllocation |
operator= | function | Inherited from ServerAllocation |
ServerAllocation | function | Inherited from ServerAllocation |
operator= | function | Inherited from ServerAllocation |
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 ServerAllocation
| Kind | Name | Description |
|---|---|---|
friend | Server | |
function | ServerAllocation | |
function | ~ServerAllocation virtual | |
function | handleRequest virtual | Dispatches incoming STUN requests to handleCreatePermission() or handleRefreshRequest(). Subclasses override to add transport-specific methods. |
function | handleRefreshRequest virtual | Processes a Refresh request; updates the lifetime or sets the delete flag if the requested lifetime is 0, then sends a success response. |
function | handleCreatePermission virtual | Processes a CreatePermission request; installs or refreshes permissions for each XOR-PEER-ADDRESS attribute, then sends a success response. |
function | onTimer | Periodic maintenance callback called by Server::onTimer(). Removes expired permissions. Returns false to signal that this allocation should be destroyed. |
function | timeRemaining virtual const override | |
function | maxTimeRemaining const | |
function | hasPermission virtual override | Checks permission, auto-granting local IPs if enabled in server options. |
function | hasPermission virtual override | Checks whether a permission exists for peerAddress. The port is ignored; TURN permissions are IP-only. |
function | server virtual | |
function | print virtual const override | Writes a detailed diagnostic dump of this allocation to os. |
function | refreshDeleteRequested const inline | Returns true if the refresh request set lifetime to 0, signaling the parent Server to delete this allocation. |
variable | _maxLifetime | |
variable | _server | |
variable | _permissionPolicy | |
variable | _refreshDeleteRequested | |
function | ServerAllocation | NonCopyable and NonMovable. |
function | operator= | Deleted assignment operator. |
function | ServerAllocation | Deleted constructor. |
function | operator= | Deleted assignment operator. |
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 |
|---|---|---|
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 |
UDPAllocation
UDPAllocation(Server & server, const FiveTuple & tuple, const std::string & username, const uint32_t & lifetime)Defined in src/turn/include/icy/turn/server/udpallocation.h:39
Binds the relay UDP socket and registers the peer receive callback.
Parameters
serverOwning TURN server.tuple5-tuple identifying this allocation.usernameAuthenticated username from the Allocate request.lifetimeInitial lifetime in seconds.
onPeerDataReceived
bool onPeerDataReceived(net::Socket & socket, const MutableBuffer & buffer, const net::Address & peerAddress)Defined in src/turn/include/icy/turn/server/udpallocation.h:48
Receive callback for the relay UDP socket; validates permissions, updates bandwidth usage, and forwards data to the client as a Data Indication.
Parameters
socketThe relay socket.bufferReceived datagram.peerAddressSource address of the peer datagram.
handleRequest
virtual
virtual bool handleRequest(Request & request)Defined in src/turn/include/icy/turn/server/udpallocation.h:54
Extends the base handler with Send Indication support.
Parameters
requestIncoming STUN request or indication.
Returns
true if handled.
Reimplements
handleSendIndication
void handleSendIndication(Request & request)Defined in src/turn/include/icy/turn/server/udpallocation.h:60
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.
Parameters
requestIncoming Send Indication.
send
ssize_t send(const char * data, size_t size, const net::Address & peerAddress)Defined in src/turn/include/icy/turn/server/udpallocation.h:68
Sends raw data to peerAddress via the relay UDP socket. Updates bandwidth usage and returns -1 if the allocation is expired.
Parameters
dataPayload bytes to relay.sizeNumber of bytes.peerAddressDestination peer address.
Returns
Number of bytes sent, or -1 if the quota is exhausted.
relayedAddress
virtual const
virtual net::Address relayedAddress() constDefined in src/turn/include/icy/turn/server/udpallocation.h:72
Returns
The bound address of the relay UDP socket.
Reimplements
Private Attributes
| Return | Name | Description |
|---|---|---|
net::SocketEmitter | _relaySocket |
_relaySocket
net::SocketEmitter _relaySocketDefined in src/turn/include/icy/turn/server/udpallocation.h:75
