00001 /*************************************************************************** 00002 * Copyright (C) 2005 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 00021 #ifndef LIBCUSTOMPIC_EVAREQUESTAGENT_H 00022 #define LIBCUSTOMPIC_EVAREQUESTAGENT_H 00023 00024 #include "evapicpacket.h" 00025 #include <string> 00026 00027 class EvaRequestAgentPacket : public EvaPicOutPacket{ 00028 public: 00029 EvaRequestAgentPacket(const unsigned char *fileAgentToken, const unsigned short tokenLength); 00030 EvaRequestAgentPacket(const EvaRequestAgentPacket &rhs); 00031 virtual ~EvaRequestAgentPacket(); 00032 00033 EvaRequestAgentPacket &operator=(const EvaRequestAgentPacket &rhs); 00034 00035 const unsigned int getQunID() const {return qunID; } 00036 const unsigned char *getMD5() const { return md5;} 00037 const std::string &getFileName() const { return fileName; } 00038 const unsigned int getImageLength() const { return imageLength; } 00039 00040 00041 void setQunID(const unsigned int id) { qunID=id;} 00042 void setMd5(const unsigned char *value); 00043 void setImageLength(const unsigned short len) { imageLength = len; } 00044 void setFileName( const std::string &name) { fileName = name ;} 00045 00046 const unsigned char *getFileAgentToken() const { return fileAgentKey; } 00047 const unsigned short getTokenLength() const { return tokenLength; } 00048 protected: 00049 int putBody(unsigned char *buf); 00050 private: 00051 unsigned int qunID; 00052 00053 // for send file info 00054 unsigned char md5[16]; // always 16 bytes long 00055 unsigned int imageLength; 00056 std::string fileName; 00057 00058 unsigned char *fileAgentToken; 00059 unsigned short tokenLength; 00060 }; 00061 00062 00063 class RequestAgentReplyPacket : public EvaPicInPacket { 00064 public: 00065 RequestAgentReplyPacket() {} 00066 RequestAgentReplyPacket(unsigned char *buf, int len); 00067 RequestAgentReplyPacket(const RequestAgentReplyPacket &rhs); 00068 virtual ~RequestAgentReplyPacket() {}; 00069 00070 RequestAgentReplyPacket &operator=(const RequestAgentReplyPacket &rhs); 00071 00072 const unsigned short getReplyCode() const { return replyCode; } 00073 const unsigned int getSessionID() const { return sessionID; } 00074 const unsigned int getRedirectIP() const { return redirectIP; } 00075 const unsigned short getRedirectPort() const { return redirectPort; } 00076 const std::string &getMessage() const { return message; } 00077 protected: 00078 void parseBody(); 00079 private: 00080 unsigned short replyCode; 00081 unsigned int sessionID; 00082 00083 unsigned int redirectIP; 00084 unsigned short redirectPort; 00085 std::string message; 00086 }; 00087 00088 #endif 00089
1.4.4