PGE API 0.4
PR00F's Game Engine full documentation
Loading...
Searching...
No Matches
PgeServerImpl Class Referencefinal

Detailed Description

Definition at line 20 of file PgeServer.cpp.

+ Inheritance diagram for PgeServerImpl:

Public Member Functions

virtual ~PgeServerImpl ()
 Calls shutdown().
 
bool initialize () override
 Initialize the server subsystem.
 
bool shutdown () override
 This stops the server subsystem.
 
bool isInitialized () const override
 Gets the state of the server subsystem.
 
void disconnect (const std::string &sExtraDebugText="") override
 Terminates the active connections of the server instance and stops listening.
 
void Update () override
 
bool pollIncomingMessages () override
 Moves incoming packets from the underlying network layer to PGE network layer as PgePackets.
 
void pollConnectionStateChanges () override
 
std::size_t getPacketQueueSize () const override
 
pge_network::PgePacket popFrontPacket () noexcept(false) override
 
std::set< pge_network::PgePktId > & getAllowListedPgeMessages () override
 
std::set< pge_network::MsgApp::TMsgId > & getAllowListedAppMessages () override
 
void send (const pge_network::PgePacket &pkt, const pge_network::PgeNetworkConnectionHandle &connHandle=pge_network::ServerConnHandle) override
 Sends the given packet to the network instance specified.
 
uint32_t getRxPacketCount () const override
 
uint32_t getTxPacketCount () const override
 
uint32_t getInjectPacketCount () const override
 
uint32_t getRxPacketPerSecondCount () const override
 
uint32_t getTxPacketPerSecondCount () const override
 
uint32_t getInjectPacketPerSecondCount () const override
 
const std::map< pge_network::MsgApp::TMsgId, uint32_t > & getRxMsgCount () const override
 
const std::map< pge_network::MsgApp::TMsgId, uint32_t > & getTxMsgCount () const override
 
const std::map< pge_network::MsgApp::TMsgId, uint32_t > & getInjectMsgCount () const override
 
std::map< pge_network::MsgApp::TMsgId, std::string > & getMsgAppId2StringMap () override
 
uint32_t getRxByteCount () const override
 
uint32_t getTxByteCount () const override
 
uint32_t getInjectByteCount () const override
 
void WriteList () const override
 Writes statistics to console.
 
bool startListening (const std::string &sAppVersion="") override
 Starts listening to incoming PgeClient connections.
 
void sendToAllClientsExcept (const pge_network::PgePacket &pkt, const pge_network::PgeNetworkConnectionHandle &exceptConnHandle=0) override
 Sends the given packet to all client instances except the optionally specified client.
 
void sendToAll (const pge_network::PgePacket &pkt) override
 Sends the given packet to all known network instances, including the server itself (self).
 
void setDebugNickname (const pge_network::PgeNetworkConnectionHandle &connHandle, const std::string &sNickname) override
 Sets a debug helper name associated to the given connection handle.
 
int getPing (const pge_network::PgeNetworkConnectionHandle &connHandle, bool bForceUpdate) override
 
float getQualityLocal (const pge_network::PgeNetworkConnectionHandle &connHandle, bool bForceUpdate) override
 
float getQualityRemote (const pge_network::PgeNetworkConnectionHandle &connHandle, bool bForceUpdate) override
 
float getRxByteRate (const pge_network::PgeNetworkConnectionHandle &connHandle, bool bForceUpdate) override
 
float getTxByteRate (const pge_network::PgeNetworkConnectionHandle &connHandle, bool bForceUpdate) override
 
int64_t getPendingUnreliableBytes (const pge_network::PgeNetworkConnectionHandle &connHandle, bool bForceUpdate) override
 
int64_t getPendingReliableBytes (const pge_network::PgeNetworkConnectionHandle &connHandle, bool bForceUpdate) override
 
int64_t getSentButUnAckedReliableBytes (const pge_network::PgeNetworkConnectionHandle &connHandle, bool bForceUpdate) override
 
int64_t getInternalQueueTimeUSecs (const pge_network::PgeNetworkConnectionHandle &connHandle, bool bForceUpdate) override
 
std::string getDetailedConnectionStatus (const pge_network::PgeNetworkConnectionHandle &connHandle) const override
 
- Public Member Functions inherited from pge_network::PgeServer
CConsole & getConsole () const
 Returns access to console preset with logger module name as this class.
 
