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

DownloadTransferBT.h

Go to the documentation of this file.
00001 //
00002 // DownloadTransferBT.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_DOWNLOADTRANSFERBT_H__80A2A47F_DE35_4DB3_ACF7_8B6BC023AD44__INCLUDED_)
00023 #define AFX_DOWNLOADTRANSFERBT_H__80A2A47F_DE35_4DB3_ACF7_8B6BC023AD44__INCLUDED_
00024 
00025 #pragma once
00026 
00027 #include "DownloadTransfer.h"
00028 
00029 class CBTClient;
00030 class CBTPacket;
00031 
00032 
00033 class CDownloadTransferBT : public CDownloadTransfer
00034 {
00035 // Construction
00036 public:
00037         CDownloadTransferBT(CDownloadSource* pSource, CBTClient* pClient);
00038         virtual ~CDownloadTransferBT();
00039 
00040 // Attributes
00041 public:
00042         CBTClient*              m_pClient;
00043         BOOL                    m_bChoked;
00044         BOOL                    m_bInterested;
00045 public:
00046         BYTE*                   m_pAvailable;
00047     FF::SimpleFragmentQueue m_oRequested;
00048         DWORD                   m_tRunThrottle;
00049         DWORD                   m_tSourceRequest;
00050 
00051 // Operations
00052 public:
00053         virtual BOOL    Initiate();
00054         virtual void    Close(TRISTATE bKeepSource);
00055         virtual void    Boost();
00056         virtual DWORD   GetAverageSpeed();
00057         virtual DWORD   GetMeasuredSpeed();
00058         virtual CString GetStateText(BOOL bLong);
00059         virtual BOOL    OnRun();
00060         virtual BOOL    OnConnected();
00061     virtual BOOL        SubtractRequested(FF::SimpleFragmentList& ppFragments);
00062         virtual BOOL    UnrequestRange(QWORD nOffset, QWORD nLength);
00063 public:
00064         BOOL    OnBitfield(CBTPacket* pPacket);
00065         BOOL    OnHave(CBTPacket* pPacket);
00066         BOOL    OnChoked(CBTPacket* pPacket);
00067         BOOL    OnUnchoked(CBTPacket* pPacket);
00068         BOOL    OnPiece(CBTPacket* pPacket);
00069         BOOL    OnSourceResponse(CBTPacket* pPacket);
00070         void    SendFinishedBlock(DWORD nBlock);
00071 protected:
00072         void    Send(CBTPacket* pPacket, BOOL bRelease = TRUE);
00073         void    ShowInterest();
00074         BOOL    SendRequests();
00075     BOOL        SelectFragment(const FF::SimpleFragmentList& oPossible, QWORD& nOffset, QWORD& nLength);
00076 };
00077 
00078 #endif // !defined(AFX_DOWNLOADTRANSFERBT_H__80A2A47F_DE35_4DB3_ACF7_8B6BC023AD44__INCLUDED_)

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