Planeshift
|
00001 /* 00002 * ClientMsgHandler.h by Keith Fulton <[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 __CLNTMSGHANDLER_H__ 00020 #define __CLNTMSGHANDLER_H__ 00021 00022 #include <csutil/scf.h> 00023 00024 #include "net/msghandler.h" 00025 #include "util/genericevent.h" 00026 00027 class psNetConnection; 00028 class NetBase; 00029 struct iObjectRegistry; 00030 00035 class ClientMsgHandler : public MsgHandler 00036 { 00037 public: 00038 ClientMsgHandler(); 00039 virtual ~ClientMsgHandler(); 00040 00042 bool Initialize(NetBase *nb, iObjectRegistry* object_reg); 00043 00047 bool Connect(const char* server, int port); 00048 00053 void SendMessage(MsgEntry* msg) { netbase->SendMessage(msg); } 00054 00061 bool HandleEvent(iEvent &Event); 00062 00066 bool DispatchQueue(); 00067 00069 int GetNextSequenceNumber(msgtype mtype); 00070 00071 00073 DeclareGenericEventHandler(EventHandler,ClientMsgHandler,"planeshift.clientmsghandler"); 00074 csRef<EventHandler> scfiEventHandler; 00075 00076 protected: 00077 iObjectRegistry* object_reg; 00078 csHash<OrderedMessageChannel*> orderedMessages; 00079 }; 00080 00083 #endif