00001 // 00002 // UploadTransferBT.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_UPLOADTRANSFERBT_H__3F81C2F1_E76C_4CCB_8AA2_AD6B9D877CBA__INCLUDED_) 00023 #define AFX_UPLOADTRANSFERBT_H__3F81C2F1_E76C_4CCB_8AA2_AD6B9D877CBA__INCLUDED_ 00024 00025 #pragma once 00026 00027 #include "UploadTransfer.h" 00028 #include "FileFragments.hpp" 00029 00030 class CBTClient; 00031 class CBTPacket; 00032 00033 00034 class CUploadTransferBT : public CUploadTransfer 00035 { 00036 // Construction 00037 public: 00038 CUploadTransferBT(CBTClient* pClient, CDownload* pDownload); 00039 virtual ~CUploadTransferBT(); 00040 00041 // Attributes 00042 public: 00043 CBTClient* m_pClient; 00044 CDownload* m_pDownload; 00045 public: 00046 BOOL m_bInterested; 00047 BOOL m_bChoked; 00048 int m_nRandomUnchoke; 00049 DWORD m_tRandomUnchoke; 00050 private: 00051 FF::SimpleFragmentQueue m_oRequested; 00052 FF::SimpleFragmentQueue m_oServed; 00053 00054 // Operations 00055 public: 00056 void SetChoke(BOOL bChoke); 00057 virtual void Close(BOOL bMessage = FALSE); 00058 virtual DWORD GetMeasuredSpeed(); 00059 virtual BOOL OnConnected(); 00060 virtual BOOL OnRun(); 00061 public: 00062 BOOL OnInterested(CBTPacket* pPacket); 00063 BOOL OnUninterested(CBTPacket* pPacket); 00064 BOOL OnRequest(CBTPacket* pPacket); 00065 BOOL OnCancel(CBTPacket* pPacket); 00066 protected: 00067 BOOL OpenFile(); 00068 BOOL ServeRequests(); 00069 00070 }; 00071 00072 #endif // !defined(AFX_UPLOADTRANSFERBT_H__3F81C2F1_E76C_4CCB_8AA2_AD6B9D877CBA__INCLUDED_)