- Public Member Functions inherited from pge_network::PgeIServer
- Public Member Functions inherited from pge_network::PgeIServerClient

Private Member Functions

 PgeServerImpl (PGEcfgProfiles &cfgProfiles)
 
 PgeServerImpl (const PgeServerImpl &)
 
PgeServerImploperator= (const PgeServerImpl &)
 

Private Attributes

PGEcfgProfilesm_cfgProfiles
 
PgeGnsServerm_gnsServer
 

Friends

class pge_network::PgeServer
 

Additional Inherited Members

- Static Public Member Functions inherited from pge_network::PgeServer
static PgeIServercreateAndGet (PGEcfgProfiles &cfgProfiles)
 Creates and gets the singleton implementation instance.
 
- Static Public Member Functions inherited from pge_network::PgeIServer
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 

Constructor & Destructor Documentation

◆ ~PgeServerImpl()

PgeServerImpl::~PgeServerImpl ( )
virtual

Calls shutdown().

Definition at line 131 of file PgeServer.cpp.

◆ PgeServerImpl() [1/2]

PgeServerImpl::PgeServerImpl ( PGEcfgProfiles & cfgProfiles)
explicitprivate

Definition at line 394 of file PgeServer.cpp.

◆ PgeServerImpl() [2/2]

PgeServerImpl::PgeServerImpl ( const PgeServerImpl & other)
private

Definition at line 402 of file PgeServer.cpp.

Member Function Documentation

◆ disconnect()

void PgeServerImpl::disconnect ( const std::string & sExtraDebugText = "")
overridevirtual

Terminates the active connections of the server instance and stops listening.

Parameters
sExtraDebugTextAn optional text that will be sent to the other side and will be logged to help debugging.

Implements pge_network::PgeIServerClient.

Definition at line 173 of file PgeServer.cpp.

◆ getAllowListedAppMessages()

std::set< pge_network::MsgApp::TMsgId > & PgeServerImpl::getAllowListedAppMessages ( )
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 216 of file PgeServer.cpp.

◆ getAllowListedPgeMessages()

std::set< pge_network::PgePktId > & PgeServerImpl::getAllowListedPgeMessages ( )
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 211 of file PgeServer.cpp.

◆ getDetailedConnectionStatus()

std::string PgeServerImpl::getDetailedConnectionStatus ( const pge_network::PgeNetworkConnectionHandle & connHandle) const
overridevirtual

Implements pge_network::PgeIServer.

Definition at line 382 of file PgeServer.cpp.

◆ getInjectByteCount()

uint32_t PgeServerImpl::getInjectByteCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 293 of file PgeServer.cpp.

◆ getInjectMsgCount()

const std::map< pge_network::MsgApp::TMsgId, uint32_t > & PgeServerImpl::getInjectMsgCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 273 of file PgeServer.cpp.

◆ getInjectPacketCount()

uint32_t PgeServerImpl::getInjectPacketCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 243 of file PgeServer.cpp.

◆ getInjectPacketPerSecondCount()

uint32_t PgeServerImpl::getInjectPacketPerSecondCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 258 of file PgeServer.cpp.

◆ getInternalQueueTimeUSecs()

int64_t PgeServerImpl::getInternalQueueTimeUSecs ( const pge_network::PgeNetworkConnectionHandle & connHandle,
bool bForceUpdate )
overridevirtual

Implements pge_network::PgeIServer.

Definition at line 377 of file PgeServer.cpp.

◆ getMsgAppId2StringMap()

std::map< pge_network::MsgApp::TMsgId, std::string > & PgeServerImpl::getMsgAppId2StringMap ( )
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 278 of file PgeServer.cpp.

◆ getPacketQueueSize()

std::size_t PgeServerImpl::getPacketQueueSize ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 201 of file PgeServer.cpp.

◆ getPendingReliableBytes()

int64_t PgeServerImpl::getPendingReliableBytes ( const pge_network::PgeNetworkConnectionHandle & connHandle,
bool bForceUpdate )
overridevirtual

Implements pge_network::PgeIServer.

Definition at line 367 of file PgeServer.cpp.

◆ getPendingUnreliableBytes()

int64_t PgeServerImpl::getPendingUnreliableBytes ( const pge_network::PgeNetworkConnectionHandle & connHandle,
bool bForceUpdate )
overridevirtual

