Pyrogenesis  trunk
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CNetServerSession Class Reference

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

#include <NetSession.h>

Inheritance diagram for CNetServerSession:
Inheritance graph
[legend]
Collaboration diagram for CNetServerSession:
Collaboration graph
[legend]

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
 CFsm ()
 
virtual ~CFsm ()
 
virtual void Setup ()
 Constructs the state machine. More...
 
void Shutdown ()
 Clear event, action and condition lists and reset state machine. More...
 
void AddState (unsigned int state)
 Adds the specified state to the internal list of states. More...
 
CFsmEventAddEvent (unsigned int eventType)
 Adds the specified event to the internal list of events. More...
 
CFsmTransitionAddTransition (unsigned int state, unsigned int eventType, unsigned int nextState)
 Adds a new transistion to the state machine. More...
 
CFsmTransitionAddTransition (unsigned int state, unsigned int eventType, unsigned int nextState, void *pAction, void *pContext)
 Adds a new transition to the state machine. More...
 
CFsmTransitionGetTransition (unsigned int state, unsigned int eventType) const
 Looks up the transition given the state, event and next state to transition to. More...
 
CFsmTransitionGetEventTransition (unsigned int eventType) const
 
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
 
const StateSetGetStates () const
 
const EventMapGetEvents () const
 
const TransitionListGetTransitions () const
 
bool Update (unsigned int eventType, void *pEventData)
 Updates the FSM and retrieves next state. More...
 
bool IsValidState (unsigned int state) const
 Verifies whether the specified state is managed by the FSM. More...
 
bool IsValidEvent (unsigned int eventType) const
 Verifies whether the specified event is managed by the FSM. More...
 
virtual bool IsDone () const
 Tests whether the state machine has finished its work. More...
 
- Public Member Functions inherited from INetSession
virtual ~INetSession ()
 

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:

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: