PGE API 0.4
PR00F's Game Engine full documentation
Loading...
Searching...
No Matches
pge_network::PgeClientStub Class Reference

The primary interface to stubbed client networking functionality. More...

Detailed Description

The primary interface to stubbed client networking functionality.

Definition at line 25 of file PgeClientStub.h.

#include <PgeClientStub.h>

+ Inheritance diagram for pge_network::PgeClientStub:

Public Member Functions

 PgeClientStub (PGEcfgProfiles &cfgProfiles)
 
 PgeClientStub (const PgeClientStub &)=delete
 
PgeClientStuboperator= (const PgeClientStub &)=delete
 
 PgeClientStub (PgeClientStub &&)=delete
 
PgeClientStub && operator= (PgeClientStub &&)=delete
 
virtual ~PgeClientStub ()
 
bool initialize () override
 Initialize the network instance.
 
bool shutdown () override
 This stops the network instance.
 
bool isInitialized () const override
 Gets the state of the network instance.
 
void disconnect (const std::string &) override
 Terminates the active connection of the network instance.
 
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 &, const pge_network::PgeNetworkConnectionHandle &) 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 connectToServer (const std::string &, const std::string &) override
 Opens a connection to a server instance.
 
const pge_network::PgeNetworkConnectionHandlegetConnectionHandle () const override
 Returns client's handle to the connection opened towards the server.
 
const pge_network::PgeNetworkConnectionHandlegetConnectionHandleServerSide () const override
 Returns server's handle to the connection opened towards this client.
 
const char * getServerAddress () const override
 
int getPing (bool) override
 
float getQualityLocal (bool) override
 
float getQualityRemote (bool) override
 
float getRxByteRate (bool) override
 
float getTxByteRate (bool) override
 
int64_t getPendingUnreliableBytes (bool) override
 
int64_t getPendingReliableBytes (bool) override
 
int64_t getSentButUnAckedReliableBytes (bool) override
 
int64_t getInternalQueueTimeUSecs (bool) override
 
std::string getDetailedConnectionStatus () const override
 
- Public Member Functions inherited from pge_network::PgeIClient
- Public Member Functions inherited from pge_network::PgeIServerClient

Private Attributes

PGEcfgProfilesm_cfgProfiles
 
pge_network::PgeNetworkConnectionHandle m_myClientSideConnectionHandle { 0 }
 
pge_network::PgeNetworkConnectionHandle m_myServerSideConnectionHandle { 0 }
 

Additional Inherited Members

- Static Public Member Functions inherited from pge_network::PgeIClient
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 

Constructor & Destructor Documentation

◆ PgeClientStub() [1/3]

pge_network::PgeClientStub::PgeClientStub ( PGEcfgProfiles & cfgProfiles)
inline

Definition at line 29 of file PgeClientStub.h.

◆ PgeClientStub() [2/3]

pge_network::PgeClientStub::PgeClientStub ( const PgeClientStub & )
delete

◆ PgeClientStub() [3/3]

pge_network::PgeClientStub::PgeClientStub ( PgeClientStub && )
delete

◆ ~PgeClientStub()

virtual pge_network::PgeClientStub::~PgeClientStub ( )
inlinevirtual

Definition at line 40 of file PgeClientStub.h.

Member Function Documentation

◆ connectToServer()

bool pge_network::PgeClientStub::connectToServer ( const std::string & sServerAddress,
const std::string & sAppVersion )
inlineoverridevirtual

Opens a connection to a server instance.

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

Parameters
sServerAddressIPv4 or IPv6 address of PgeServer we want to connect to.
sAppVersionClient application version. If server expects a specific client version, we should fill it here.
Returns
True on success, false otherwise or when it is already connected to server. Note that mismatch between the specified client application version and server application version will be found out later and it does NOT have effect on the return value: the server will disconnect the mismatching client a bit later.

Implements pge_network::PgeIClient.

Definition at line 105 of file PgeClientStub.h.

◆ disconnect()

void pge_network::PgeClientStub::disconnect ( const std::string & sExtraDebugText)
inlineoverridevirtual

Terminates the active connection of the network instance.

In case of server instance, this terminates the active connections of the server instance and stops listening. It also sends as many MsgUserDisconnectedFromServer to all clients as the number of clients, so all clients will be notified about all other clients disconnecting. A MsgUserDisconnectedFromServer will be injected into the message queue with the server's connection handle, so at application level the handleUserDisconnected() is expected to be invoked with connHandleServerSide = pge_network::ServerConnHandle.

