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

PR00F's Game Engine's wrapper for GameNetworkingSockets library. More...

Detailed Description

PR00F's Game Engine's wrapper for GameNetworkingSockets library.

Definition at line 48 of file PgeGnsWrapper.h.

#include <PgeGnsWrapper.h>

+ Inheritance diagram for PgeGnsWrapper:

Public Member Functions

virtual ~PgeGnsWrapper ()
 
bool init ()
 Initializes the GameNetworkingSockets library.
 
virtual bool destroy ()
 Uninitializes the GameNetworkingSockets library.
 
bool isInitialized () const
 Gets the state of initialization of the GameNetworkingSockets library.
 
bool pollIncomingMessages ()
 Moves incoming SteamNetworkingMessages from GameNetworkingSockets layer to m_queuePackets as PgePackets.
 
void pollConnectionStateChanges ()
 
std::size_t getPacketQueueSize () const
 
pge_network::PgePacket popFrontPacket () noexcept(false)
 
std::set< pge_network::PgePktId > & getAllowListedPgeMessages ()
 
std::set< pge_network::MsgApp::TMsgId > & getAllowListedAppMessages ()
 
uint32_t getRxPacketCount () const
 
uint32_t getTxPacketCount () const
 
uint32_t getInjectPacketCount () const
 
uint32_t getRxPacketPerSecondCount () const
 
uint32_t getTxPacketPerSecondCount () const
 
uint32_t getInjectPacketPerSecondCount () const
 
const std::map< pge_network::MsgApp::TMsgId, uint32_t > & getRxMsgCount () const
 
const std::map< pge_network::MsgApp::TMsgId, uint32_t > & getTxMsgCount () const
 
const std::map< pge_network::MsgApp::TMsgId, uint32_t > & getInjectMsgCount () const
 
std::map< pge_network::MsgApp::TMsgId, std::string > & getMsgAppId2StringMap ()
 
uint32_t getRxByteCount () const
 
uint32_t getTxByteCount () const
 
uint32_t getInjectByteCount () const
 

Static Public Attributes

static const uint16 DEFAULT_SERVER_PORT = 27020
 

Protected Member Functions

 PgeGnsWrapper (PGEcfgProfiles &cfgProfiles)
 
 PgeGnsWrapper (const PgeGnsWrapper &)
 
PgeGnsWrapperoperator= (const PgeGnsWrapper &)
 
virtual bool pgeMessageIsHandledAtGnsLevel (const pge_network::PgePacket &pkt)=0
 
virtual int receiveMessages (ISteamNetworkingMessage **pIncomingMsg, int nIncomingMsgArraySize) const =0
 
virtual bool validateSteamNetworkingMessage (const HSteamNetConnection &connHandle) const =0
 
virtual void updateIncomingPgePacket (pge_network::PgePacket &pkt, const HSteamNetConnection &connHandle) const =0
 
virtual void onSteamNetConnectionStatusChanged (SteamNetConnectionStatusChangedCallback_t *pInfo)=0
 
std::string getStringByMsgAppId (const pge_network::MsgApp::TMsgId &id) const
 
std::string getDetailedConnectionStatus (const HSteamNetConnection &connHandle) const
 
void logDetailedConnectionStatus (const HSteamNetConnection &connHandle) const
 

Static Protected Member Functions

static void steamNetConnectionStatusChangedCallback (SteamNetConnectionStatusChangedCallback_t *pInfo)
 

Protected Attributes

PGEcfgProfilesm_cfgProfiles
 
ISteamNetworkingSockets * m_pInterface
 
std::deque< pge_network::PgePacketm_queuePackets
 
std::set< pge_network::PgePktIdm_allowListedPgeMessages
 
std::set< pge_network::MsgApp::TMsgIdm_allowListedAppMessages
 
uint32_t m_nRxPktCount
 
uint32_t m_nTxPktCount
 
uint32_t m_nInjectPktCount
 
std::chrono::time_point< std::chrono::steady_clock > m_time1stRxPkt
 
std::chrono::time_point< std::chrono::steady_clock > m_time1stTxPkt
 
std::chrono::time_point< std::chrono::steady_clock > m_time1stInjectPkt
 
