00001 /*************************************************************************** 00002 * Copyright (C) 2004-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 EVAUSERHEADPROTOCOLS_H 00022 #define EVAUSERHEADPROTOCOLS_H 00023 00024 #include "evauhpacket.h" 00025 #include <list> 00026 00027 class EvaUHInfoRequest : public EvaUHPacket { 00028 public: 00029 EvaUHInfoRequest(); 00030 virtual ~EvaUHInfoRequest() {} 00031 00032 void setQQList(const std::list<int> &l) { mList = l; } 00033 std::list<int> getQQList() { return mList; } 00034 protected: 00035 virtual const bool fillBody(unsigned char *buf, int *len); 00036 private: 00037 std::list<int> mList; 00038 }; 00039 00040 typedef struct { 00041 int id; 00042 unsigned int sessionId; 00043 char md5[16]; // the md5 value used as file name as well 00044 bool isUpdated; // useless for protocol, just help the client side code 00045 } UHInfoItem; 00046 00047 class EvaUHInfoReply : public EvaUHPacket { 00048 public: 00049 EvaUHInfoReply( const unsigned char *buf, const int len); 00050 virtual ~EvaUHInfoReply() {} 00051 00052 const int numInfoItems() { return mList.size(); } 00053 std::list<UHInfoItem> getInfoItems() { return mList; } 00054 const bool isSuccessful() const { return replyCode == 0x00; } 00055 protected: 00056 virtual const bool parseBody(); 00057 private: 00058 unsigned char replyCode; 00059 std::list<UHInfoItem> mList; 00060 }; 00061 00062 class EvaUHTransferRequest : public EvaUHPacket{ 00063 public: 00064 EvaUHTransferRequest(); 00065 virtual ~EvaUHTransferRequest() {} 00066 00067 void setUHInfo(const int id, const unsigned int sessionId) 00068 { mId = id; mSessionId = sessionId; } 00069 void setFileInfo(const unsigned int start, const unsigned int end) 00070 { mStart = start; mEnd = end; } 00071 protected: 00072 virtual const bool fillBody(unsigned char *buf, int *len); 00073 private: 00074 int mId; 00075 unsigned int mSessionId; 00076 unsigned int mStart; 00077 unsigned int mEnd; 00078 }; 00079 00080 class EvaUHTransferReply : public EvaUHPacket{ 00081 public: 00082 EvaUHTransferReply( const unsigned char *buf, const int len); 00083 virtual ~EvaUHTransferReply() {} 00084 00085 const int getQQ() const { return mId; } 00086 const unsigned int getSessionId() const { return mSessionId; } 00087 const unsigned int getFileSize() const { return mFileSize; } 00088 const unsigned int getStart() const { return mStart; } 00089 const unsigned int getPartSize() const { return mPartSize; } 00090 const unsigned char *getPartData() const { return mPartData; } 00091 00092 protected: 00093 virtual const bool parseBody(); 00094 private: 00095 int mId; 00096 unsigned int mSessionId; 00097 unsigned int mFileSize; 00098 unsigned int mStart; 00099 unsigned int mPartSize; 00100 unsigned char *mPartData; 00101 }; 00102 00103 #endif // EVAUSERHEADPROTOCOLS_H
1.4.4