Planeshift
|
00001 /* 00002 * psnetmanager.h by Matze Braun <[email protected]> 00003 * 00004 * Copyright (C) 2001 Atomic Blue ([email protected], http://www.atomicblue.org) 00005 * 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation (version 2 of the License) 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 */ 00019 #ifndef __PSNETMANAGER_H__ 00020 #define __PSNETMANAGER_H__ 00021 00022 #include <csutil/csstring.h> 00023 #include <csutil/refcount.h> 00024 00025 class psNetConnection; 00026 class psAuthenticationClient; 00027 class ClientMsgHandler; 00028 class psUserCommands; 00029 class psGuildCommands; 00030 class psGroupCommands; 00031 class psUtilityCommands; 00032 class psAdminCommands; 00033 class CmdHandler; 00034 class MsgHandler; 00035 00040 class psNetManager : public csRefCount 00041 { 00042 protected: 00043 00044 public: 00045 psNetManager(); 00046 virtual ~psNetManager(); 00047 00048 bool Initialize(iObjectRegistry* object_reg ); 00049 00051 bool Connect(const char* server, int port); 00052 00054 void Disconnect(); 00055 00057 void Authenticate(const csString & name, const csString & pwd, const csString & pwd256); 00058 00059 ClientMsgHandler *GetMsgHandler(); 00060 CmdHandler *GetCmdHandler() { return cmdhandler; } 00061 00062 const char *GetLastError() { return errormsg; } 00063 const char *GetAuthMessage(); 00064 00065 psNetConnection *GetConnection() { return connection; } 00066 00067 bool IsConnected() { return connected; } 00068 00069 protected: 00070 iObjectRegistry* object_reg; 00071 psNetConnection* connection; 00072 csRef<ClientMsgHandler> msghandler; 00073 csRef<psAuthenticationClient> authclient; 00074 00075 /* Command stuff here */ 00076 csRef<CmdHandler> cmdhandler; 00077 csRef<psUserCommands> usercmds; 00078 csRef<psGuildCommands> guildcmds; 00079 csRef<psGroupCommands> groupcmds; 00080 csRef<psUtilityCommands> utilcmds; 00081 csRef<psAdminCommands> admincmds; 00082 bool connected; 00083 csString errormsg; 00084 }; 00085 00086 #endif 00087