Open 3D Engine AzNetworking API Reference  2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Public Types | Public Member Functions | List of all members
AzNetworking::TcpConnectionSet Class Referencefinal

Tracks current TCP connections and allows fast lookups by socket fd and connection identifier. More...

#include <TcpConnectionSet.h>

Inherits AzNetworking::IConnectionSet.

Public Types

using ConnectionIdMap = AZStd::unordered_map< ConnectionId, AZStd::unique_ptr< TcpConnection > >
 
using SocketFdMap = AZStd::unordered_map< SocketFd, TcpConnection * >
 
- Public Types inherited from AzNetworking::IConnectionSet
using ConnectionVisitor = AZStd::function< void(IConnection &)>
 

Public Member Functions

bool AddConnection (AZStd::unique_ptr< TcpConnection > connection)
 
bool DeleteConnection (SocketFd socketFd)
 
TcpConnectionGetConnection (SocketFd socketFd) const
 
const SocketFdMap & GetSocketFdMap () const
 
void VisitConnections (const ConnectionVisitor &visitor) override
 
bool DeleteConnection (ConnectionId connectionId) override
 
IConnectionGetConnection (ConnectionId connectionId) const override
 
ConnectionId GetNextConnectionId () override
 
uint32_t GetConnectionCount () const override
 
uint32_t GetActiveConnectionCount () const override
 

Detailed Description

Tracks current TCP connections and allows fast lookups by socket fd and connection identifier.

Member Function Documentation

◆ AddConnection()

bool AzNetworking::TcpConnectionSet::AddConnection ( AZStd::unique_ptr< TcpConnection connection)

Adds a new connection to this connection list instance.

Parameters
connectionpointer to the connection instance to add
Returns
boolean true on success

◆ DeleteConnection() [1/2]

bool AzNetworking::TcpConnectionSet::DeleteConnection ( ConnectionId  connectionId)
overridevirtual

Deletes a connection from this connection list instance by connection identifier.

Parameters
connectionIdconnection identifier of the connection to delete
Returns
boolean true on success

Implements AzNetworking::IConnectionSet.

◆ DeleteConnection() [2/2]

bool AzNetworking::TcpConnectionSet::DeleteConnection ( SocketFd  socketFd)

Deletes a connection from this connection list instance by socket fd.

Parameters
socketFDsocket file descriptor of the connection to delete
Returns
boolean true on success

◆ GetActiveConnectionCount()

uint32_t AzNetworking::TcpConnectionSet::GetActiveConnectionCount ( ) const
overridevirtual

Returns the current total count of connections not pending disconnect for this connection set

Returns
the current total count of connections not pending disconnect for this connection set

Implements AzNetworking::IConnectionSet.

◆ GetConnection() [1/2]

IConnection* AzNetworking::TcpConnectionSet::GetConnection ( ConnectionId  connectionId) const
overridevirtual

Retrieves a connection from this connection set by connection identifier.

Parameters
connectionIdconnection identifier of the connection to retrieve
Returns
pointer to the requested connection instance on success, nullptr on failure

Implements AzNetworking::IConnectionSet.

◆ GetConnection() [2/2]

TcpConnection* AzNetworking::TcpConnectionSet::GetConnection ( SocketFd  socketFd) const

Retrieves a connection from this connection list instance by socket fd.

Parameters
socketFDsocket file descriptor of the connection to retrieve
Returns
pointer to the requested connection instance on success, nullptr on failure

◆ GetConnectionCount()

uint32_t AzNetworking::TcpConnectionSet::GetConnectionCount ( ) const
overridevirtual

Returns the current total connection count for this connection set

Returns
the current total connection count for this connection set

Implements AzNetworking::IConnectionSet.

◆ GetNextConnectionId()

ConnectionId AzNetworking::TcpConnectionSet::GetNextConnectionId ( )
overridevirtual

Returns the next valid connection identifier for this connection list instance.

Returns
a valid connection identifier to give a new connection instance, or InvalidConnectionId on failure

Implements AzNetworking::IConnectionSet.

◆ GetSocketFdMap()

const SocketFdMap& AzNetworking::TcpConnectionSet::GetSocketFdMap ( ) const

Returns the set of SocketFds that should be bound to this connection list instance.

Returns
the set of SocketFds that should be bound to this connection list instance

◆ VisitConnections()

void AzNetworking::TcpConnectionSet::VisitConnections ( const ConnectionVisitor &  visitor)
overridevirtual

The documentation for this class was generated from the following file: