# Server

<a id="server-7"></a>

# Server

```cpp
#include <icy/turn/server/server.h>

class Server
```

[Defined in src/turn/include/icy/turn/server/server.h:126](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L126)

TURN server RFC 5766 / RFC 6062 implementation. Listens on UDP and/or TCP, authenticates requests via [ServerObserver](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerObserver.md#serverobserver), and manages [ServerAllocation](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerAllocation.md#serverallocation) objects for each 5-tuple.

## Public Methods

| Return | Name | Description |
|--------|------|-------------|
|  | [`Server`](#server-8)  |  |
|  | [`~Server`](#server-9) `virtual` |  |
| `void` | [`start`](#start-28) `virtual` | Binds and listens on the configured address, then starts the maintenance timer. |
| `void` | [`stop`](#stop-17) `virtual` | Stops the timer, destroys all allocations, and closes server sockets. |
| `void` | [`handleRequest`](#handlerequest)  | Routes an authenticated request to the appropriate handler based on state. Pending (Authenticating) requests are held until the observer calls back. |
| `void` | [`handleAuthorizedRequest`](#handleauthorizedrequest)  | Dispatches an already-authorized request to the specific method handler. |
| `void` | [`handleBindingRequest`](#handlebindingrequest)  | Handles a Binding request; responds with XOR-MAPPED-ADDRESS. |
| `void` | [`handleAllocateRequest`](#handleallocaterequest)  | Handles an Allocate request; creates a UDP or TCP [ServerAllocation](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerAllocation.md#serverallocation) and sends a success response with XOR-RELAYED-ADDRESS and LIFETIME. |
| `void` | [`handleConnectionBindRequest`](#handleconnectionbindrequest)  | Handles a ConnectionBind request by locating the [TCPAllocation](https://auscaster.com/icey/docs/api-reference/icy-turn-TCPAllocation.md#tcpallocation) that owns the given CONNECTION-ID and delegating to it. |
| `void` | [`respond`](#respond)  | Sends a STUN response, signing it with MessageIntegrity if the request had a hash. Routes via UDP or TCP depending on request.transport. |
| `void` | [`respondError`](#responderror)  | Constructs and sends an error response with SOFTWARE, REALM, NONCE, and ERROR-CODE. |
| std::map< [`FiveTuple`](https://auscaster.com/icey/docs/api-reference/icy-turn-FiveTuple.md#fivetuple), [`ServerAllocation`](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerAllocation.md#serverallocation) * > | [`allocations`](#allocations) `const` | Returns a snapshot copy of the allocation map for safe iteration. Returned raw pointers are valid only while the server holds the allocations. |
| `void` | [`addAllocation`](#addallocation)  | Transfers ownership of `alloc` to the server and notifies the observer. |
| `void` | [`removeAllocation`](#removeallocation)  | Removes `alloc` from the map and notifies the observer. Called automatically from the [ServerAllocation](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerAllocation.md#serverallocation) destructor. |
| [`ServerAllocation`](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerAllocation.md#serverallocation) * | [`getAllocation`](#getallocation)  | Looks up an allocation by its 5-tuple. |
| [`TCPAllocation`](https://auscaster.com/icey/docs/api-reference/icy-turn-TCPAllocation.md#tcpallocation) * | [`getTCPAllocation`](#gettcpallocation)  | Finds the [TCPAllocation](https://auscaster.com/icey/docs/api-reference/icy-turn-TCPAllocation.md#tcpallocation) that owns a [TCPConnectionPair](https://auscaster.com/icey/docs/api-reference/icy-turn-TCPConnectionPair.md#tcpconnectionpair) with the given connection ID. |
| [`net::TCPSocket::Ptr`](https://auscaster.com/icey/docs/api-reference/icy-net-TCPSocket.md#ptr-14) | [`getTCPSocket`](#gettcpsocket)  | Returns the accepted TCP socket whose peer address matches `remoteAddr`. |
| `void` | [`releaseTCPSocket`](#releasetcpsocket)  | Removes a TCP control socket from the server's socket list and unregisters callbacks. Called when the socket is handed off to a [TCPAllocation](https://auscaster.com/icey/docs/api-reference/icy-turn-TCPAllocation.md#tcpallocation) (ConnectionBind). |
| [`ServerObserver`](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerObserver.md#serverobserver) & | [`observer`](#observer-2)  |  |
| const [`ServerOptions`](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerOptions.md#serveroptions) & | [`options`](#options-12) `const` |  |
| [`net::UDPSocket`](https://auscaster.com/icey/docs/api-reference/icy-net-UDPSocket.md#udpsocket) & | [`udpSocket`](#udpsocket-5)  |  |
| [`net::TCPSocket`](https://auscaster.com/icey/docs/api-reference/icy-net-TCPSocket.md#tcpsocket) & | [`tcpSocket`](#tcpsocket-5)  |  |
| [`Timer`](https://auscaster.com/icey/docs/api-reference/icy-Timer.md#timer) & | [`timer`](#timer-7)  |  |
| `void` | [`onTCPAcceptConnection`](#ontcpacceptconnection)  | Accept callback for the TCP listening socket; registers new connections for STUN message processing. |
| `bool` | [`onTCPSocketClosed`](#ontcpsocketclosed)  | Close callback for accepted TCP sockets; removes the socket from the list. |
| `bool` | [`onSocketRecv`](#onsocketrecv-8)  | Receive callback for both UDP and TCP sockets; parses STUN messages and calls [handleRequest()](#handlerequest) for each one. |
| `void` | [`onTimer`](#ontimer-3)  | Periodic maintenance callback; expires and removes stale allocations. |
| `void` | [`scheduleDeferredTCPSocketRelease`](#scheduledeferredtcpsocketrelease)  | Defers accepted TCP socket removal until after the active callback stack unwinds. |
| `void` | [`drainReleasedTCPSockets`](#drainreleasedtcpsockets)  |  |

---

<a id="server-8"></a>

### Server

```cpp
Server(ServerObserver & observer, const ServerOptions & options = ServerOptions())
```

[Defined in src/turn/include/icy/turn/server/server.h:131](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L131)

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `observer` | [`ServerObserver`](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerObserver.md#serverobserver) & | Observer used for authentication and allocation lifecycle events. |
| `options` | const [`ServerOptions`](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerOptions.md#serveroptions) & | [Server](#server-7) configuration; defaults to 0.0.0.0:3478 with TCP and UDP enabled. |

---

<a id="server-9"></a>

### ~Server

`virtual`

```cpp
virtual ~Server()
```

[Defined in src/turn/include/icy/turn/server/server.h:132](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L132)

---

<a id="start-28"></a>

### start

`virtual`

```cpp
virtual void start()
```

[Defined in src/turn/include/icy/turn/server/server.h:135](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L135)

Binds and listens on the configured address, then starts the maintenance timer.

---

<a id="stop-17"></a>

### stop

`virtual`

```cpp
virtual void stop()
```

[Defined in src/turn/include/icy/turn/server/server.h:138](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L138)

Stops the timer, destroys all allocations, and closes server sockets.

---

<a id="handlerequest"></a>

### handleRequest

```cpp
void handleRequest(Request & request, AuthenticationState state)
```

[Defined in src/turn/include/icy/turn/server/server.h:144](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L144)

Routes an authenticated request to the appropriate handler based on state. Pending (Authenticating) requests are held until the observer calls back.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `request` | [`Request`](https://auscaster.com/icey/docs/api-reference/icy-turn-Request.md#request-14) & | Incoming STUN request. |
| `state` | [`AuthenticationState`](https://auscaster.com/icey/docs/api-reference/icy-turn.md#authenticationstate) | Result of the observer's authenticateRequest() call. |

---

<a id="handleauthorizedrequest"></a>

### handleAuthorizedRequest

```cpp
void handleAuthorizedRequest(Request & request)
```

[Defined in src/turn/include/icy/turn/server/server.h:148](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L148)

Dispatches an already-authorized request to the specific method handler.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `request` | [`Request`](https://auscaster.com/icey/docs/api-reference/icy-turn-Request.md#request-14) & | Authorized STUN request. |

---

<a id="handlebindingrequest"></a>

### handleBindingRequest

```cpp
void handleBindingRequest(Request & request)
```

[Defined in src/turn/include/icy/turn/server/server.h:152](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L152)

Handles a Binding request; responds with XOR-MAPPED-ADDRESS.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `request` | [`Request`](https://auscaster.com/icey/docs/api-reference/icy-turn-Request.md#request-14) & | Incoming Binding request. |

---

<a id="handleallocaterequest"></a>

### handleAllocateRequest

```cpp
void handleAllocateRequest(Request & request)
```

[Defined in src/turn/include/icy/turn/server/server.h:157](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L157)

Handles an Allocate request; creates a UDP or TCP [ServerAllocation](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerAllocation.md#serverallocation) and sends a success response with XOR-RELAYED-ADDRESS and LIFETIME.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `request` | [`Request`](https://auscaster.com/icey/docs/api-reference/icy-turn-Request.md#request-14) & | Incoming Allocate request. |

---

<a id="handleconnectionbindrequest"></a>

### handleConnectionBindRequest

```cpp
void handleConnectionBindRequest(Request & request)
```

[Defined in src/turn/include/icy/turn/server/server.h:162](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L162)

Handles a ConnectionBind request by locating the [TCPAllocation](https://auscaster.com/icey/docs/api-reference/icy-turn-TCPAllocation.md#tcpallocation) that owns the given CONNECTION-ID and delegating to it.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `request` | [`Request`](https://auscaster.com/icey/docs/api-reference/icy-turn-Request.md#request-14) & | Incoming ConnectionBind request. |

---

<a id="respond"></a>

### respond

```cpp
void respond(Request & request, stun::Message & response)
```

[Defined in src/turn/include/icy/turn/server/server.h:168](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L168)

Sends a STUN response, signing it with MessageIntegrity if the request had a hash. Routes via UDP or TCP depending on request.transport.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `request` | [`Request`](https://auscaster.com/icey/docs/api-reference/icy-turn-Request.md#request-14) & | The original request (provides transport and remote address). |
| `response` | [`stun::Message`](https://auscaster.com/icey/docs/api-reference/icy-stun-Message.md#message-6) & | The response message to send. |

---

<a id="responderror"></a>

### respondError

```cpp
void respondError(Request & request, int errorCode, const char * errorDesc)
```

[Defined in src/turn/include/icy/turn/server/server.h:174](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L174)

Constructs and sends an error response with SOFTWARE, REALM, NONCE, and ERROR-CODE.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `request` | [`Request`](https://auscaster.com/icey/docs/api-reference/icy-turn-Request.md#request-14) & | The original request. |
| `errorCode` | `int` | STUN error code (e.g. 400, 401, 437). |
| `errorDesc` | `const char *` | Human-readable error description string. |

---

<a id="allocations"></a>

### allocations

`const`

```cpp
std::map< FiveTuple, ServerAllocation * > allocations() const
```

[Defined in src/turn/include/icy/turn/server/server.h:179](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L179)

Returns a snapshot copy of the allocation map for safe iteration. Returned raw pointers are valid only while the server holds the allocations. 
#### Returns
Map from [FiveTuple](https://auscaster.com/icey/docs/api-reference/icy-turn-FiveTuple.md#fivetuple) to raw [ServerAllocation](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerAllocation.md#serverallocation) pointers.

---

<a id="addallocation"></a>

### addAllocation

```cpp
void addAllocation(std::unique_ptr< ServerAllocation > alloc)
```

[Defined in src/turn/include/icy/turn/server/server.h:183](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L183)

Transfers ownership of `alloc` to the server and notifies the observer.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `alloc` | std::unique_ptr< [`ServerAllocation`](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerAllocation.md#serverallocation) > | Newly constructed allocation to register. |

---

<a id="removeallocation"></a>

### removeAllocation

```cpp
void removeAllocation(ServerAllocation * alloc)
```

[Defined in src/turn/include/icy/turn/server/server.h:188](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L188)

Removes `alloc` from the map and notifies the observer. Called automatically from the [ServerAllocation](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerAllocation.md#serverallocation) destructor.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `alloc` | [`ServerAllocation`](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerAllocation.md#serverallocation) * | Allocation being destroyed. |

---

<a id="getallocation"></a>

### getAllocation

```cpp
ServerAllocation * getAllocation(const FiveTuple & tuple)
```

[Defined in src/turn/include/icy/turn/server/server.h:193](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L193)

Looks up an allocation by its 5-tuple. 
#### Returns
Pointer to the matching allocation, or nullptr if not found.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `tuple` | const [`FiveTuple`](https://auscaster.com/icey/docs/api-reference/icy-turn-FiveTuple.md#fivetuple) & | The 5-tuple to search for. |

---

<a id="gettcpallocation"></a>

### getTCPAllocation

```cpp
TCPAllocation * getTCPAllocation(const uint32_t & connectionID)
```

[Defined in src/turn/include/icy/turn/server/server.h:198](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L198)

Finds the [TCPAllocation](https://auscaster.com/icey/docs/api-reference/icy-turn-TCPAllocation.md#tcpallocation) that owns a [TCPConnectionPair](https://auscaster.com/icey/docs/api-reference/icy-turn-TCPConnectionPair.md#tcpconnectionpair) with the given connection ID. 
#### Returns
Pointer to the owning [TCPAllocation](https://auscaster.com/icey/docs/api-reference/icy-turn-TCPAllocation.md#tcpallocation), or nullptr if not found.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `connectionID` | `const uint32_t &` | TURN CONNECTION-ID to search for. |

---

<a id="gettcpsocket"></a>

### getTCPSocket

```cpp
net::TCPSocket::Ptr getTCPSocket(const net::Address & remoteAddr)
```

[Defined in src/turn/include/icy/turn/server/server.h:203](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L203)

Returns the accepted TCP socket whose peer address matches `remoteAddr`. 
#### Returns
Shared pointer to the socket, or empty if not found.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `remoteAddr` | const [`net::Address`](https://auscaster.com/icey/docs/api-reference/icy-net-Address.md#address) & | Peer address to search for. |

---

<a id="releasetcpsocket"></a>

### releaseTCPSocket

```cpp
void releaseTCPSocket(const net::Socket & socket)
```

[Defined in src/turn/include/icy/turn/server/server.h:208](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L208)

Removes a TCP control socket from the server's socket list and unregisters callbacks. Called when the socket is handed off to a [TCPAllocation](https://auscaster.com/icey/docs/api-reference/icy-turn-TCPAllocation.md#tcpallocation) (ConnectionBind).

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `socket` | const [`net::Socket`](https://auscaster.com/icey/docs/api-reference/icy-net-Socket.md#socket-1) & | The socket to release. |

---

<a id="observer-2"></a>

### observer

```cpp
ServerObserver & observer()
```

[Defined in src/turn/include/icy/turn/server/server.h:211](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L211)

#### Returns
Reference to the observer provided at construction.

---

<a id="options-12"></a>

### options

`const`

```cpp
const ServerOptions & options() const
```

[Defined in src/turn/include/icy/turn/server/server.h:214](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L214)

#### Returns
Reference to the immutable options struct.

---

<a id="udpsocket-5"></a>

### udpSocket

```cpp
net::UDPSocket & udpSocket()
```

[Defined in src/turn/include/icy/turn/server/server.h:217](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L217)

#### Returns
Reference to the UDP server socket.

---

<a id="tcpsocket-5"></a>

### tcpSocket

```cpp
net::TCPSocket & tcpSocket()
```

[Defined in src/turn/include/icy/turn/server/server.h:220](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L220)

#### Returns
Reference to the TCP server listening socket.

---

<a id="timer-7"></a>

### timer

```cpp
Timer & timer()
```

[Defined in src/turn/include/icy/turn/server/server.h:223](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L223)

#### Returns
Reference to the maintenance timer.

---

<a id="ontcpacceptconnection"></a>

### onTCPAcceptConnection

```cpp
void onTCPAcceptConnection(const net::TCPSocket::Ptr & sock)
```

[Defined in src/turn/include/icy/turn/server/server.h:228](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L228)

Accept callback for the TCP listening socket; registers new connections for STUN message processing.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `sock` | const [`net::TCPSocket::Ptr`](https://auscaster.com/icey/docs/api-reference/icy-net-TCPSocket.md#ptr-14) & | Newly accepted TCP socket. |

---

<a id="ontcpsocketclosed"></a>

### onTCPSocketClosed

```cpp
bool onTCPSocketClosed(net::Socket & socket)
```

[Defined in src/turn/include/icy/turn/server/server.h:232](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L232)

Close callback for accepted TCP sockets; removes the socket from the list.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `socket` | [`net::Socket`](https://auscaster.com/icey/docs/api-reference/icy-net-Socket.md#socket-1) & | The closed socket. |

---

<a id="onsocketrecv-8"></a>

### onSocketRecv

```cpp
bool onSocketRecv(net::Socket & socket, const MutableBuffer & buffer, const net::Address & peerAddress)
```

[Defined in src/turn/include/icy/turn/server/server.h:239](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L239)

Receive callback for both UDP and TCP sockets; parses STUN messages and calls [handleRequest()](#handlerequest) for each one.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `socket` | [`net::Socket`](https://auscaster.com/icey/docs/api-reference/icy-net-Socket.md#socket-1) & | The receiving socket. |
| `buffer` | const [`MutableBuffer`](https://auscaster.com/icey/docs/api-reference/icy-MutableBuffer.md#mutablebuffer-6) & | Received data buffer. |
| `peerAddress` | const [`net::Address`](https://auscaster.com/icey/docs/api-reference/icy-net-Address.md#address) & | Source address of the data. |

---

<a id="ontimer-3"></a>

### onTimer

```cpp
void onTimer()
```

[Defined in src/turn/include/icy/turn/server/server.h:243](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L243)

Periodic maintenance callback; expires and removes stale allocations.

---

<a id="scheduledeferredtcpsocketrelease"></a>

### scheduleDeferredTCPSocketRelease

```cpp
void scheduleDeferredTCPSocketRelease()
```

[Defined in src/turn/include/icy/turn/server/server.h:246](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L246)

Defers accepted TCP socket removal until after the active callback stack unwinds.

---

<a id="drainreleasedtcpsockets"></a>

### drainReleasedTCPSockets

```cpp
void drainReleasedTCPSockets()
```

[Defined in src/turn/include/icy/turn/server/server.h:247](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L247)

## Private Attributes

| Return | Name | Description |
|--------|------|-------------|
| `std::mutex` | [`_mutex`](#_mutex-20)  |  |
| [`ServerObserver`](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerObserver.md#serverobserver) & | [`_observer`](#_observer-2)  |  |
| [`ServerOptions`](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerOptions.md#serveroptions) | [`_options`](#_options-4)  |  |
| [`net::SocketEmitter`](https://auscaster.com/icey/docs/api-reference/icy-net-SocketEmitter.md#socketemitter) | [`_udpSocket`](#_udpsocket)  |  |
| [`net::SocketEmitter`](https://auscaster.com/icey/docs/api-reference/icy-net-SocketEmitter.md#socketemitter) | [`_tcpSocket`](#_tcpsocket)  |  |
| std::vector< [`net::SocketEmitter`](https://auscaster.com/icey/docs/api-reference/icy-net-SocketEmitter.md#socketemitter) > | [`_tcpSockets`](#_tcpsockets)  |  |
| std::unordered_set< const [`net::Socket`](https://auscaster.com/icey/docs/api-reference/icy-net-Socket.md#socket-1) * > | [`_pendingReleasedTCPSockets`](#_pendingreleasedtcpsockets)  |  |
| `bool` | [`_tcpSocketReleaseScheduled`](#_tcpsocketreleasescheduled)  |  |
| [`ServerAllocationMap`](https://auscaster.com/icey/docs/api-reference/icy-turn.md#serverallocationmap) | [`_allocations`](#_allocations)  |  |
| [`Timer`](https://auscaster.com/icey/docs/api-reference/icy-Timer.md#timer) | [`_timer`](#_timer-4)  |  |

---

<a id="_mutex-20"></a>

### _mutex

```cpp
std::mutex _mutex
```

[Defined in src/turn/include/icy/turn/server/server.h:250](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L250)

---

<a id="_observer-2"></a>

### _observer

```cpp
ServerObserver & _observer
```

Type: [`ServerObserver`](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerObserver.md#serverobserver) &

[Defined in src/turn/include/icy/turn/server/server.h:251](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L251)

---

<a id="_options-4"></a>

### _options

```cpp
ServerOptions _options
```

Type: [`ServerOptions`](https://auscaster.com/icey/docs/api-reference/icy-turn-ServerOptions.md#serveroptions)

[Defined in src/turn/include/icy/turn/server/server.h:252](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L252)

---

<a id="_udpsocket"></a>

### _udpSocket

```cpp
net::SocketEmitter _udpSocket
```

Type: [`net::SocketEmitter`](https://auscaster.com/icey/docs/api-reference/icy-net-SocketEmitter.md#socketemitter)

[Defined in src/turn/include/icy/turn/server/server.h:253](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L253)

---

<a id="_tcpsocket"></a>

### _tcpSocket

```cpp
net::SocketEmitter _tcpSocket
```

Type: [`net::SocketEmitter`](https://auscaster.com/icey/docs/api-reference/icy-net-SocketEmitter.md#socketemitter)

[Defined in src/turn/include/icy/turn/server/server.h:254](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L254)

---

<a id="_tcpsockets"></a>

### _tcpSockets

```cpp
std::vector< net::SocketEmitter > _tcpSockets
```

Type: std::vector< [`net::SocketEmitter`](https://auscaster.com/icey/docs/api-reference/icy-net-SocketEmitter.md#socketemitter) >

[Defined in src/turn/include/icy/turn/server/server.h:255](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L255)

---

<a id="_pendingreleasedtcpsockets"></a>

### _pendingReleasedTCPSockets

```cpp
std::unordered_set< const net::Socket * > _pendingReleasedTCPSockets
```

Type: std::unordered_set< const [`net::Socket`](https://auscaster.com/icey/docs/api-reference/icy-net-Socket.md#socket-1) * >

[Defined in src/turn/include/icy/turn/server/server.h:256](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L256)

---

<a id="_tcpsocketreleasescheduled"></a>

### _tcpSocketReleaseScheduled

```cpp
bool _tcpSocketReleaseScheduled {false}
```

[Defined in src/turn/include/icy/turn/server/server.h:257](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L257)

---

<a id="_allocations"></a>

### _allocations

```cpp
ServerAllocationMap _allocations
```

Type: [`ServerAllocationMap`](https://auscaster.com/icey/docs/api-reference/icy-turn.md#serverallocationmap)

[Defined in src/turn/include/icy/turn/server/server.h:258](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L258)

---

<a id="_timer-4"></a>

### _timer

```cpp
Timer _timer
```

Type: [`Timer`](https://auscaster.com/icey/docs/api-reference/icy-Timer.md#timer)

[Defined in src/turn/include/icy/turn/server/server.h:259](https://github.com/auscaster/icey/blob/main/src/turn/include/icy/turn/server/server.h#L259)
