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
 
bool IsLocalClient () const
 Whether this client is running in the same process as the server. More...
 
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 (u32 reason)
 Sends a disconnection notification to the client, and sends a NMT_CONNECTION_LOST message to the session FSM. More...
 
void DisconnectNow (u32 reason)
 Sends an unreliable disconnection notification to the client. More...
 
void SetLocalClient (bool isLocalClient)
 Prevent timeouts for the client running in the same process as the server. More...
 
virtual bool SendMessage (const CNetMessage *message)
 Send a message to the client. More...
 
CNetFileTransfererGetFileTransferer ()
 
- Public Member Functions inherited from CFsm
 CFsm (void)
 
virtual ~CFsm (void)
 
virtual void Setup (void)
 Constructs the state machine. More...
 
void Shutdown (void)
 Clear event, action and condition lists and reset state machine. More...
 
void AddState (unsigned int state)
 
CFsmEventAddEvent (unsigned int eventType)
 
CFsmTransitionAddTransition (unsigned int state, unsigned int eventType, unsigned int nextState)
 
CFsmTransitionAddTransition (unsigned int state, unsigned int eventType, unsigned int nextState, void *pAction, void *pContext)
 
CFsmTransitionGetTransition (unsigned int state, unsigned int eventType) const
 
CFsmTransitionGetEventTransition (unsigned int eventType) const
 
void SetFirstState (unsigned int firstState)
 
void SetCurrState (unsigned int state)
 
unsigned int GetCurrState (void) const
 
void SetNextState (unsigned int nextState)
 
unsigned int GetNextState (void) const
 
const StateSetGetStates (void) const
 
const EventMapGetEvents (void) const
 
const TransitionListGetTransitions (void) const
 
bool Update (unsigned int eventType, void *pEventData)
 
bool IsValidState (unsigned int state) const
 
bool IsValidEvent (unsigned int eventType) const
 
virtual bool IsDone (void) const
 
- 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
 
bool m_IsLocalClient
 

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 ( CNetServerWorker server,
ENetPeer peer 
)

Member Function Documentation

void CNetServerSession::Disconnect ( u32  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 ( u32  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.

CNetFileTransferer& CNetServerSession::GetFileTransferer ( )
inline
const CStr& CNetServerSession::GetGUID ( ) const
inline
u32 CNetServerSession::GetHostID ( ) const
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.

CNetServerWorker& CNetServerSession::GetServer ( )
inline
const CStrW& CNetServerSession::GetUserName ( ) const
inline
bool CNetServerSession::IsLocalClient ( ) const

Whether this client is running in the same process as the server.

CNetServerSession::NONCOPYABLE ( CNetServerSession  )
private
bool CNetServerSession::SendMessage ( const CNetMessage message)
virtual

Send a message to the client.

Implements INetSession.

void CNetServerSession::SetGUID ( const CStr &  guid)
inline
void CNetServerSession::SetHostID ( u32  id)
inline
void CNetServerSession::SetLocalClient ( bool  isLocalClient)

Prevent timeouts for the client running in the same process as the server.

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

Member Data Documentation

CNetFileTransferer CNetServerSession::m_FileTransferer
private
CStr CNetServerSession::m_GUID
private
u32 CNetServerSession::m_HostID
private
bool CNetServerSession::m_IsLocalClient
private
ENetPeer* CNetServerSession::m_Peer
private
CNetServerWorker& CNetServerSession::m_Server
private
CStrW CNetServerSession::m_UserName
private

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