In case of client instance, this disconnects the client from the server. If client was connected at time of calling this function, a MsgUserDisconnectedFromServer will be injected into the message queue with the server's connection handle, so at application level the handleUserDisconnected() is expected to be invoked with connHandleServerSide = pge_network::ServerConnHandle, for which the client is expected to remove all other players as well since they are/were also connecting to the same server and not available anymore from this client's perspective.

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 50 of file PgeClientStub.h.

◆ getAllowListedAppMessages()

std::set< pge_network::MsgApp::TMsgId > & pge_network::PgeClientStub::getAllowListedAppMessages ( )
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 72 of file PgeClientStub.h.

◆ getAllowListedPgeMessages()

std::set< pge_network::PgePktId > & pge_network::PgeClientStub::getAllowListedPgeMessages ( )
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 67 of file PgeClientStub.h.

◆ getConnectionHandle()

const pge_network::PgeNetworkConnectionHandle & pge_network::PgeClientStub::getConnectionHandle ( ) const
inlineoverridevirtual

Returns client's handle to the connection opened towards the server.

Implements pge_network::PgeIClient.

Definition at line 110 of file PgeClientStub.h.

◆ getConnectionHandleServerSide()

const pge_network::PgeNetworkConnectionHandle & pge_network::PgeClientStub::getConnectionHandleServerSide ( ) const
inlineoverridevirtual

Returns server's handle to the connection opened towards this client.

Implements pge_network::PgeIClient.

Definition at line 115 of file PgeClientStub.h.

◆ getDetailedConnectionStatus()

std::string pge_network::PgeClientStub::getDetailedConnectionStatus ( ) const
inlineoverridevirtual

Implements pge_network::PgeIClient.

Definition at line 170 of file PgeClientStub.h.

◆ getInjectByteCount()

uint32_t pge_network::PgeClientStub::getInjectByteCount ( ) const
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 97 of file PgeClientStub.h.

◆ getInjectMsgCount()

const std::map< pge_network::MsgApp::TMsgId, uint32_t > & pge_network::PgeClientStub::getInjectMsgCount ( ) const
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 91 of file PgeClientStub.h.

◆ getInjectPacketCount()

uint32_t pge_network::PgeClientStub::getInjectPacketCount ( ) const
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 83 of file PgeClientStub.h.

◆ getInjectPacketPerSecondCount()

uint32_t pge_network::PgeClientStub::getInjectPacketPerSecondCount ( ) const
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 87 of file PgeClientStub.h.

◆ getInternalQueueTimeUSecs()

int64_t pge_network::PgeClientStub::getInternalQueueTimeUSecs ( bool )
inlineoverridevirtual

Implements pge_network::PgeIClient.

Definition at line 165 of file PgeClientStub.h.

◆ getMsgAppId2StringMap()

std::map< pge_network::MsgApp::TMsgId, std::string > & pge_network::PgeClientStub::getMsgAppId2StringMap ( )
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 93 of file PgeClientStub.h.

◆ getPacketQueueSize()

std::size_t pge_network::PgeClientStub::getPacketQueueSize ( ) const
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 57 of file PgeClientStub.h.

◆ getPendingReliableBytes()

int64_t pge_network::PgeClientStub::getPendingReliableBytes ( bool )
inlineoverridevirtual

Implements pge_network::PgeIClient.

Definition at line 155 of file PgeClientStub.h.

◆ getPendingUnreliableBytes()

int64_t pge_network::PgeClientStub::getPendingUnreliableBytes ( bool )
inlineoverridevirtual

Implements pge_network::PgeIClient.

Definition at line 150 of file PgeClientStub.h.

◆ getPing()

int pge_network::PgeClientStub::getPing ( bool )
inlineoverridevirtual

Implements pge_network::PgeIClient.

Definition at line 125 of file PgeClientStub.h.

◆ getQualityLocal()

float pge_network::PgeClientStub::getQualityLocal ( bool )
inlineoverridevirtual

Implements pge_network::PgeIClient.

Definition at line 130 of file PgeClientStub.h.

◆ getQualityRemote()

float pge_network::PgeClientStub::getQualityRemote ( bool )
inlineoverridevirtual

Implements pge_network::PgeIClient.

Definition at line 135 of file PgeClientStub.h.

◆ getRxByteCount()

uint32_t pge_network::PgeClientStub::getRxByteCount ( ) const
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 95 of file PgeClientStub.h.

◆ getRxByteRate()

float pge_network::PgeClientStub::getRxByteRate ( bool )
inlineoverridevirtual

Implements pge_network::PgeIClient.

Definition at line 140 of file PgeClientStub.h.

◆ getRxMsgCount()

const std::map< pge_network::MsgApp::TMsgId, uint32_t > & pge_network::PgeClientStub::getRxMsgCount ( ) const
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 89 of file PgeClientStub.h.

