Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

evalogin.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by yunfan                                          *
00003  *   yunfan_zg@163.com                                                     *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
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  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef LIBEVALOGIN_H
00021 #define LIBEVALOGIN_H
00022 
00023 #include "evapacket.h"
00024 #include <string>
00025 
00026 class LoginPacket : public OutPacket {    
00027 public:
00028         LoginPacket() {}
00029         LoginPacket(unsigned char loginMode);
00030         LoginPacket(const LoginPacket &rhs);
00031         virtual ~LoginPacket();
00032         
00033         OutPacket * copy() { return new LoginPacket(*this);}
00034         LoginPacket &operator=(const LoginPacket &rhs);
00035         const unsigned char getLoginMode() const { return mLoginMode; }
00036 protected:
00037         virtual int putBody(unsigned char *buf);
00038 private:
00039         unsigned char mLoginMode;
00040 };
00041 
00042 class LoginReplyPacket : public InPacket {
00043 public:
00044         LoginReplyPacket() {}
00045         LoginReplyPacket(unsigned char *sbuf, int len) ;  
00046         LoginReplyPacket(const LoginReplyPacket &rhs);
00047         virtual ~LoginReplyPacket() {};
00048         
00049         InPacket * copy() { return new LoginReplyPacket(*this);}
00050         LoginReplyPacket &operator=(const LoginReplyPacket &rhs);
00051         const unsigned char getReplyCode() const { return replyCode; };
00052         const unsigned int getRedirectedIP() const { return redirectedIP; }
00053         const short getRedirectedPort() const { return redirectedPort; }
00054         const std::string &getReplyMessage() const { return replyMessage; }
00055         
00056         const int getQQ() const { return qqNum; }
00057         const unsigned int getMyIP() const { return IP; }
00058         const unsigned short getMyPort() const { return port; }
00059         const int getLoginTime() const { return loginTime; };
00060         const unsigned int getServerIP() const { return serverIP; }
00061         const short getServerPort() const { return serverPort; }
00062         const unsigned int getLastLoginIP() const { return lastLoginIP; }
00063         const int getLastLoginTime() const { return lastLoginTime; }
00064         
00065 protected:
00066         virtual void parseBody();
00067 private:        
00068         int qqNum;
00069         unsigned int IP;
00070         unsigned short port;
00071         int loginTime;
00072         unsigned int serverIP;
00073         short serverPort;       
00074         unsigned int lastLoginIP;
00075         int lastLoginTime;
00076         
00077         // only the part below is useful to us
00078         unsigned char clientKey[32];
00079         unsigned int redirectedIP;
00080         short redirectedPort;
00081                 
00082         unsigned char replyCode;
00083         
00084         // note that reply messege is encoded by "GB18030"
00085         std::string replyMessage;
00086  
00087 };
00088 
00089 class LogoutPacket : public OutPacket {
00090 public:
00091         LogoutPacket();
00092         LogoutPacket(const LogoutPacket &rhs);
00093         virtual ~LogoutPacket() {};
00094         OutPacket * copy() { return new LogoutPacket(*this);}
00095         LogoutPacket &operator=(const LogoutPacket &rhs);
00096         
00097 protected:
00098         virtual int putBody(unsigned char *buf);
00099 };
00100 
00101 class KeepAlivePacket : public OutPacket {    
00102 public:
00103         KeepAlivePacket( );
00104         KeepAlivePacket( const KeepAlivePacket &rhs );
00105         virtual ~KeepAlivePacket( ) {};    
00106     
00107         OutPacket * copy() { return new KeepAlivePacket(*this);}
00108         KeepAlivePacket &operator=(const KeepAlivePacket &rhs );
00109 protected:
00110         virtual int putBody(unsigned char *buf) ;
00111 };
00112 
00113 class KeepAliveReplyPacket: public InPacket 
00114 {
00115 public: 
00116         KeepAliveReplyPacket() {}
00117         KeepAliveReplyPacket(unsigned char *buf, int len);
00118         KeepAliveReplyPacket(const KeepAliveReplyPacket &rhs);
00119         virtual ~KeepAliveReplyPacket(){};
00120  
00121         const int numOnlineUsers() const { return onlineUsers; }
00122         const std::string &getMyIP() const { return myIP; }
00123         const short getMyPort() const { return myPort; }
00124         
00125         KeepAliveReplyPacket &operator=(const KeepAliveReplyPacket &rhs);
00126 protected:
00127         virtual void parseBody() ;
00128 private:
00129         static const unsigned char KA_DIVIDER = 0x1f;
00130         static int onlineUsers;
00131         std::string myIP;
00132         short myPort; 
00133 };
00134 
00135 #endif

Generated on Mon May 15 20:48:41 2006 for libeva by  doxygen 1.4.4