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

BTClient.h

Go to the documentation of this file.
00001 //
00002 // BTClient.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 #pragma once
00023 
00024 #include "Transfer.h"
00025 
00026 class CBTPacket;
00027 class CDownload;
00028 class CDownloadTransferBT;
00029 class CUploadTransferBT;
00030 
00031 
00032 class CBTClient : public CTransfer
00033 {
00034 // Construction
00035 public:
00036         CBTClient();
00037         virtual ~CBTClient();
00038 
00039 // Attributes
00040 public:
00041         SHA1                                    m_pGUID;
00042         BOOL                                    m_bExtended;            // Send extended details (User name, exact version, etc. For G2 capable clients)
00043         BOOL                                    m_bExchange;            // Exchange sources/other info (with extended client)
00044 public:
00045         CUploadTransferBT*              m_pUpload;
00046         CDownload*                              m_pDownload;
00047         CDownloadTransferBT*    m_pDownloadTransfer;
00048 protected:
00049         BOOL                                    m_bShake;
00050         BOOL                                    m_bOnline;
00051         BOOL                                    m_bClosing;
00052 
00053 // Operations
00054 public:
00055         virtual BOOL    Connect(CDownloadTransferBT* pDownloadTransfer);
00056         virtual void    AttachTo(CConnection* pConnection);
00057         virtual void    Close();
00058 public:
00059         void                    Send(CBTPacket* pPacket, BOOL bRelease = TRUE);
00060 protected:
00061         virtual BOOL    OnRun();
00062         virtual BOOL    OnConnected();
00063         virtual void    OnDropped(BOOL bError);
00064         virtual BOOL    OnWrite();
00065         virtual BOOL    OnRead();
00066 protected:
00067         void                    SendHandshake(BOOL bPart1, BOOL bPart2);
00068         BOOL                    OnHandshake1();                                                         // First part of handshake
00069         BOOL                    OnHandshake2();                                                         // Second part- Peer ID
00070         //BOOL                  OnNoHandshake2();                                                       // If no peer ID is received
00071         BOOL                    OnOnline();
00072         BOOL                    OnPacket(CBTPacket* pPacket);
00073         void                    SendBeHandshake();                                                      // Send extended client handshake
00074         BOOL                    OnBeHandshake(CBTPacket* pPacket);                      // Process extended client handshake
00075         BOOL                    OnSourceRequest(CBTPacket* pPacket);
00076         void                    DetermineUserAgent();                                           // Figure out the other client name/version from the peer ID
00077 
00078 public:
00079         inline BOOL IsOnline() const { return m_bOnline; }
00080 
00081 };

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