Implements pge_network::PgeIServer.

Definition at line 362 of file PgeServer.cpp.

◆ getPing()

int PgeServerImpl::getPing ( const pge_network::PgeNetworkConnectionHandle & connHandle,
bool bForceUpdate )
overridevirtual

Implements pge_network::PgeIServer.

Definition at line 337 of file PgeServer.cpp.

◆ getQualityLocal()

float PgeServerImpl::getQualityLocal ( const pge_network::PgeNetworkConnectionHandle & connHandle,
bool bForceUpdate )
overridevirtual

Implements pge_network::PgeIServer.

Definition at line 342 of file PgeServer.cpp.

◆ getQualityRemote()

float PgeServerImpl::getQualityRemote ( const pge_network::PgeNetworkConnectionHandle & connHandle,
bool bForceUpdate )
overridevirtual

Implements pge_network::PgeIServer.

Definition at line 347 of file PgeServer.cpp.

◆ getRxByteCount()

uint32_t PgeServerImpl::getRxByteCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 283 of file PgeServer.cpp.

◆ getRxByteRate()

float PgeServerImpl::getRxByteRate ( const pge_network::PgeNetworkConnectionHandle & connHandle,
bool bForceUpdate )
overridevirtual

Implements pge_network::PgeIServer.

Definition at line 352 of file PgeServer.cpp.

◆ getRxMsgCount()

const std::map< pge_network::MsgApp::TMsgId, uint32_t > & PgeServerImpl::getRxMsgCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 263 of file PgeServer.cpp.

◆ getRxPacketCount()

uint32_t PgeServerImpl::getRxPacketCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 233 of file PgeServer.cpp.

◆ getRxPacketPerSecondCount()

uint32_t PgeServerImpl::getRxPacketPerSecondCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 248 of file PgeServer.cpp.

◆ getSentButUnAckedReliableBytes()

int64_t PgeServerImpl::getSentButUnAckedReliableBytes ( const pge_network::PgeNetworkConnectionHandle & connHandle,
bool bForceUpdate )
overridevirtual

Implements pge_network::PgeIServer.

Definition at line 372 of file PgeServer.cpp.

◆ getTxByteCount()

uint32_t PgeServerImpl::getTxByteCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 288 of file PgeServer.cpp.

◆ getTxByteRate()

float PgeServerImpl::getTxByteRate ( const pge_network::PgeNetworkConnectionHandle & connHandle,
bool bForceUpdate )
overridevirtual

Implements pge_network::PgeIServer.

Definition at line 357 of file PgeServer.cpp.

◆ getTxMsgCount()

const std::map< pge_network::MsgApp::TMsgId, uint32_t > & PgeServerImpl::getTxMsgCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 268 of file PgeServer.cpp.

◆ getTxPacketCount()

uint32_t PgeServerImpl::getTxPacketCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 238 of file PgeServer.cpp.

◆ getTxPacketPerSecondCount()

uint32_t PgeServerImpl::getTxPacketPerSecondCount ( ) const
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 253 of file PgeServer.cpp.

◆ initialize()

bool PgeServerImpl::initialize ( )
overridevirtual

Initialize the server subsystem.

Returns
The result of the initialization. True on success, false otherwise.

Implements pge_network::PgeIServerClient.

Definition at line 141 of file PgeServer.cpp.

◆ isInitialized()

bool PgeServerImpl::isInitialized ( ) const
overridevirtual

Gets the state of the server subsystem.

Returns
True if the server subsystem is successfully initialized and listening, false otherwise.

Implements pge_network::PgeIServerClient.

Definition at line 163 of file PgeServer.cpp.

◆ operator=()

PgeServerImpl & PgeServerImpl::operator= ( const PgeServerImpl & )
private

Definition at line 408 of file PgeServer.cpp.

◆ pollConnectionStateChanges()

void PgeServerImpl::pollConnectionStateChanges ( )
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 196 of file PgeServer.cpp.

◆ pollIncomingMessages()

bool PgeServerImpl::pollIncomingMessages ( )
overridevirtual

Moves incoming packets from the underlying network layer to PGE network layer as PgePackets.

Returns
True on success, false on error.

Implements pge_network::PgeIServerClient.

Definition at line 187 of file PgeServer.cpp.

◆ popFrontPacket()

