Connection Class Reference

#include <Connection.h>

List of all members.


Public Member Functions

 Connection ()
 Public constructor.
virtual ~Connection ()
 Virtual destructor.
common::ErrorCodeType Run (network::TcpSocket *pSocket, Database *pDatabase)
 Runs connection.

Private Member Functions

void ProcessConnection ()
 Processes connection.
void ProcessCommand (const network::Message &rCommand)
 Processes command.
void ProcessLoginCommand (const network::Message &rCommand)
 Processes login command.
void SendMessage (const std::string &rMessage)
void SendConnectMessage ()
void SendErrorMessage (const std::string &rCommand, const std::string &rResult)
void LogMessage (const network::Message &rMessage)
 Logs message.
void CreateEventMessage (const std::string &rType, network::Message &rMessage)
 Creates event message.

Static Private Member Functions

static void ConnectionThread (Connection *pConnection)
 Connection thread.

Private Attributes

network::TcpSocketm_pSocket
 Pointer to socket for this connection.
Databasem_pDatabase
 Pointer to database for this connection.
bool m_Connected
 Connected flag.
int m_SessionState
 Session state.
common::Player m_Player
 Player used during login.
int m_ConnectionId
 Connection ID.

Static Private Attributes

static int m_ConnectionCount = 0
 Connection count.

Detailed Description

Connection class.
Full Description
This class implements a sserver connection.

Constructor & Destructor Documentation

Connection (  ) 

Public constructor.

Full Description
This method creates a new instance of the class.
Returns:
New instance of the class.

~Connection (  )  [virtual]

Virtual destructor.

Full Description
This method destroys an existing instance of the class.
Returns:
None.


Member Function Documentation

common::ErrorCodeType Run ( network::TcpSocket pSocket,
Database pDatabase 
)

Runs connection.

Full Description
This method runs the connection.
Returns:
Success if successful.

Failure otherwise.

Parameters:
pSocket  Pointer to socket.
pDatabase  Pointer to database.

void ConnectionThread ( Connection pConnection  )  [static, private]

Connection thread.

Full Description
This method calls back into the ProcessConnection method and deletes the object when the thread ends.
Returns:
Success if successful.

Failure otherwise.

void ProcessConnection (  )  [private]

Processes connection.

Full Description
This method processes a connection.
Returns:
None.

void ProcessCommand ( const network::Message rCommand  )  [private]

Processes command.

Full Description
This method processes a command.
Returns:
None.

void ProcessLoginCommand ( const network::Message rCommand  )  [private]

Processes login command.

Full Description
This method processes the login command.
Returns:
None.

void SendMessage ( const std::string &  rMessage  )  [private]

Full Description
This method sends a message.
Returns:
None.
Parameters:
rMessage  Message to be sent.

void SendConnectMessage (  )  [private]

Full Description
This method sends a connect message.
Returns:
None.

void SendErrorMessage ( const std::string &  rCommand,
const std::string &  rResult 
) [private]

Full Description
This method sends an error message.
Returns:
None.
Parameters:
rCommand  Command that caused error.
rResult  Error result.

void LogMessage ( const network::Message rMessage  )  [private]

Logs message.

Full Description
This method logs a message.
Returns:
None.
Parameters:
rMessage  Message to be logged.

void CreateEventMessage ( const std::string &  rType,
network::Message rMessage 
) [private]

Creates event message.

Full Description
This method creates an event message.
Returns:
None.
Parameters:
rType  Event type.
rMessage  Event message.


Member Data Documentation

Pointer to socket for this connection.

Database* m_pDatabase [private]

Pointer to database for this connection.

bool m_Connected [private]

Connected flag.

int m_SessionState [private]

Session state.

Player used during login.

int m_ConnectionId [private]

int m_ConnectionCount = 0 [static, private]

Connection count.


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