std::map< pge_network::MsgApp::TMsgId, uint32_t > m_nRxMsgCount
 
std::map< pge_network::MsgApp::TMsgId, uint32_t > m_nTxMsgCount
 
std::map< pge_network::MsgApp::TMsgId, uint32_t > m_nInjectMsgCount
 
std::map< pge_network::MsgApp::TMsgId, std::string > m_mapMsgAppId2String
 
uint32_t m_nRxByteCount
 
uint32_t m_nTxByteCount
 
uint32_t m_nInjectByteCount
 
std::string m_sAppVersion
 Expected client app version in case of server instance, or simply client app version in case of client instance.
 

Static Protected Attributes

static PgeGnsWrappers_pCallbackInstance = nullptr
 

Constructor & Destructor Documentation

◆ ~PgeGnsWrapper()

PgeGnsWrapper::~PgeGnsWrapper ( )
virtual

Definition at line 75 of file PgeGnsWrapper.cpp.

◆ PgeGnsWrapper() [1/2]

PgeGnsWrapper::PgeGnsWrapper ( PGEcfgProfiles & cfgProfiles)
explicitprotected

Definition at line 376 of file PgeGnsWrapper.cpp.

◆ PgeGnsWrapper() [2/2]

PgeGnsWrapper::PgeGnsWrapper ( const PgeGnsWrapper & other)
protected

Definition at line 388 of file PgeGnsWrapper.cpp.

Member Function Documentation

◆ destroy()

bool PgeGnsWrapper::destroy ( )
virtual

Uninitializes the GameNetworkingSockets library.

Should be extended by derived classes by closing their connections, before them invoking this.

Returns
True if uninitialization is successful or not initialized, false otherwise.

Reimplemented in PgeGnsClient, and PgeGnsServer.

Definition at line 80 of file PgeGnsWrapper.cpp.

◆ getAllowListedAppMessages()

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

Definition at line 286 of file PgeGnsWrapper.cpp.

◆ getAllowListedPgeMessages()

std::set< pge_network::PgePktId > & PgeGnsWrapper::getAllowListedPgeMessages ( )

Definition at line 281 of file PgeGnsWrapper.cpp.

◆ getDetailedConnectionStatus()

std::string PgeGnsWrapper::getDetailedConnectionStatus ( const HSteamNetConnection & connHandle) const
protected

Definition at line 409 of file PgeGnsWrapper.cpp.

◆ getInjectByteCount()

uint32_t PgeGnsWrapper::getInjectByteCount ( ) const

Definition at line 360 of file PgeGnsWrapper.cpp.

◆ getInjectMsgCount()

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

Definition at line 340 of file PgeGnsWrapper.cpp.

◆ getInjectPacketCount()

uint32_t PgeGnsWrapper::getInjectPacketCount ( ) const

Definition at line 301 of file PgeGnsWrapper.cpp.

◆ getInjectPacketPerSecondCount()

uint32_t PgeGnsWrapper::getInjectPacketPerSecondCount ( ) const

Definition at line 322 of file PgeGnsWrapper.cpp.

◆ getMsgAppId2StringMap()

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

Definition at line 345 of file PgeGnsWrapper.cpp.

◆ getPacketQueueSize()

std::size_t PgeGnsWrapper::getPacketQueueSize ( ) const

Definition at line 269 of file PgeGnsWrapper.cpp.

◆ getRxByteCount()

uint32_t PgeGnsWrapper::getRxByteCount ( ) const

Definition at line 350 of file PgeGnsWrapper.cpp.

◆ getRxMsgCount()

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

Definition at line 330 of file PgeGnsWrapper.cpp.

◆ getRxPacketCount()

uint32_t PgeGnsWrapper::getRxPacketCount ( ) const

Definition at line 291 of file PgeGnsWrapper.cpp.

◆ getRxPacketPerSecondCount()

uint32_t PgeGnsWrapper::getRxPacketPerSecondCount ( ) const

Definition at line 306 of file PgeGnsWrapper.cpp.

◆ getStringByMsgAppId()

std::string PgeGnsWrapper::getStringByMsgAppId ( const pge_network::MsgApp::TMsgId & id) const
protected

