ServerAllocation
ServerAllocation
#include <icy/turn/server/serverallocation.h>class ServerAllocationDefined in src/turn/include/icy/turn/server/serverallocation.h:29
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.
List of all members
| Name | Kind | Owner |
|---|---|---|
Server | friend | Declared here |
ServerAllocation | function | Declared here |
~ServerAllocation | function | Declared here |
handleRequest | function | Declared here |
handleRefreshRequest | function | Declared here |
handleCreatePermission | function | Declared here |
onTimer | function | Declared here |
timeRemaining | function | Declared here |
maxTimeRemaining | function | Declared here |
hasPermission | function | Declared here |
hasPermission | function | Declared here |
server | function | Declared here |
print | function | Declared here |
refreshDeleteRequested | function | Declared here |
_maxLifetime | variable | Declared here |
_server | variable | Declared here |
_permissionPolicy | variable | Declared here |
_refreshDeleteRequested | variable | Declared here |
ServerAllocation | function | Declared here |
operator= | function | Declared here |
ServerAllocation | function | Declared here |
operator= | function | Declared here |
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 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 |
Friends
| Name | Description |
|---|---|
Server |
Server
friend class ServerDefined in src/turn/include/icy/turn/server/serverallocation.h:84
Public Methods
| Return | Name | Description |
|---|---|---|
ServerAllocation | ||
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 override | |
std::int64_t | maxTimeRemaining const | |
bool | hasPermission virtual override | Checks permission, auto-granting local IPs if enabled in server options. |
bool | hasPermission virtual override | Checks whether a permission exists for peerAddress. The port is ignored; TURN permissions are IP-only. |
Server & | server virtual | |
void | print virtual const override | 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
ServerAllocation(Server & server, const FiveTuple & tuple, const std::string & username, std::int64_t lifetime)Defined in src/turn/include/icy/turn/server/serverallocation.h:36
Parameters
serverOwning TURN server.tuple5-tuple uniquely identifying this allocation.usernameAuthenticated username from the Allocate request.lifetimeInitial lifetime in seconds as negotiated with the client.
handleRequest
virtual
virtual bool handleRequest(Request & request)Defined in src/turn/include/icy/turn/server/serverallocation.h:45
Dispatches incoming STUN requests to handleCreatePermission() or handleRefreshRequest(). Subclasses override to add transport-specific methods.
Parameters
requestIncoming STUN request.
Returns
true if the request was handled; false signals the server to respond with a 600 "Operation Not Supported" error.
Reimplemented by
handleRefreshRequest
virtual
virtual void handleRefreshRequest(Request & request)Defined in src/turn/include/icy/turn/server/serverallocation.h:50
Processes a Refresh request; updates the lifetime or sets the delete flag if the requested lifetime is 0, then sends a success response.
Parameters
requestIncoming Refresh request.
handleCreatePermission
virtual
virtual void handleCreatePermission(Request & request)Defined in src/turn/include/icy/turn/server/serverallocation.h:55
Processes a CreatePermission request; installs or refreshes permissions for each XOR-PEER-ADDRESS attribute, then sends a success response.
Parameters
requestIncoming CreatePermission request.
onTimer
bool onTimer()Defined in src/turn/include/icy/turn/server/serverallocation.h:61
Periodic maintenance callback called by Server::onTimer(). Removes expired permissions. Returns false to signal that this allocation should be destroyed.
Returns
true to keep the allocation alive; false to destroy it.
timeRemaining
virtual const override
virtual std::int64_t timeRemaining() const overrideDefined in src/turn/include/icy/turn/server/serverallocation.h:64
Returns
The lesser of IAllocation::timeRemaining() and maxTimeRemaining().
Reimplements
maxTimeRemaining
const
std::int64_t maxTimeRemaining() constDefined in src/turn/include/icy/turn/server/serverallocation.h:67
Returns
Seconds remaining before the server-enforced maximum lifetime expires.
hasPermission
virtual override
virtual bool hasPermission(const std::string & peerIP) overrideDefined in src/turn/include/icy/turn/server/serverallocation.h:70
Checks permission, auto-granting local IPs if enabled in server options.
Reimplements
hasPermission
virtual override
virtual bool hasPermission(const net::Address & peerAddress) overrideDefined in src/turn/include/icy/turn/server/serverallocation.h:71
Checks whether a permission exists for peerAddress. The port is ignored; TURN permissions are IP-only.
Reimplements
server
virtual
virtual Server & server()Defined in src/turn/include/icy/turn/server/serverallocation.h:74
Returns
Reference to the owning TURN server.
virtual const override
virtual void print(std::ostream & os) const overrideDefined in src/turn/include/icy/turn/server/serverallocation.h:77
Writes a detailed diagnostic dump of this allocation to os.
Reimplements
refreshDeleteRequested
const inline
inline bool refreshDeleteRequested() constDefined in src/turn/include/icy/turn/server/serverallocation.h:81
Returns true if the refresh request set lifetime to 0, signaling the parent Server to delete this allocation.
Protected Attributes
| Return | Name | Description |
|---|---|---|
uint32_t | _maxLifetime | |
Server & | _server | |
PermissionPolicy | _permissionPolicy | |
bool | _refreshDeleteRequested |
_maxLifetime
uint32_t _maxLifetimeDefined in src/turn/include/icy/turn/server/serverallocation.h:86
_server
Server & _serverDefined in src/turn/include/icy/turn/server/serverallocation.h:87
_permissionPolicy
PermissionPolicy _permissionPolicyDefined in src/turn/include/icy/turn/server/serverallocation.h:88
_refreshDeleteRequested
bool _refreshDeleteRequested = falseDefined in src/turn/include/icy/turn/server/serverallocation.h:89
Private Methods
| Return | Name | Description |
|---|---|---|
ServerAllocation | NonCopyable and NonMovable. | |
ServerAllocation | Deleted constructor. |
ServerAllocation
ServerAllocation(const ServerAllocation &) = deleteDefined in src/turn/include/icy/turn/server/serverallocation.h:93
NonCopyable and NonMovable.
ServerAllocation
ServerAllocation(ServerAllocation &&) = deleteDefined in src/turn/include/icy/turn/server/serverallocation.h:95
Deleted constructor.
