00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(AFX_DOWNLOADTRANSFER_H__DB393F56_C75B_424C_85E5_FF44300E255B__INCLUDED_)
00023 #define AFX_DOWNLOADTRANSFER_H__DB393F56_C75B_424C_85E5_FF44300E255B__INCLUDED_
00024
00025 #pragma once
00026
00027 #include "Transfer.h"
00028 #include "FileFragments.hpp"
00029
00030 class CDownload;
00031 class CDownloadSource;
00032
00033 class CDownloadTransfer : public CTransfer
00034 {
00035
00036 public:
00037 CDownloadTransfer(CDownloadSource* pSource, PROTOCOLID nProtocol);
00038 virtual ~CDownloadTransfer();
00039
00040
00041 public:
00042 PROTOCOLID m_nProtocol;
00043 CDownload* m_pDownload;
00044 CDownloadTransfer* m_pDlPrev;
00045 CDownloadTransfer* m_pDlNext;
00046 CDownloadSource* m_pSource;
00047 public:
00048 int m_nState;
00049 int m_nQueuePos;
00050 int m_nQueueLen;
00051 CString m_sQueueName;
00052 public:
00053 QWORD m_nOffset;
00054 QWORD m_nLength;
00055 QWORD m_nPosition;
00056 QWORD m_nDownloaded;
00057 public:
00058 BOOL m_bWantBackwards;
00059 BOOL m_bRecvBackwards;
00060
00061
00062 public:
00063 virtual BOOL Initiate() = 0;
00064 virtual void Close(TRISTATE bKeepSource);
00065 virtual void Boost();
00066 virtual DWORD GetAverageSpeed();
00067 virtual DWORD GetMeasuredSpeed();
00068 virtual BOOL SubtractRequested(FF::SimpleFragmentList& ppFragments) = 0;
00069 virtual BOOL UnrequestRange(QWORD nOffset, QWORD nLength) { return FALSE; }
00070 virtual CString GetStateText(BOOL bLong);
00071 virtual BOOL OnRun();
00072 void SetState(int nState);
00073 protected:
00074 void ChunkifyRequest(QWORD* pnOffset, QWORD* pnLength, QWORD nChunk, BOOL bVerifyLock);
00075
00076 };
00077
00078 enum
00079 {
00080 dtsNull, dtsConnecting, dtsRequesting, dtsHeaders, dtsDownloading,
00081 dtsFlushing, dtsTiger, dtsHashset, dtsMetadata, dtsBusy, dtsEnqueue, dtsQueued,
00082 dtsTorrent,
00083
00084 dtsCountAll = -1,
00085 dtsCountNotQueued = -2,
00086 dtsCountNotConnecting = -3,
00087 dtsCountTorrentAndActive = -4
00088 };
00089
00090
00091 #endif // !defined(AFX_DOWNLOADTRANSFER_H__DB393F56_C75B_424C_85E5_FF44300E255B__INCLUDED_)