#include <icy/turn/server/serverallocation.h>Inherits:
IAllocationSubclassed by:TCPAllocation,UDPAllocation
Server-side TURN allocation that tracks permissions, lifetime, and relay state. Handles Refresh and CreatePermission requests common to both UDP and TCP allocations. Subclassed by UDPAllocation and TCPAllocation for transport-specific behaviour.
| Return | Name | Description |
|---|---|---|
ServerAllocation | #### Parameters | |
bool | handleRequest virtual | Dispatches incoming STUN requests to handleCreatePermission() or handleRefreshRequest(). Subclasses override to add transport-specific methods. |
void | 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. |
void | handleCreatePermission virtual | Processes a CreatePermission request; installs or refreshes permissions for each XOR-PEER-ADDRESS attribute, then sends a success response. |
bool | onTimer | Periodic maintenance callback called by Server::onTimer(). Removes expired permissions. Returns false to signal that this allocation should be destroyed. |
std::int64_t | timeRemaining virtual const | #### Returns |
std::int64_t | maxTimeRemaining const | #### Returns |
bool | hasPermission virtual | Checks permission, auto-granting local IPs if enabled in server options. |
bool | hasPermission virtual | Checks whether a permission exists for peerAddress. The port is ignored; TURN permissions are IP-only. |
Server & | server virtual | #### Returns |
void | print virtual const | Writes a detailed diagnostic dump of this allocation to os. |
bool | refreshDeleteRequested const inline | Returns true if the refresh request set lifetime to 0, signaling the parent Server to delete this allocation. |
ServerAllocation(Server & server, const FiveTuple & tuple, const std::string & username, std::int64_t lifetime)server Owning TURN server.
tuple 5-tuple uniquely identifying this allocation.
username Authenticated username from the Allocate request.
lifetime Initial lifetime in seconds as negotiated with the client.
virtual
virtual bool handleRequest(Request & request)Dispatches incoming STUN requests to handleCreatePermission() or handleRefreshRequest(). Subclasses override to add transport-specific methods.
request Incoming STUN request.true if the request was handled; false signals the server to respond with a 600 "Operation Not Supported" error.
virtual
virtual void handleRefreshRequest(Request & request)Processes a Refresh request; updates the lifetime or sets the delete flag if the requested lifetime is 0, then sends a success response.
request Incoming Refresh request.virtual
virtual void handleCreatePermission(Request & request)Processes a CreatePermission request; installs or refreshes permissions for each XOR-PEER-ADDRESS attribute, then sends a success response.
request Incoming CreatePermission request.bool onTimer()Periodic maintenance callback called by Server::onTimer(). Removes expired permissions. Returns false to signal that this allocation should be destroyed.
true to keep the allocation alive; false to destroy it.
virtual const
virtual std::int64_t timeRemaining() constThe lesser of IAllocation::timeRemaining() and maxTimeRemaining().
const
std::int64_t maxTimeRemaining() constSeconds remaining before the server-enforced maximum lifetime expires.
virtual
virtual bool hasPermission(const std::string & peerIP)Checks permission, auto-granting local IPs if enabled in server options.
virtual
virtual bool hasPermission(const net::Address & peerAddress)Checks whether a permission exists for peerAddress. The port is ignored; TURN permissions are IP-only.
virtual
virtual Server & server()Reference to the owning TURN server.
virtual const
virtual void print(std::ostream & os) constWrites a detailed diagnostic dump of this allocation to os.
const inline
inline bool refreshDeleteRequested() constReturns true if the refresh request set lifetime to 0, signaling the parent Server to delete this allocation.
| Return | Name | Description |
|---|---|---|
uint32_t | _maxLifetime | |
Server & | _server | |
PermissionPolicy | _permissionPolicy | |
bool | _refreshDeleteRequested |
uint32_t _maxLifetimeServer & _serverPermissionPolicy _permissionPolicybool _refreshDeleteRequested = false| Return | Name | Description |
|---|---|---|
ServerAllocation | NonCopyable and NonMovable. | |
ServerAllocation | Deleted constructor. |
ServerAllocation(const ServerAllocation &) = deleteNonCopyable and NonMovable.
ServerAllocation(ServerAllocation &&) = deleteDeleted constructor.