Definition at line 399 of file PgeGnsWrapper.cpp.

◆ getTxByteCount()

uint32_t PgeGnsWrapper::getTxByteCount ( ) const

Definition at line 355 of file PgeGnsWrapper.cpp.

◆ getTxMsgCount()

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

Definition at line 335 of file PgeGnsWrapper.cpp.

◆ getTxPacketCount()

uint32_t PgeGnsWrapper::getTxPacketCount ( ) const

Definition at line 296 of file PgeGnsWrapper.cpp.

◆ getTxPacketPerSecondCount()

uint32_t PgeGnsWrapper::getTxPacketPerSecondCount ( ) const

Definition at line 314 of file PgeGnsWrapper.cpp.

◆ init()

bool PgeGnsWrapper::init ( )

Initializes the GameNetworkingSockets library.

Returns
True if initialization successful, false if initialization is unsuccessful or if it is already initialized.

Definition at line 44 of file PgeGnsWrapper.cpp.

◆ isInitialized()

bool PgeGnsWrapper::isInitialized ( ) const

Gets the state of initialization of the GameNetworkingSockets library.

This is not the state of any active connection, for that check available functions in the derived classes.

Returns
True if initialized, false otherwise.

Definition at line 127 of file PgeGnsWrapper.cpp.

◆ logDetailedConnectionStatus()

void PgeGnsWrapper::logDetailedConnectionStatus ( const HSteamNetConnection & connHandle) const
protected

Definition at line 445 of file PgeGnsWrapper.cpp.

◆ onSteamNetConnectionStatusChanged()

virtual void PgeGnsWrapper::onSteamNetConnectionStatusChanged ( SteamNetConnectionStatusChangedCallback_t * pInfo)
protectedpure virtual

Implemented in PgeGnsClient, and PgeGnsServer.

◆ operator=()

PgeGnsWrapper & PgeGnsWrapper::operator= ( const PgeGnsWrapper & )
protected

Definition at line 394 of file PgeGnsWrapper.cpp.

◆ pgeMessageIsHandledAtGnsLevel()

virtual bool PgeGnsWrapper::pgeMessageIsHandledAtGnsLevel ( const pge_network::PgePacket & pkt)
protectedpure virtual

Implemented in PgeGnsClient, and PgeGnsServer.

◆ pollConnectionStateChanges()

void PgeGnsWrapper::pollConnectionStateChanges ( )

Definition at line 260 of file PgeGnsWrapper.cpp.

◆ pollIncomingMessages()

bool PgeGnsWrapper::pollIncomingMessages ( )

Moves incoming SteamNetworkingMessages from GameNetworkingSockets layer to m_queuePackets as PgePackets.

Returns
True on success, false on error.

Definition at line 132 of file PgeGnsWrapper.cpp.

◆ popFrontPacket()

pge_network::PgePacket PgeGnsWrapper::popFrontPacket ( )

Definition at line 274 of file PgeGnsWrapper.cpp.

◆ receiveMessages()

virtual int PgeGnsWrapper::receiveMessages ( ISteamNetworkingMessage ** pIncomingMsg,
int nIncomingMsgArraySize ) const
protectedpure virtual

Implemented in PgeGnsClient, and PgeGnsServer.

◆ steamNetConnectionStatusChangedCallback()

void PgeGnsWrapper::steamNetConnectionStatusChangedCallback ( SteamNetConnectionStatusChangedCallback_t * pInfo)
staticprotected

Definition at line 371 of file PgeGnsWrapper.cpp.

◆ updateIncomingPgePacket()

virtual void PgeGnsWrapper::updateIncomingPgePacket ( pge_network::PgePacket & pkt,
const HSteamNetConnection & connHandle ) const
protectedpure virtual

Implemented in PgeGnsClient, and PgeGnsServer.

◆ validateSteamNetworkingMessage()

virtual bool PgeGnsWrapper::validateSteamNetworkingMessage ( const HSteamNetConnection & connHandle) const
protectedpure virtual

Implemented in PgeGnsClient, and PgeGnsServer.

Member Data Documentation

◆ DEFAULT_SERVER_PORT

