Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
The server's end of a network session. More...
#include <NetSession.h>
Public Member Functions | |
CNetServerSession (CNetServerWorker &server, ENetPeer *peer) | |
CNetServerWorker & | GetServer () |
const CStr & | GetGUID () const |
void | SetGUID (const CStr &guid) |
const CStrW & | GetUserName () const |
void | SetUserName (const CStrW &name) |
u32 | GetHostID () const |
void | SetHostID (u32 id) |
u32 | GetIPAddress () const |
u32 | GetLastReceivedTime () const |
Number of milliseconds since the latest packet of that client was received. More... | |
u32 | GetMeanRTT () const |
Average round trip time to the client. More... | |
void | Disconnect (NetDisconnectReason reason) |
Sends a disconnection notification to the client, and sends a NMT_CONNECTION_LOST message to the session FSM. More... | |
void | DisconnectNow (NetDisconnectReason reason) |
Sends an unreliable disconnection notification to the client. More... | |
virtual bool | SendMessage (const CNetMessage *message) |
Send a message to the client. More... | |
CNetFileTransferer & | GetFileTransferer () |
Public Member Functions inherited from CFsm< CNetServerSession > | |
void | AddTransition (unsigned int state, unsigned int eventType, unsigned int nextState, Action *pAction=nullptr, CNetServerSession *pContext=nullptr) |
Adds a new transistion to the state machine. More... | |
void | SetFirstState (unsigned int firstState) |
Sets the initial state for FSM. More... | |
void | SetCurrState (unsigned int state) |
Sets the current state and update the last state to the current state. More... | |
unsigned int | GetCurrState () const |
void | SetNextState (unsigned int nextState) |
unsigned int | GetNextState () const |
bool | Update (unsigned int eventType, void *pEventData) |
Updates the FSM and retrieves next state. More... | |
bool | IsDone () const |
Tests whether the state machine has finished its work. More... | |
Public Member Functions inherited from INetSession | |
virtual | ~INetSession () |
virtual bool | SendMessage (const CNetMessage *message)=0 |
Private Member Functions | |
NONCOPYABLE (CNetServerSession) | |
Private Attributes | |
CNetServerWorker & | m_Server |
CNetFileTransferer | m_FileTransferer |
ENetPeer * | m_Peer |
CStr | m_GUID |
CStrW | m_UserName |
u32 | m_HostID |
CStr | m_Password |
The server's end of a network session.
Represents an abstraction of the state of the client, storing all the per-client data needed by the server.
Thread-safety:
CNetServerSession::CNetServerSession | ( | CNetServerWorker & | server, |
ENetPeer * | peer | ||
) |
void CNetServerSession::Disconnect | ( | NetDisconnectReason | reason | ) |
Sends a disconnection notification to the client, and sends a NMT_CONNECTION_LOST message to the session FSM.
The server will receive a disconnection notification after a while. The server will not receive any further messages sent via this session.
void CNetServerSession::DisconnectNow | ( | NetDisconnectReason | reason | ) |
Sends an unreliable disconnection notification to the client.
The server will not receive any disconnection notification. The server will not receive any further messages sent via this session.
|
inline |
|
inline |
|
inline |
u32 CNetServerSession::GetIPAddress | ( | ) | const |
u32 CNetServerSession::GetLastReceivedTime | ( | ) | const |
Number of milliseconds since the latest packet of that client was received.
u32 CNetServerSession::GetMeanRTT | ( | ) | const |
Average round trip time to the client.
|
inline |
|
inline |
|
private |
|
virtual |
Send a message to the client.
Implements INetSession.
|
inline |
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |