Planeshift
ClientConnectionSet Class Reference

This class is a list of several CLient objects, it's designed for finding clients very fast based on their clientnum or their IP address. More...

#include <clients.h>

Public Types

typedef csHash< Client *, SockAddressAddressHash
 

Public Member Functions

ClientAdd (LPSOCKADDR_IN addr)
 
 ClientConnectionSet ()
 
size_t Count (void) const
 Count the number of clients connected, including superclients. More...
 
size_t CountReadyPlayers () const
 Count the number of ready players connected. More...
 
ClientFind (uint32_t id)
 Find by 32bit id value, used in UDP messages. Returns NULL if found but not ready. More...
 
ClientFind (const char *name)
 Find by player name, used for Chat and other purposes. Returns NULL if found but not ready. More...
 
ClientFind (LPSOCKADDR_IN addr)
 Find by IP addr and Port. More...
 
ClientFindAccount (AccountID accountID, uint32_t excludeClient=0)
 Find by account id. More...
 
ClientFindAny (uint32_t id)
 Find by 32bit id value, used in UDP messages, returns ready or not. More...
 
ClientFindPlayer (PID playerID)
 Find by player id. More...
 
csRef< NetPacketQueueRefCountFindQueueAny (uint32_t id)
 
bool Initialize ()
 
void MarkDelete (Client *client)
 
void SweepDelete ()
 
 ~ClientConnectionSet ()
 

Protected Attributes

AddressHash addrHash
 
csHash< Client * > hash
 
CS::Threading::RecursiveMutex mutex
 
csPDelArray< ClienttoDelete
 

Detailed Description

This class is a list of several CLient objects, it's designed for finding clients very fast based on their clientnum or their IP address.

This class is also threadsafe now

Definition at line 58 of file clients.h.

Member Typedef Documentation

Definition at line 61 of file clients.h.

Constructor & Destructor Documentation

ClientConnectionSet::ClientConnectionSet ( )
ClientConnectionSet::~ClientConnectionSet ( )

Member Function Documentation

Client* ClientConnectionSet::Add ( LPSOCKADDR_IN  addr)
size_t ClientConnectionSet::Count ( void  ) const

Count the number of clients connected, including superclients.

size_t ClientConnectionSet::CountReadyPlayers ( ) const

Count the number of ready players connected.

Client* ClientConnectionSet::Find ( uint32_t  id)

Find by 32bit id value, used in UDP messages. Returns NULL if found but not ready.

Client* ClientConnectionSet::Find ( const char *  name)

Find by player name, used for Chat and other purposes. Returns NULL if found but not ready.

Client* ClientConnectionSet::Find ( LPSOCKADDR_IN  addr)

Find by IP addr and Port.

Client* ClientConnectionSet::FindAccount ( AccountID  accountID,
uint32_t  excludeClient = 0 
)

Find by account id.

Client* ClientConnectionSet::FindAny ( uint32_t  id)

Find by 32bit id value, used in UDP messages, returns ready or not.

Client* ClientConnectionSet::FindPlayer ( PID  playerID)

Find by player id.

csRef<NetPacketQueueRefCount> ClientConnectionSet::FindQueueAny ( uint32_t  id)
bool ClientConnectionSet::Initialize ( )
void ClientConnectionSet::MarkDelete ( Client client)
void ClientConnectionSet::SweepDelete ( )

Member Data Documentation

AddressHash ClientConnectionSet::addrHash
protected

Definition at line 65 of file clients.h.

csHash<Client*> ClientConnectionSet::hash
protected

Definition at line 66 of file clients.h.

CS::Threading::RecursiveMutex ClientConnectionSet::mutex
protected

Definition at line 68 of file clients.h.

csPDelArray<Client> ClientConnectionSet::toDelete
protected

Definition at line 67 of file clients.h.


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