PGE API 0.4
PR00F's Game Engine full documentation
|
The primary interface to stubbed server networking functionality. More...
The primary interface to stubbed server networking functionality.
With current implementation is it more like a spy, but anyway I still call it stub.
Regarding the packet sender functions: we have 1 virtual client connected, so that:
Definition at line 30 of file PgeServerStub.h.
#include <PgeServerStub.h>
Public Member Functions | |
PgeServerStub (PGEcfgProfiles &cfgProfiles) | |
PgeServerStub (const PgeServerStub &)=delete | |
PgeServerStub & | operator= (const PgeServerStub &)=delete |
PgeServerStub (PgeServerStub &&)=delete | |
PgeServerStub && | operator= (PgeServerStub &&)=delete |
virtual | ~PgeServerStub () |
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 &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 &) 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 &, const std::string &) override |
Sets a debug helper name associated to the given connection handle. | |
int | getPing (const pge_network::PgeNetworkConnectionHandle &, bool) override |
float | getQualityLocal (const pge_network::PgeNetworkConnectionHandle &, bool) override |
float | getQualityRemote (const pge_network::PgeNetworkConnectionHandle &, bool) override |
float | getRxByteRate (const pge_network::PgeNetworkConnectionHandle &, bool) override |
float | getTxByteRate (const pge_network::PgeNetworkConnectionHandle &, bool) override |
int64_t | getPendingUnreliableBytes (const pge_network::PgeNetworkConnectionHandle &, bool) override |
int64_t | getPendingReliableBytes (const pge_network::PgeNetworkConnectionHandle &, bool) override |
int64_t | getSentButUnAckedReliableBytes (const pge_network::PgeNetworkConnectionHandle &, bool) override |
int64_t | getInternalQueueTimeUSecs (const pge_network::PgeNetworkConnectionHandle &, bool) override |
std::string | getDetailedConnectionStatus (const pge_network::PgeNetworkConnectionHandle &) const override |
![]() | |
![]() |
Private Attributes | |
PGEcfgProfiles & | m_cfgProfiles |
bool | m_bInited {false} |
uint32_t | m_nPktCountTx { 0 } |
std::map< pge_network::MsgApp::TMsgId, uint32_t > | m_mapTxMsgCount |
Additional Inherited Members | |
![]() | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
|
inline |
Definition at line 38 of file PgeServerStub.h.
|
delete |
|
delete |
|
inlinevirtual |
Definition at line 49 of file PgeServerStub.h.
|
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.
sExtraDebugText | An optional text that will be sent to the other side and will be logged to help debugging. |
Implements pge_network::PgeIServerClient.
Definition at line 78 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 108 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 103 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServer.
Definition at line 250 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 149 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 143 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 135 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 139 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServer.
Definition at line 243 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 145 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 93 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServer.
Definition at line 229 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServer.
Definition at line 222 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServer.
Definition at line 187 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServer.
Definition at line 194 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServer.
Definition at line 201 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 147 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServer.
Definition at line 208 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 141 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 133 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 137 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServer.
Definition at line 236 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 148 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServer.
Definition at line 215 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 142 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 134 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 138 of file PgeServerStub.h.
|
inlineoverridevirtual |
Initialize the network instance.
Implements pge_network::PgeIServerClient.
Definition at line 53 of file PgeServerStub.h.
|
inlineoverridevirtual |
Gets the state of the network instance.
Implements pge_network::PgeIServerClient.
Definition at line 73 of file PgeServerStub.h.
|
delete |
|
delete |
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 89 of file PgeServerStub.h.
|
inlineoverridevirtual |
Moves incoming packets from the underlying network layer to PGE network layer as PgePackets.
Implements pge_network::PgeIServerClient.
Definition at line 84 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 98 of file PgeServerStub.h.
|
inlineoverridevirtual |
Sends the given packet to the network instance specified.
pkt | The packet to be sent. |
connHandle | The 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 113 of file PgeServerStub.h.
|
inlineoverridevirtual |
Sends the given packet to all known network instances, including the server itself (self).
Basically equals to: send(pkt); sendToAllClientsExcept(pkt);
pkt | The packet to be sent. |
Implements pge_network::PgeIServer.
Definition at line 172 of file PgeServerStub.h.
|
inlineoverridevirtual |
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".
pkt | The packet to be sent. |
exceptConnHandle | The 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 159 of file PgeServerStub.h.
|
inlineoverridevirtual |
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.
connHandle | The connection for which we want to set the debug helper name. Cannot be ServerConnHandle. |
sNickname | The debug helper name we want to see associated to the specified connection in the debug logs. |
Implements pge_network::PgeIServer.
Definition at line 185 of file PgeServerStub.h.
|
inlineoverridevirtual |
This stops the network instance.
Implements pge_network::PgeIServerClient.
Definition at line 64 of file PgeServerStub.h.
|
inlineoverridevirtual |
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.
sAppVersion | Server application version. We should fill it in if we expect connecting clients to have this same application version. |
Implements pge_network::PgeIServer.
Definition at line 157 of file PgeServerStub.h.
|
inlineoverridevirtual |
Implements pge_network::PgeIServerClient.
Definition at line 81 of file PgeServerStub.h.
|
inlineoverridevirtual |
Writes statistics to console.
Implements pge_network::PgeIServerClient.
Definition at line 151 of file PgeServerStub.h.
|
private |
Definition at line 261 of file PgeServerStub.h.
|
private |
Definition at line 259 of file PgeServerStub.h.
|
private |
Definition at line 264 of file PgeServerStub.h.
|
private |
Definition at line 263 of file PgeServerStub.h.