pge_network::PgePacket PgeServerImpl::popFrontPacket ( )
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 206 of file PgeServer.cpp.

◆ send()

void PgeServerImpl::send ( const pge_network::PgePacket & pkt,
const pge_network::PgeNetworkConnectionHandle & connHandle = pge_network::ServerConnHandle )
overridevirtual

Sends the given packet to the network instance specified.

Parameters
pktThe packet to be sent.
connHandleThe addressed network instance, that can be either a server or client instance. The default parameter means the addressed instance is the server instance. If server is specified and current instance is the server, the packet will be injected to self instead of actually sending it to the lower network level.

Implements pge_network::PgeIServerClient.

Definition at line 221 of file PgeServer.cpp.

◆ sendToAll()

void PgeServerImpl::sendToAll ( const pge_network::PgePacket & pkt)
overridevirtual

Sends the given packet to all known network instances, including the server itself (self).

Basically equals to: send(pkt); sendToAllClientsExcept(pkt);

Parameters
pktThe packet to be sent.

Implements pge_network::PgeIServer.

Definition at line 326 of file PgeServer.cpp.

◆ sendToAllClientsExcept()

void PgeServerImpl::sendToAllClientsExcept ( const pge_network::PgePacket & pkt,
const pge_network::PgeNetworkConnectionHandle & exceptConnHandle = 0 )
overridevirtual

Sends the given packet to all client instances except the optionally specified client.

This function is never able to send to server, not even injecting, hence the name contains "Clients".

Parameters
pktThe packet to be sent.
exceptConnHandleThe server-side connection of handle of a client to which we DO NOT want to send the packet. Since this function never sends to server, we use pge_network::ServerConnHandle as default, in such case the packet is sent to all clients. Even if you specify a real server-side connection handle of a client, this packet will never be sent to server, that is why function name contains "Clients".

Implements pge_network::PgeIServer.

Definition at line 321 of file PgeServer.cpp.

◆ setDebugNickname()

void PgeServerImpl::setDebugNickname ( const pge_network::PgeNetworkConnectionHandle & connHandle,
const std::string & sNickname )
overridevirtual

Sets a debug helper name associated to the given connection handle.

Useful because it makes reading debug log easier when not only connection handle but also this debug helper name is also logged. Can be anything, for example it can be the same name as the player name on higher application level associated to this connection.

Parameters
connHandleThe connection for which we want to set the debug helper name. Cannot be ServerConnHandle.
sNicknameThe debug helper name we want to see associated to the specified connection in the debug logs.

Implements pge_network::PgeIServer.

Definition at line 332 of file PgeServer.cpp.

◆ shutdown()

bool PgeServerImpl::shutdown ( )
overridevirtual

This stops the server subsystem.

No effect before initialization. After shutdown, initialize() and startListening() can be called again.

Returns
True on successful shutdown, false otherwise.

Implements pge_network::PgeIServerClient.

Definition at line 154 of file PgeServer.cpp.

◆ startListening()

bool PgeServerImpl::startListening ( const std::string & sAppVersion = "")
overridevirtual

Starts listening to incoming PgeClient connections.

If the function is successful, any call to the derived isListening() is expected to return true. Note: you can stop listening by invoking the derived disconnect() or shutdown() which are implemented already in hidden class.

Parameters
sAppVersionServer application version. We should fill it in if we expect connecting clients to have this same application version.
Returns
True on success, false otherwise or when it is already listening.

Implements pge_network::PgeIServer.

Definition at line 316 of file PgeServer.cpp.

◆ Update()

void PgeServerImpl::Update ( )
overridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 178 of file PgeServer.cpp.

◆ WriteList()

void PgeServerImpl::WriteList ( ) const
overridevirtual

Writes statistics to console.

Implements pge_network::PgeIServerClient.

Definition at line 298 of file PgeServer.cpp.

Friends And Related Symbol Documentation

◆ pge_network::PgeServer

friend class pge_network::PgeServer
friend

Definition at line 121 of file PgeServer.cpp.

Member Data Documentation

◆ m_cfgProfiles

PGEcfgProfiles& PgeServerImpl::m_cfgProfiles
private

Definition at line 114 of file PgeServer.cpp.

◆ m_gnsServer

PgeGnsServer& PgeServerImpl::m_gnsServer
private

Definition at line 115 of file PgeServer.cpp.


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