Planeshift
AuthenticationServer Class Reference

Authentication handling. More...

#include <authentserver.h>

Public Member Functions

 AuthenticationServer (ClientConnectionSet *pCCS, UserManager *usermgr, GuildManager *gm)
 Initializing Constructor. More...
 
BanManagerGetBanManager ()
 Get the Ban Manager that hold information regarding baned clients. More...
 
void HandleStatusUpdate (MsgEntry *me, Client *client)
 Updates the status of the client. More...
 
void SendDisconnect (Client *client, const char *reason)
 Sends a disconnect message to the given client. More...
 
void SendMsgStrings (int cnum, bool send_digest)
 Util function to send string hash to client, because authentserver and npcmanager both send these. More...
 
virtual ~AuthenticationServer ()
 Destructor. More...
 
- Public Member Functions inherited from MessageManager< AuthenticationServer >
void HandleMessage (MsgEntry *msg, Client *client)
 Transfers the message to the manager specific function. More...
 
void Subscribe (FunctionPointer fpt, msgtype type, uint32_t flags=0x01)
 Subscribes this manager to a specific message type with a custom callback. More...
 
bool Unsubscribe (msgtype type)
 Unsubscribes this manager from a specific message type. More...
 
bool Unsubscribe (FunctionPointer handler, msgtype type)
 Unsubscribes a specific handler from a specific message type. More...
 
bool UnsubscribeAll ()
 Unsubscribes this manager from all message types. More...
 
virtual ~MessageManager ()
 Unsubscribes all messages then destroys this object. More...
 
- Public Member Functions inherited from MessageManagerBase
csArray< csString > DecodeCommandArea (Client *client, csString target)
 Decodes an area: expression. More...
 
gemObjectFindObjectByString (const csString &str, gemActor *me) const
 Find the object we are referring to in str. More...
 
ClientFindPlayerClient (const char *name)
 Finds Client* of character with given name. More...
 
virtual bool Verify (MsgEntry *pMsg, unsigned int flags, Client *&client)
 

Protected Member Functions

bool CheckAuthenticationPreCondition (int clientnum, bool netversionok, const char *sUser)
 Common preconditions for HandlePreAuthent and HandleAuthent. More...
 
void HandleAuthCharacter (MsgEntry *me, Client *notused)
 Handles a message where a client picks his character to play with. More...
 
void HandleAuthent (MsgEntry *me, Client *notused)
 Handles an authenticate message from the message queue. More...
 
void HandleDisconnect (MsgEntry *me, Client *notused)
 Handles a disconnect message from the message queue. More...
 
void HandlePreAuthent (MsgEntry *me, Client *notused)
 This just questsions a random number (clientnum) from server. More...
 
void HandleStringsRequest (MsgEntry *me, Client *notused)
 Handles a request for messsage strings from a client. More...
 

Protected Attributes

BanManager banmanager
 Manages banned users and IP ranges. More...
 
ClientConnectionSetclients
 Holds a list of all the currently connect clients. More...
 
GuildManagerguildmanager
 Is a manager for the guilds. More...
 
UserManagerusermanager
 Is the user manager. More...
 

Additional Inherited Members

- Public Types inherited from MessageManager< AuthenticationServer >
typedef void(AuthenticationServer::* FunctionPointer) (MsgEntry *, Client *)
 

Detailed Description

Authentication handling.

This class subscribes to "AUTH" messages and checks userid's and passwords against the database (hardcoded right now, not live db). If they are valid an "Account Approved" message is sent back, telling the client what to request to instantiate the player. If not valid, it sends back a "Not Authorized" message.

Definition at line 76 of file authentserver.h.

Constructor & Destructor Documentation

AuthenticationServer::AuthenticationServer ( ClientConnectionSet pCCS,
UserManager usermgr,
GuildManager gm 
)

Initializing Constructor.

This initializes the AuthenticationServer object. Storing the references to the objects asked for. This also subscribes this object to the message handler listening to messages of type:

  • MSGTYPE_AUTHENTICATE
  • MSGTYPE_DISCONNECT

When either of these messages appear on the message queue, the corresponding function is called with the message as the argument.

Parameters
pCCSReference to the client connection set.
usermgrReference to the user manager.
gmReference to the guild manager.
virtual AuthenticationServer::~AuthenticationServer ( )
virtual

Destructor.

The destructor will un-subscribe this object from the message handler.

See also
MsgHandler::Unsubscribe()

Member Function Documentation

bool AuthenticationServer::CheckAuthenticationPreCondition ( int  clientnum,
bool  netversionok,
const char *  sUser 
)
protected

Common preconditions for HandlePreAuthent and HandleAuthent.

BanManager* AuthenticationServer::GetBanManager ( )
inline

Get the Ban Manager that hold information regarding baned clients.

Definition at line 137 of file authentserver.h.

void AuthenticationServer::HandleAuthCharacter ( MsgEntry me,
Client notused 
)
protected

Handles a message where a client picks his character to play with.

Can remove the player using psServer::RemovePlayer if invalid.

void AuthenticationServer::HandleAuthent ( MsgEntry me,
Client notused 
)
protected

Handles an authenticate message from the message queue.

This method recieves a authenticate message. Uses the following steps to authenticate a client. Sends a psAuthMessageApproved message back to the client if it was successfully authenticated and adds the client to the current client list.

Parameters
meIs a message entry that contains the authenticate message.
notusedNot used.
See also
psAuthMessageApproved
void AuthenticationServer::HandleDisconnect ( MsgEntry me,
Client notused 
)
protected

Handles a disconnect message from the message queue.

This will remove the player from the server using psServer::RemovePlayer()

Parameters
meIs the disconnect message that was recieved.
notusedNot used.
void AuthenticationServer::HandlePreAuthent ( MsgEntry me,
Client notused 
)
protected

This just questsions a random number (clientnum) from server.

It is used for authenticating

void AuthenticationServer::HandleStatusUpdate ( MsgEntry me,
Client client 
)

Updates the status of the client.

Currently is used to set client to ready.

void AuthenticationServer::HandleStringsRequest ( MsgEntry me,
Client notused 
)
protected

Handles a request for messsage strings from a client.

void AuthenticationServer::SendDisconnect ( Client client,
const char *  reason 
)

Sends a disconnect message to the given client.

This will send a disconnect to the given client. Before doing that it makes sure that no other clients have a reference to it before removing it from the world. Sends a message of type NetBase::BC_FINALPACKET to do the disconnect.

Parameters
clientThe client object for the client we wish to disconnect.
reasonA sting with the reason we are disconnecting the client.
See also
psDisconnectMessage
void AuthenticationServer::SendMsgStrings ( int  cnum,
bool  send_digest 
)

Util function to send string hash to client, because authentserver and npcmanager both send these.

Member Data Documentation

BanManager AuthenticationServer::banmanager
protected

Manages banned users and IP ranges.

Definition at line 155 of file authentserver.h.

ClientConnectionSet* AuthenticationServer::clients
protected

Holds a list of all the currently connect clients.

Definition at line 146 of file authentserver.h.

GuildManager* AuthenticationServer::guildmanager
protected

Is a manager for the guilds.

Definition at line 152 of file authentserver.h.

UserManager* AuthenticationServer::usermanager
protected

Is the user manager.

Definition at line 149 of file authentserver.h.


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