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

evakeyrequest.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 EVAREQUESTKEYPACKET_H
00021 #define EVAREQUESTKEYPACKET_H
00022 
00023 #include "evapacket.h"
00024 
00025 class EvaRequestKeyPacket : public OutPacket
00026 {
00027 public:
00028         EvaRequestKeyPacket();
00029         EvaRequestKeyPacket(const unsigned char requestType);
00030         EvaRequestKeyPacket(const EvaRequestKeyPacket &rhs);
00031         virtual ~EvaRequestKeyPacket();
00032         
00033         EvaRequestKeyPacket &operator=(const EvaRequestKeyPacket &rhs);
00034         
00035         void setRequest(const unsigned char request){ this->request = request; }
00036         const unsigned char getRequest() const { return request; }
00037 
00038 protected:
00039         virtual int putBody(unsigned char* buf);
00040 
00041 private:
00042         unsigned char request;    
00043 };
00044 
00045 class EvaRequestKeyReplyPacket : public InPacket
00046 {
00047 public:
00048         EvaRequestKeyReplyPacket(){}
00049         EvaRequestKeyReplyPacket(unsigned char* buf, int len);
00050         EvaRequestKeyReplyPacket(const EvaRequestKeyReplyPacket &rhs);
00051         virtual ~EvaRequestKeyReplyPacket() {};
00052         
00053         const unsigned char getKeyType() const { return keyType; }
00054         const unsigned char *getKey() const { return key; }
00055         const unsigned char *getToken() const { return token; }
00056         const int getTokenLength() const { return tokenLength; }
00057         const unsigned char getReplyCode() const { return replyCode; }
00058         
00059         const bool isReplyOK() const { return replyCode == QQ_REQUEST_KEY_REPLY_OK; }
00060 
00061         EvaRequestKeyReplyPacket &operator=(const EvaRequestKeyReplyPacket &rhs);
00062 protected:
00063         virtual void parseBody();
00064 private:
00065         unsigned char replyCode;
00066         unsigned char keyType;
00067         unsigned char key[16];
00068         unsigned char token[256];
00069         int tokenLength;
00070 };
00071 
00072 #endif

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