Planeshift
psnetmanager.h
Go to the documentation of this file.
1 /*
2  * psnetmanager.h by Matze Braun <MatzeBraun@gmx.de>
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 __PSNETMANAGER_H__
20 #define __PSNETMANAGER_H__
21 
22 #include <csutil/csstring.h>
23 #include <csutil/refcount.h>
24 
25 class psNetConnection;
27 class ClientMsgHandler;
28 class psUserCommands;
29 class psGuildCommands;
30 class psGroupCommands;
31 class psUtilityCommands;
32 class psAdminCommands;
33 class CmdHandler;
34 class MsgHandler;
35 
40 class psNetManager : public csRefCount
41 {
42 protected:
43 
44 public:
45  psNetManager();
46  virtual ~psNetManager();
47 
48  bool Initialize(iObjectRegistry* object_reg );
49 
51  bool Connect(const char* server, int port);
52 
54  void Disconnect();
55 
57  void Authenticate(const csString & name, const csString & pwd, const csString & pwd256);
58 
61 
62  const char *GetLastError() { return errormsg; }
63  const char *GetAuthMessage();
64 
66 
67  bool IsConnected() { return connected; }
68 
69 protected:
70  iObjectRegistry* object_reg;
72  csRef<ClientMsgHandler> msghandler;
73  csRef<psAuthenticationClient> authclient;
74 
75  /* Command stuff here */
76  csRef<CmdHandler> cmdhandler;
77  csRef<psUserCommands> usercmds;
78  csRef<psGuildCommands> guildcmds;
79  csRef<psGroupCommands> groupcmds;
80  csRef<psUtilityCommands> utilcmds;
81  csRef<psAdminCommands> admincmds;
82  bool connected;
83  csString errormsg;
84 };
85 
86 #endif
87 
csRef< psAuthenticationClient > authclient
Definition: psnetmanager.h:73
csRef< psGroupCommands > groupcmds
Definition: psnetmanager.h:79
Handles Authentication details from the client to the server.
Definition: authentclient.h:80
Class to handle general player commands.
Definition: cmdutil.h:38
Manager class for handling guild client commands.
Definition: cmdguilds.h:37
ClientMsgHandler * GetMsgHandler()
Client-side UDP handler.
Definition: connection.h:42
Handles messages to be sent out, connects to server and send those.
psNetConnection * connection
Definition: psnetmanager.h:71
csRef< ClientMsgHandler > msghandler
Definition: psnetmanager.h:72
psNetConnection * GetConnection()
Definition: psnetmanager.h:65
bool IsConnected()
Definition: psnetmanager.h:67
bool Connect(const char *server, int port)
Connect to given server and port.
virtual ~psNetManager()
This class holds references to different network classes and provides some conveniance functions to a...
Definition: psnetmanager.h:40
void Disconnect()
Disconnect from server.
Manages different commands that are player based in nature.
Definition: cmdusers.h:45
Manager class to help with handling of &#39;group&#39; commands.
Definition: cmdgroups.h:38
csRef< psUtilityCommands > utilcmds
Definition: psnetmanager.h:80
const char * GetAuthMessage()
This class is the client&#39;s and server&#39;s main interface for either sending network messages out or get...
Definition: msghandler.h:106
const char * GetLastError()
Definition: psnetmanager.h:62
CmdHandler * GetCmdHandler()
Definition: psnetmanager.h:60
csString errormsg
Definition: psnetmanager.h:83
iObjectRegistry * object_reg
Definition: psnetmanager.h:70
void Authenticate(const csString &name, const csString &pwd, const csString &pwd256)
Sends an authentication message to the server.
csRef< psGuildCommands > guildcmds
Definition: psnetmanager.h:78
bool Initialize(iObjectRegistry *object_reg)
csRef< psUserCommands > usercmds
Definition: psnetmanager.h:77
csRef< psAdminCommands > admincmds
Definition: psnetmanager.h:81
csRef< CmdHandler > cmdhandler
Definition: psnetmanager.h:76
This implements a subscriber object which handles admin-oriented commands.
Definition: cmdadmin.h:42