Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CNetServerSession Class Reference

The server's end of a network session. More...

#include <NetSession.h>

Inheritance diagram for CNetServerSession:
Collaboration diagram for CNetServerSession:

Public Member Functions

 CNetServerSession (CNetServerWorker &server, ENetPeer *peer)
 
CNetServerWorkerGetServer ()
 
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...
 
CNetFileTransfererGetFileTransferer ()
 
- 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

CNetServerWorkerm_Server
 
CNetFileTransferer m_FileTransferer
 
ENetPeerm_Peer
 
CStr m_GUID
 
CStrW m_UserName
 
u32 m_HostID
 
CStr m_Password
 

Detailed Description

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:

  • This is constructed and used by CNetServerWorker in the network server thread.

Constructor & Destructor Documentation

◆ CNetServerSession()

CNetServerSession::CNetServerSession ( CNetServerWorker server,
ENetPeer peer 
)

Member Function Documentation

◆ Disconnect()

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.

◆ DisconnectNow()

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.

◆ GetFileTransferer()

CNetFileTransferer & CNetServerSession::GetFileTransferer ( )
inline

◆ GetGUID()

const CStr & CNetServerSession::GetGUID ( ) const
inline

◆ GetHostID()

u32 CNetServerSession::GetHostID ( ) const
inline

◆ GetIPAddress()

u32 CNetServerSession::GetIPAddress ( ) const

◆ GetLastReceivedTime()

u32 CNetServerSession::GetLastReceivedTime ( ) const

Number of milliseconds since the latest packet of that client was received.

◆ GetMeanRTT()

u32 CNetServerSession::GetMeanRTT ( ) const

Average round trip time to the client.

◆ GetServer()

CNetServerWorker & CNetServerSession::GetServer ( )
inline

◆ GetUserName()

const CStrW & CNetServerSession::GetUserName ( ) const
inline

◆ NONCOPYABLE()

CNetServerSession::NONCOPYABLE ( CNetServerSession  )
private

◆ SendMessage()

bool CNetServerSession::SendMessage ( const CNetMessage message)
virtual

Send a message to the client.

Implements INetSession.

◆ SetGUID()

void CNetServerSession::SetGUID ( const CStr &  guid)
inline

◆ SetHostID()

void CNetServerSession::SetHostID ( u32  id)
inline

◆ SetUserName()

void CNetServerSession::SetUserName ( const CStrW &  name)
inline

Member Data Documentation

◆ m_FileTransferer

CNetFileTransferer CNetServerSession::m_FileTransferer
private

◆ m_GUID

CStr CNetServerSession::m_GUID
private

◆ m_HostID

u32 CNetServerSession::m_HostID
private

◆ m_Password

CStr CNetServerSession::m_Password
private

◆ m_Peer

ENetPeer* CNetServerSession::m_Peer
private

◆ m_Server

CNetServerWorker& CNetServerSession::m_Server
private

◆ m_UserName

CStrW CNetServerSession::m_UserName
private

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