Planeshift
authentserver.h
Go to the documentation of this file.
1 /*
2  * AuthentServer.h by Keith Fulton <keith@paqrat.com>
3  *
4  * Copyright (C) 2001 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 #ifndef __AUTHENTICATIONSERVER_H__
20 #define __AUTHENTICATIONSERVER_H__
21 
22 //=============================================================================
23 // Crystal Space Includes
24 //=============================================================================
25 #include <csutil/ref.h>
26 #include <csutil/hash.h>
27 
28 //=============================================================================
29 // Local Includes
30 //=============================================================================
31 #include "msgmanager.h" // Parent class
32 
35 class UserManager;
36 class GuildManager;
37 class Client;
38 
39 struct BanEntry
40 {
41  AccountID account;
42  csString ipRange;
43  time_t start;
44  time_t end;
45  csString reason;
46  bool banIP;
47 };
48 
51 {
52 public:
53  BanManager();
54  ~BanManager();
55 
56  bool RemoveBan(AccountID account);
57  bool AddBan(AccountID account, csString ipRange, time_t duration, csString reason, bool banIP);
58  BanEntry* GetBanByAccount(AccountID account);
59  BanEntry* GetBanByIPRange(csString IPRange);
60 
61 protected:
62  csHash<BanEntry*, AccountID> banList_IDHash;
63  csArray<BanEntry*> banList_IPRList;
64 };
65 
76 class AuthenticationServer : public MessageManager<AuthenticationServer>
77 {
78 public:
79 
97  UserManager* usermgr,
98  GuildManager* gm);
99 
107  virtual ~AuthenticationServer();
108 
121  void SendDisconnect(Client* client,const char* reason);
122 
127  void SendMsgStrings(int cnum, bool send_digest);
128 
132  void HandleStatusUpdate(MsgEntry* me, Client* client);
133 
138  {
139  return &banmanager;
140  }
141 
142 
143 protected:
144 
147 
150 
153 
156 
160  bool CheckAuthenticationPreCondition(int clientnum, bool netversionok, const char* sUser);
161 
174  void HandleAuthent(MsgEntry* me, Client* notused);
175 
179  void HandleStringsRequest(MsgEntry* me, Client* notused);
180 
186  void HandlePreAuthent(MsgEntry* me, Client* notused);
187 
197  void HandleDisconnect(MsgEntry* me,Client* notused);
198 
204  void HandleAuthCharacter(MsgEntry* me, Client* notused);
205 };
206 
207 #endif
208 
csString ipRange
Definition: authentserver.h:42
BanManager banmanager
Manages banned users and IP ranges.
Used to manage incoming user commands from a client.
Definition: usermanager.h:53
GuildManager * guildmanager
Is a manager for the guilds.
UserManager * usermanager
Is the user manager.
The structure of 1 queue entry (pointer to a message)
Definition: message.h:143
time_t start
Definition: authentserver.h:43
time_t end
Definition: authentserver.h:44
Holds list of banned accounts and IP ranges.
Definition: authentserver.h:50
BanManager * GetBanManager()
Get the Ban Manager that hold information regarding baned clients.
Authentication handling.
Definition: authentserver.h:76
bool banIP
Definition: authentserver.h:46
Message sent from server to client containing the message strings hash table.
Definition: messages.h:2586
AccountID account
Definition: authentserver.h:41
This class collects data of a netclient.
Definition: client.h:95
ClientConnectionSet * clients
Holds a list of all the currently connect clients.
csString reason
Definition: authentserver.h:45
csHash< BanEntry *, AccountID > banList_IDHash
Definition: authentserver.h:62
This class is a list of several CLient objects, it&#39;s designed for finding clients very fast based on ...
Definition: clients.h:58
csArray< BanEntry * > banList_IPRList
Full list of all active bans.
Definition: authentserver.h:63
Provides a manager to facilitate subscriptions.
Definition: msgmanager.h:106