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

DownloadTransferED2K.h

Go to the documentation of this file.
00001 //
00002 // DownloadTransferED2K.h
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 
00022 #if !defined(AFX_DOWNLOADTRANSFERED2K_H__C03CF64E_8944_4C5C_BB14_C61C3F37E19E__INCLUDED_)
00023 #define AFX_DOWNLOADTRANSFERED2K_H__C03CF64E_8944_4C5C_BB14_C61C3F37E19E__INCLUDED_
00024 
00025 #pragma once
00026 
00027 #include "DownloadTransfer.h"
00028 
00029 class CEDClient;
00030 class CEDPacket;
00031 
00032 class CDownloadTransferED2K : public CDownloadTransfer  
00033 {
00034 // Construction
00035 public:
00036         CDownloadTransferED2K(CDownloadSource* pSource);
00037         virtual ~CDownloadTransferED2K();
00038         
00039 // Attributes
00040 public:
00041         CEDClient*              m_pClient;
00042         BOOL                    m_bHashset;
00043         DWORD                   m_tRequest;                             //When request was last sent
00044         DWORD                   m_tSources;                             //When source request was last sent
00045         DWORD                   m_tRanking;                             //When queue ranking was last received
00046         BYTE*                   m_pAvailable;
00047     FF::SimpleFragmentQueue m_oRequested;
00048         BOOL                    m_bUDP;
00049 protected:
00050         LPVOID                  m_pInflatePtr;
00051         CBuffer*                m_pInflateBuffer;
00052         QWORD                   m_nInflateOffset;
00053         QWORD                   m_nInflateLength;
00054         QWORD                   m_nInflateRead;
00055         QWORD                   m_nInflateWritten;
00056 
00057 // Operations
00058 public:
00059         virtual BOOL    Initiate();
00060         virtual void    Close(TRISTATE bKeepSource);
00061         virtual void    Boost();
00062         virtual DWORD   GetAverageSpeed();
00063         virtual DWORD   GetMeasuredSpeed();
00064     virtual BOOL        SubtractRequested(FF::SimpleFragmentList& ppFragments);
00065         virtual BOOL    OnRun();
00066         virtual BOOL    OnConnected();
00067         virtual void    OnDropped(BOOL bError);
00068 public:
00069         BOOL    OnRunEx(DWORD tNow);
00070         BOOL    OnFileReqAnswer(CEDPacket* pPacket);
00071         BOOL    OnFileNotFound(CEDPacket* pPacket);
00072         BOOL    OnFileStatus(CEDPacket* pPacket);
00073         BOOL    OnHashsetAnswer(CEDPacket* pPacket);
00074         BOOL    OnQueueRank(CEDPacket* pPacket);
00075         BOOL    OnRankingInfo(CEDPacket* pPacket);
00076         BOOL    OnFileComment(CEDPacket* pPacket);
00077         BOOL    OnStartUpload(CEDPacket* pPacket);
00078         BOOL    OnFinishUpload(CEDPacket* pPacket);
00079         BOOL    OnSendingPart(CEDPacket* pPacket);
00080         BOOL    OnCompressedPart(CEDPacket* pPacket);
00081         void    SetQueueRank(int nRank);
00082 protected:
00083         void    Send(CEDPacket* pPacket, BOOL bRelease = TRUE);
00084         BOOL    SendPrimaryRequest();
00085         BOOL    SendSecondaryRequest();
00086         BOOL    SendFragmentRequests();
00087         void    ClearRequests();
00088     BOOL        SelectFragment(const FF::SimpleFragmentList& oPossible, QWORD& nOffset, QWORD& nLength);
00089         BOOL    RunQueued(DWORD tNow);
00090 
00091 };
00092 
00093 #endif // !defined(AFX_DOWNLOADTRANSFERED2K_H__C03CF64E_8944_4C5C_BB14_C61C3F37E19E__INCLUDED_)

Generated on Thu Dec 15 10:39:40 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2