const uint16 PgeGnsWrapper::DEFAULT_SERVER_PORT = 27020
static

Definition at line 56 of file PgeGnsWrapper.h.

◆ m_allowListedAppMessages

std::set<pge_network::MsgApp::TMsgId> PgeGnsWrapper::m_allowListedAppMessages
protected

Definition at line 128 of file PgeGnsWrapper.h.

◆ m_allowListedPgeMessages

std::set<pge_network::PgePktId> PgeGnsWrapper::m_allowListedPgeMessages
protected

Definition at line 127 of file PgeGnsWrapper.h.

◆ m_cfgProfiles

PGEcfgProfiles& PgeGnsWrapper::m_cfgProfiles
protected

Definition at line 122 of file PgeGnsWrapper.h.

◆ m_mapMsgAppId2String

std::map<pge_network::MsgApp::TMsgId, std::string> PgeGnsWrapper::m_mapMsgAppId2String
protected

Definition at line 142 of file PgeGnsWrapper.h.

◆ m_nInjectByteCount

uint32_t PgeGnsWrapper::m_nInjectByteCount
protected

Definition at line 146 of file PgeGnsWrapper.h.

◆ m_nInjectMsgCount

std::map<pge_network::MsgApp::TMsgId, uint32_t> PgeGnsWrapper::m_nInjectMsgCount
protected

Definition at line 140 of file PgeGnsWrapper.h.

◆ m_nInjectPktCount

uint32_t PgeGnsWrapper::m_nInjectPktCount
protected

Definition at line 132 of file PgeGnsWrapper.h.

◆ m_nRxByteCount

uint32_t PgeGnsWrapper::m_nRxByteCount
protected

Definition at line 144 of file PgeGnsWrapper.h.

◆ m_nRxMsgCount

std::map<pge_network::MsgApp::TMsgId, uint32_t> PgeGnsWrapper::m_nRxMsgCount
protected

Definition at line 138 of file PgeGnsWrapper.h.

◆ m_nRxPktCount

uint32_t PgeGnsWrapper::m_nRxPktCount
protected

Definition at line 130 of file PgeGnsWrapper.h.

◆ m_nTxByteCount

uint32_t PgeGnsWrapper::m_nTxByteCount
protected

Definition at line 145 of file PgeGnsWrapper.h.

◆ m_nTxMsgCount

std::map<pge_network::MsgApp::TMsgId, uint32_t> PgeGnsWrapper::m_nTxMsgCount
protected

Definition at line 139 of file PgeGnsWrapper.h.

◆ m_nTxPktCount

uint32_t PgeGnsWrapper::m_nTxPktCount
protected

Definition at line 131 of file PgeGnsWrapper.h.

◆ m_pInterface

ISteamNetworkingSockets* PgeGnsWrapper::m_pInterface
protected

Definition at line 124 of file PgeGnsWrapper.h.

◆ m_queuePackets

std::deque<pge_network::PgePacket> PgeGnsWrapper::m_queuePackets
protected

Definition at line 126 of file PgeGnsWrapper.h.

◆ m_sAppVersion

std::string PgeGnsWrapper::m_sAppVersion
protected

Expected client app version in case of server instance, or simply client app version in case of client instance.

Definition at line 148 of file PgeGnsWrapper.h.

◆ m_time1stInjectPkt

std::chrono::time_point<std::chrono::steady_clock> PgeGnsWrapper::m_time1stInjectPkt
protected

Definition at line 136 of file PgeGnsWrapper.h.

◆ m_time1stRxPkt

std::chrono::time_point<std::chrono::steady_clock> PgeGnsWrapper::m_time1stRxPkt
protected

Definition at line 134 of file PgeGnsWrapper.h.

◆ m_time1stTxPkt

std::chrono::time_point<std::chrono::steady_clock> PgeGnsWrapper::m_time1stTxPkt
protected

Definition at line 135 of file PgeGnsWrapper.h.

◆ s_pCallbackInstance

PgeGnsWrapper * PgeGnsWrapper::s_pCallbackInstance = nullptr
staticprotected

Definition at line 120 of file PgeGnsWrapper.h.


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