Planeshift
|
Authentication handling. More...
#include <authentserver.h>
Public Member Functions | |
AuthenticationServer (ClientConnectionSet *pCCS, UserManager *usermgr, GuildManager *gm) | |
Initializing Constructor. | |
BanManager * | GetBanManager () |
Get the Ban Manager that hold information regarding baned clients. | |
void | HandleStatusUpdate (MsgEntry *me, Client *client) |
Updates the status of the client. | |
void | SendDisconnect (Client *client, const char *reason) |
Sends a disconnect message to the given client. | |
void | SendMsgStrings (int cnum, bool send_digest) |
Util function to send string hash to client, because authentserver and npcmanager both send these. | |
virtual | ~AuthenticationServer () |
Destructor. | |
Protected Member Functions | |
bool | CheckAuthenticationPreCondition (int clientnum, bool netversionok, const char *sUser) |
Common preconditions for HandlePreAuthent and HandleAuthent. | |
void | HandleAuthCharacter (MsgEntry *me, Client *notused) |
Handles a message where a client picks his character to play with. | |
void | HandleAuthent (MsgEntry *me, Client *notused) |
Handles an authenticate message from the message queue. | |
void | HandleDisconnect (MsgEntry *me, Client *notused) |
Handles a disconnect message from the message queue. | |
void | HandlePreAuthent (MsgEntry *me, Client *notused) |
This just questsions a random number (clientnum) from server. | |
void | HandleStringsRequest (MsgEntry *me, Client *notused) |
Handles a request for messsage strings from a client. | |
Protected Attributes | |
BanManager | banmanager |
Manages banned users and IP ranges. | |
ClientConnectionSet * | clients |
Holds a list of all the currently connect clients. | |
GuildManager * | guildmanager |
Is a manager for the guilds. | |
UserManager * | usermanager |
Is the user manager. |
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.
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:
When either of these messages appear on the message queue, the corresponding function is called with the message as the argument.
pCCS | Reference to the client connection set. |
usermgr | Reference to the user manager. |
gm | Reference to the guild manager. |
virtual AuthenticationServer::~AuthenticationServer | ( | ) | [virtual] |
Destructor.
The destructor will un-subscribe this object from the message handler.
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.
Handles a message where a client picks his character to play with.
Can remove the player using psServer::RemovePlayer if invalid.
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.
me | Is a message entry that contains the authenticate message. |
notused | Not used. |
Handles a disconnect message from the message queue.
This will remove the player from the server using psServer::RemovePlayer()
me | Is the disconnect message that was recieved. |
notused | Not used. |
This just questsions a random number (clientnum) from server.
It is used for authenticating
Updates the status of the client.
Currently is used to set client to ready.
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.
client,: | The client object for the client we wish to disconnect. |
reason,: | A sting with the reason we are disconnecting the client. |
void AuthenticationServer::SendMsgStrings | ( | int | cnum, |
bool | send_digest | ||
) |
Util function to send string hash to client, because authentserver and npcmanager both send these.
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.