◆ getRxPacketCount()

uint32_t pge_network::PgeClientStub::getRxPacketCount ( ) const
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 81 of file PgeClientStub.h.

◆ getRxPacketPerSecondCount()

uint32_t pge_network::PgeClientStub::getRxPacketPerSecondCount ( ) const
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 85 of file PgeClientStub.h.

◆ getSentButUnAckedReliableBytes()

int64_t pge_network::PgeClientStub::getSentButUnAckedReliableBytes ( bool )
inlineoverridevirtual

Implements pge_network::PgeIClient.

Definition at line 160 of file PgeClientStub.h.

◆ getServerAddress()

const char * pge_network::PgeClientStub::getServerAddress ( ) const
inlineoverridevirtual

Implements pge_network::PgeIClient.

Definition at line 120 of file PgeClientStub.h.

◆ getTxByteCount()

uint32_t pge_network::PgeClientStub::getTxByteCount ( ) const
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 96 of file PgeClientStub.h.

◆ getTxByteRate()

float pge_network::PgeClientStub::getTxByteRate ( bool )
inlineoverridevirtual

Implements pge_network::PgeIClient.

Definition at line 145 of file PgeClientStub.h.

◆ getTxMsgCount()

const std::map< pge_network::MsgApp::TMsgId, uint32_t > & pge_network::PgeClientStub::getTxMsgCount ( ) const
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 90 of file PgeClientStub.h.

◆ getTxPacketCount()

uint32_t pge_network::PgeClientStub::getTxPacketCount ( ) const
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 82 of file PgeClientStub.h.

◆ getTxPacketPerSecondCount()

uint32_t pge_network::PgeClientStub::getTxPacketPerSecondCount ( ) const
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 86 of file PgeClientStub.h.

◆ initialize()

bool pge_network::PgeClientStub::initialize ( )
inlineoverridevirtual

Initialize the network instance.

Implements pge_network::PgeIServerClient.

Definition at line 47 of file PgeClientStub.h.

◆ isInitialized()

bool pge_network::PgeClientStub::isInitialized ( ) const
inlineoverridevirtual

Gets the state of the network instance.

Implements pge_network::PgeIServerClient.

Definition at line 49 of file PgeClientStub.h.

◆ operator=() [1/2]

PgeClientStub & pge_network::PgeClientStub::operator= ( const PgeClientStub & )
delete

◆ operator=() [2/2]

PgeClientStub && pge_network::PgeClientStub::operator= ( PgeClientStub && )
delete

◆ pollConnectionStateChanges()

void pge_network::PgeClientStub::pollConnectionStateChanges ( )
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 55 of file PgeClientStub.h.

◆ pollIncomingMessages()

bool pge_network::PgeClientStub::pollIncomingMessages ( )
inlineoverridevirtual

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 54 of file PgeClientStub.h.

◆ popFrontPacket()

pge_network::PgePacket pge_network::PgeClientStub::popFrontPacket ( )
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 62 of file PgeClientStub.h.

◆ send()

void pge_network::PgeClientStub::send ( const pge_network::PgePacket & pkt,
const pge_network::PgeNetworkConnectionHandle & connHandle )
inlineoverridevirtual

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 77 of file PgeClientStub.h.

◆ shutdown()

bool pge_network::PgeClientStub::shutdown ( )
inlineoverridevirtual

This stops the network instance.

Implements pge_network::PgeIServerClient.

Definition at line 48 of file PgeClientStub.h.

◆ Update()

void pge_network::PgeClientStub::Update ( )
inlineoverridevirtual

Implements pge_network::PgeIServerClient.

Definition at line 52 of file PgeClientStub.h.

◆ WriteList()

void pge_network::PgeClientStub::WriteList ( ) const
inlineoverridevirtual

Writes statistics to console.

Implements pge_network::PgeIServerClient.

Definition at line 99 of file PgeClientStub.h.

Member Data Documentation

◆ m_cfgProfiles

PGEcfgProfiles& pge_network::PgeClientStub::m_cfgProfiles
private

Definition at line 181 of file PgeClientStub.h.

◆ m_myClientSideConnectionHandle

pge_network::PgeNetworkConnectionHandle pge_network::PgeClientStub::m_myClientSideConnectionHandle { 0 }
private

Definition at line 182 of file PgeClientStub.h.

◆ m_myServerSideConnectionHandle

pge_network::PgeNetworkConnectionHandle pge_network::PgeClientStub::m_myServerSideConnectionHandle { 0 }
private

Definition at line 183 of file PgeClientStub.h.


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