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

CHostBrowser Class Reference

#include <HostBrowser.h>

Inheritance diagram for CHostBrowser:

CTransfer CConnection List of all members.

Public Types

enum  {
  hbsNull, hbsConnecting, hbsRequesting, hbsHeaders,
  hbsContent
}

Public Member Functions

 CHostBrowser (CBrowseHostWnd *pNotify=NULL, IN_ADDR *pAddress=NULL, WORD nPort=0, BOOL bMustPush=FALSE, GGUID *pClientID=NULL)
virtual ~CHostBrowser ()
BOOL Browse ()
void Stop (BOOL bCompleted=FALSE)
BOOL IsBrowsing () const
float GetProgress () const
virtual BOOL OnPush (GGUID *pClientID, CConnection *pConnection)

Public Attributes

int m_nState
CBrowseHostWndm_pNotify
CGProfilem_pProfile
BOOL m_bNewBrowse
IN_ADDR m_pAddress
WORD m_nPort
BOOL m_bMustPush
BOOL m_bCanPush
GGUID m_pPushID
GGUID m_pClientID
DWORD m_tPushed
BOOL m_bConnect
int m_nHits
CVendorm_pVendor
BOOL m_bCanChat
CString m_sServer
DWORD m_nProtocol
BOOL m_bDeflate
DWORD m_nLength
DWORD m_nReceived
CBufferm_pBuffer
LPVOID m_pInflate

Protected Member Functions

BOOL SendPush (BOOL bMessage)
void SendRequest ()
BOOL ReadResponseLine ()
BOOL ReadContent ()
BOOL StreamContent ()
BOOL StreamPacketsG1 ()
BOOL StreamPacketsG2 ()
BOOL StreamHTML ()
BOOL OnPacket (CG1Packet *pPacket)
BOOL OnPacket (CG2Packet *pPacket)
void OnProfilePacket (CG2Packet *pPacket)
virtual BOOL OnConnected ()
virtual BOOL OnRead ()
virtual void OnDropped (BOOL bError)
virtual BOOL OnHeaderLine (CString &strHeader, CString &strValue)
virtual BOOL OnHeadersComplete ()
virtual BOOL OnRun ()

Member Enumeration Documentation

anonymous enum
 

Enumeration values:
hbsNull 
hbsConnecting 
hbsRequesting 
hbsHeaders 
hbsContent 

Definition at line 71 of file HostBrowser.h.


Constructor & Destructor Documentation

CHostBrowser::CHostBrowser CBrowseHostWnd pNotify = NULL,
IN_ADDR *  pAddress = NULL,
WORD  nPort = 0,
BOOL  bMustPush = FALSE,
GGUID pClientID = NULL
 

Definition at line 50 of file HostBrowser.cpp.

References hbsNull, m_bCanChat, m_bCanPush, m_bConnect, m_bMustPush, m_bNewBrowse, m_nHits, m_nPort, m_nState, m_pAddress, m_pBuffer, m_pClientID, m_pInflate, m_pNotify, m_pProfile, m_pVendor, m_tPushed, and NULL.

CHostBrowser::~CHostBrowser  )  [virtual]
 

Definition at line 78 of file HostBrowser.cpp.

References m_pProfile, and Stop().


Member Function Documentation

BOOL CHostBrowser::Browse  ) 
 

Definition at line 88 of file HostBrowser.cpp.

References CTransfer::ConnectTo(), hbsConnecting, IDS_BROWSE_CANT_CONNECT_TO, IDS_BROWSE_CANT_PUSH_TO, IDS_BROWSE_CONNECTING_TO, IDS_BROWSE_PUSHED_TO, m_bMustPush, CConnection::m_hSocket, m_nHits, m_nPort, m_nState, m_pAddress, m_pProfile, CTransfers::m_pSection, CConnection::m_sAddress, CShareazaApp::Message(), MSG_ERROR, MSG_SYSTEM, NULL, SendPush(), theApp, and Transfers.

Referenced by CBrowseHostWnd::OnBrowseHostRefresh(), and CBrowseHostWnd::OnCreate().

float CHostBrowser::GetProgress  )  const
 

Definition at line 164 of file HostBrowser.cpp.

References hbsContent, m_nLength, m_nReceived, and m_nState.

Referenced by CBrowseHeaderCtrl::Update(), and CBrowseHostWnd::UpdateMessages().

BOOL CHostBrowser::IsBrowsing  )  const
 

Definition at line 159 of file HostBrowser.cpp.

References hbsNull, and m_nState.

Referenced by CBrowseHostWnd::OnUpdateBrowseHostStop().

BOOL CHostBrowser::OnConnected  )  [protected, virtual]
 

Reimplemented from CConnection.

Definition at line 174 of file HostBrowser.cpp.

References CConnection::OnConnected(), and SendRequest().

void CHostBrowser::OnDropped BOOL  bError  )  [protected, virtual]
 

Reimplemented from CConnection.

Definition at line 205 of file HostBrowser.cpp.

References hbsConnecting, IDS_BROWSE_CANT_CONNECT_TO, IDS_BROWSE_DROPPED, CConnection::m_hSocket, CBuffer::m_nLength, m_nLength, m_nState, CConnection::m_pInput, CConnection::m_sAddress, m_tPushed, CShareazaApp::Message(), MSG_ERROR, ReadContent(), SendPush(), Stop(), and theApp.

Referenced by OnRun().

BOOL CHostBrowser::OnHeaderLine CString &  strHeader,
CString &  strValue
[protected, virtual]
 

Reimplemented from CTransfer.

Definition at line 406 of file HostBrowser.cpp.

References CVendorCache::LookupByName(), m_bDeflate, m_nLength, m_nProtocol, m_pVendor, CConnection::m_sAddress, m_sServer, CShareazaApp::Message(), MSG_DEBUG, PROTOCOL_G1, PROTOCOL_G2, theApp, and VendorCache.

BOOL CHostBrowser::OnHeadersComplete  )  [protected, virtual]
 

Reimplemented from CConnection.

Definition at line 440 of file HostBrowser.cpp.

References hbsContent, IDS_BROWSE_BAD_RESPONSE, IDS_BROWSE_DOWNLOADING_FROM, inflateInit, m_bDeflate, CConnection::m_mInput, m_nLength, m_nProtocol, m_nReceived, m_nState, m_pBuffer, m_pInflate, CConnection::m_sAddress, CShareazaApp::Message(), MSG_DEFAULT, MSG_ERROR, NULL, PROTOCOL_G1, PROTOCOL_G2, Stop(), theApp, TCPBandwidthMeter::tLast, and Z_OK.

BOOL CHostBrowser::OnPacket CG2Packet pPacket  )  [protected]
 

Definition at line 656 of file HostBrowser.cpp.

References Downloads, CQueryHit::FromPacket(), G2_PACKET_HIT, G2_PACKET_PHYSICAL_FOLDER, G2_PACKET_PROFILE_AVATAR, G2_PACKET_PROFILE_DELIVERY, G2_PACKET_VIRTUAL_FOLDER, IDS_BROWSE_PACKET_ERROR, m_bCanChat, m_bCanPush, CQueryHit::m_bChat, m_nHits, CQueryHit::m_pClientID, m_pClientID, CQueryHit::m_pNext, m_pNotify, m_pProfile, CConnection::m_sAddress, CShareazaApp::Message(), MSG_ERROR, NULL, CBrowseHostWnd::OnBrowseHits(), CBrowseHostWnd::OnHeadPacket(), CBrowseHostWnd::OnPhysicalTree(), OnProfilePacket(), CBrowseHostWnd::OnProfileReceived(), CDownloads::OnQueryHits(), CBrowseHostWnd::OnVirtualTree(), and theApp.

BOOL CHostBrowser::OnPacket CG1Packet pPacket  )  [protected]
 

Definition at line 626 of file HostBrowser.cpp.

References Downloads, CQueryHit::FromPacket(), G1_PACKET_HIT, IDS_BROWSE_PACKET_ERROR, m_bCanChat, m_bCanPush, CQueryHit::m_bChat, m_nHits, CPacket::m_nLength, CG1Packet::m_nType, CQueryHit::m_pClientID, m_pClientID, CQueryHit::m_pNext, m_pNotify, CConnection::m_sAddress, CShareazaApp::Message(), MSG_ERROR, NULL, CBrowseHostWnd::OnBrowseHits(), CDownloads::OnQueryHits(), and theApp.

Referenced by StreamPacketsG1(), and StreamPacketsG2().

void CHostBrowser::OnProfilePacket CG2Packet pPacket  )  [protected]
 

Definition at line 714 of file HostBrowser.cpp.

References CXMLElement::FromString(), CGProfile::FromXML(), CGProfile::IsValid(), m_pProfile, and NULL.

Referenced by OnPacket().

BOOL CHostBrowser::OnPush GGUID pClientID,
CConnection pConnection
[virtual]
 

Definition at line 288 of file HostBrowser.cpp.

References CTransfer::AttachTo(), CConnection::m_hSocket, m_nPort, m_pAddress, m_pClientID, CConnection::m_pHost, m_tPushed, and SendRequest().

Referenced by CBrowseHostWnd::OnPush().

BOOL CHostBrowser::OnRead  )  [protected, virtual]
 

Reimplemented from CConnection.

Definition at line 181 of file HostBrowser.cpp.

References hbsContent, hbsHeaders, hbsRequesting, m_nState, CConnection::m_pInput, CConnection::m_pOutput, NULL, CConnection::OnRead(), ReadContent(), CConnection::ReadHeaders(), and ReadResponseLine().

BOOL CHostBrowser::OnRun  )  [protected, virtual]
 

Reimplemented from CConnection.

Definition at line 229 of file HostBrowser.cpp.

References CSettings::Connection, hbsConnecting, hbsContent, hbsHeaders, hbsRequesting, IDS_BROWSE_TIMEOUT, CConnection::m_mInput, m_nState, CConnection::m_sAddress, CConnection::m_tConnected, CShareazaApp::Message(), MSG_ERROR, OnDropped(), CConnection::OnRun(), Settings, Stop(), theApp, CSettings::sConnection::TimeoutConnect, CSettings::sConnection::TimeoutHandshake, CSettings::sConnection::TimeoutTraffic, and TCPBandwidthMeter::tLast.

BOOL CHostBrowser::ReadContent  )  [protected]
 

Definition at line 491 of file HostBrowser.cpp.

References CBuffer::AddBuffer(), CBuffer::EnsureBuffer(), IDS_BROWSE_FINISHED, inflate(), CGProfile::IsValid(), m_bDeflate, CBuffer::m_nBuffer, m_nHits, CBuffer::m_nLength, m_nLength, m_nProtocol, m_nReceived, CBuffer::m_pBuffer, m_pBuffer, m_pInflate, CConnection::m_pInput, m_pNotify, m_pProfile, CConnection::m_sAddress, CShareazaApp::Message(), MSG_SYSTEM, NULL, CBrowseHostWnd::OnProfileReceived(), PROTOCOL_G1, PROTOCOL_G2, CBuffer::Remove(), Stop(), StreamHTML(), StreamPacketsG1(), StreamPacketsG2(), theApp, and Z_SYNC_FLUSH.

Referenced by OnDropped(), and OnRead().

BOOL CHostBrowser::ReadResponseLine  )  [protected]
 

Definition at line 352 of file HostBrowser.cpp.

References hbsHeaders, IDS_BROWSE_HTTPCODE, IDS_BROWSE_NOT_HTTP, m_nState, CConnection::m_pInput, CShareazaApp::Message(), MSG_DEBUG, MSG_ERROR, CBuffer::ReadLine(), Stop(), and theApp.

Referenced by OnRead().

BOOL CHostBrowser::SendPush BOOL  bMessage  )  [protected]
 

Definition at line 268 of file HostBrowser.cpp.

References CTransfer::Close(), IDS_BROWSE_PUSHED_TO, m_bCanPush, m_pClientID, CConnection::m_sAddress, m_tPushed, CShareazaApp::Message(), MSG_DEFAULT, Network, CNetwork::SendPush(), and theApp.

Referenced by Browse(), and OnDropped().

void CHostBrowser::SendRequest  )  [protected]
 

Definition at line 308 of file HostBrowser.cpp.

References CSettings::Bandwidth, CSettings::sBandwidth::Downloads, CSettings::Downloads, hbsRequesting, IDS_BROWSE_SENT_REQUEST, m_bConnect, m_bDeflate, m_bNewBrowse, CConnection::m_hSocket, CConnection::m_mInput, CConnection::m_mOutput, m_nLength, m_nProtocol, m_nState, CConnection::m_pHost, CConnection::m_pOutput, CConnection::m_sAddress, CShareazaApp::Message(), MSG_DEFAULT, CConnection::OnWrite(), TCPBandwidthMeter::pLimit, CBuffer::Print(), CSettings::sDownloads::RequestHTTP11, Settings, CSettings::SmartAgent(), and theApp.

Referenced by OnConnected(), and OnPush().

void CHostBrowser::Stop BOOL  bCompleted = FALSE  ) 
 

Definition at line 130 of file HostBrowser.cpp.

References CTransfer::Close(), hbsNull, IDS_BROWSE_CLOSED, inflateEnd(), CConnection::m_hSocket, m_nState, m_pBuffer, m_pInflate, CTransfers::m_pSection, CConnection::m_sAddress, m_tPushed, CShareazaApp::Message(), MSG_DEFAULT, NULL, theApp, and Transfers.

Referenced by CBrowseHostWnd::OnBrowseHostRefresh(), CBrowseHostWnd::OnBrowseHostStop(), CBrowseHostWnd::OnDestroy(), OnDropped(), OnHeadersComplete(), OnRun(), ReadContent(), ReadResponseLine(), StreamPacketsG1(), StreamPacketsG2(), and ~CHostBrowser().

BOOL CHostBrowser::StreamContent  )  [protected]
 

BOOL CHostBrowser::StreamHTML  )  [protected]
 

Definition at line 746 of file HostBrowser.cpp.

References CSettings::sGeneral::Debug, CSettings::General, CQueryHit::m_bBrowseHost, m_bCanPush, CQueryHit::m_bPush, m_nHits, CQueryHit::m_nPort, CQueryHit::m_nSize, CQueryHit::m_pAddress, m_pBuffer, m_pClientID, CQueryHit::m_pClientID, CConnection::m_pHost, CQueryHit::m_pNext, m_pNotify, CVendorCache::m_pNull, m_pVendor, CQueryHit::m_pVendor, CQueryHit::m_sName, CQueryHit::m_sURL, m_tPushed, CShareazaApp::Message(), MSG_DEBUG, NULL, CBrowseHostWnd::OnBrowseHits(), PROTOCOL_NULL, CBuffer::ReadLine(), Settings, theApp, TS_FALSE, TS_TRUE, CConnection::URLDecode(), and VendorCache.

Referenced by ReadContent().

BOOL CHostBrowser::StreamPacketsG1  )  [protected]
 

Definition at line 554 of file HostBrowser.cpp.

References CSettings::Gnutella1, IDS_BROWSE_PACKET_ERROR, CBuffer::m_nLength, CBuffer::m_pBuffer, m_pBuffer, CConnection::m_sAddress, CSettings::sGnutella1::MaximumPacket, CShareazaApp::Message(), MSG_ERROR, CG1Packet::New(), OnPacket(), CPacket::Release(), CBuffer::Remove(), Settings, Stop(), and theApp.

Referenced by ReadContent().

BOOL CHostBrowser::StreamPacketsG2  )  [protected]
 

Definition at line 594 of file HostBrowser.cpp.

References m_pBuffer, OnPacket(), CG2Packet::ReadBuffer(), CPacket::Release(), and Stop().

Referenced by ReadContent().


Member Data Documentation

BOOL CHostBrowser::m_bCanChat
 

Definition at line 61 of file HostBrowser.h.

Referenced by CHostBrowser(), OnPacket(), and CBrowseHostWnd::OnUpdateSearchChat().

BOOL CHostBrowser::m_bCanPush
 

Definition at line 54 of file HostBrowser.h.

Referenced by CHostBrowser(), OnPacket(), SendPush(), and StreamHTML().

BOOL CHostBrowser::m_bConnect
 

Definition at line 58 of file HostBrowser.h.

Referenced by CHostBrowser(), SendRequest(), and CBrowseHostWnd::UpdateMessages().

BOOL CHostBrowser::m_bDeflate
 

Definition at line 65 of file HostBrowser.h.

Referenced by OnHeaderLine(), OnHeadersComplete(), ReadContent(), and SendRequest().

BOOL CHostBrowser::m_bMustPush
 

Definition at line 53 of file HostBrowser.h.

Referenced by Browse(), CHostBrowser(), and CBrowseHostWnd::OnSearchChat().

BOOL CHostBrowser::m_bNewBrowse
 

Definition at line 50 of file HostBrowser.h.

Referenced by CHostBrowser(), and SendRequest().

int CHostBrowser::m_nHits
 

Definition at line 59 of file HostBrowser.h.

Referenced by Browse(), CHostBrowser(), OnPacket(), ReadContent(), StreamHTML(), and CBrowseHeaderCtrl::Update().

DWORD CHostBrowser::m_nLength
 

Definition at line 66 of file HostBrowser.h.

Referenced by GetProgress(), OnDropped(), OnHeaderLine(), OnHeadersComplete(), ReadContent(), and SendRequest().

WORD CHostBrowser::m_nPort
 

Definition at line 52 of file HostBrowser.h.

Referenced by Browse(), CHostBrowser(), OnPush(), CBrowseHostWnd::OnSearchChat(), and CBrowseHostWnd::UpdateMessages().

DWORD CHostBrowser::m_nProtocol
 

Definition at line 64 of file HostBrowser.h.

Referenced by OnHeaderLine(), OnHeadersComplete(), CBrowseHostWnd::OnSearchChat(), ReadContent(), and SendRequest().

DWORD CHostBrowser::m_nReceived
 

Definition at line 67 of file HostBrowser.h.

Referenced by GetProgress(), OnHeadersComplete(), and ReadContent().

int CHostBrowser::m_nState
 

Definition at line 46 of file HostBrowser.h.

Referenced by Browse(), CHostBrowser(), GetProgress(), IsBrowsing(), OnDropped(), OnHeadersComplete(), OnRead(), OnRun(), ReadResponseLine(), SendRequest(), Stop(), and CBrowseHostWnd::UpdateMessages().

IN_ADDR CHostBrowser::m_pAddress
 

Definition at line 51 of file HostBrowser.h.

Referenced by Browse(), CHostBrowser(), OnPush(), CBrowseHostWnd::OnSearchChat(), CBrowseHeaderCtrl::Update(), and CBrowseHostWnd::UpdateMessages().

CBuffer* CHostBrowser::m_pBuffer
 

Definition at line 68 of file HostBrowser.h.

Referenced by CHostBrowser(), OnHeadersComplete(), ReadContent(), Stop(), StreamHTML(), StreamPacketsG1(), and StreamPacketsG2().

GGUID CHostBrowser::m_pClientID
 

Definition at line 56 of file HostBrowser.h.

Referenced by CHostBrowser(), OnPacket(), OnPush(), CBrowseHostWnd::OnSearchChat(), SendPush(), and StreamHTML().

LPVOID CHostBrowser::m_pInflate
 

Definition at line 69 of file HostBrowser.h.

Referenced by CHostBrowser(), OnHeadersComplete(), ReadContent(), and Stop().

CBrowseHostWnd* CHostBrowser::m_pNotify
 

Definition at line 47 of file HostBrowser.h.

Referenced by CHostBrowser(), OnPacket(), ReadContent(), and StreamHTML().

CGProfile* CHostBrowser::m_pProfile
 

Definition at line 48 of file HostBrowser.h.

Referenced by Browse(), CHostBrowser(), OnPacket(), OnProfilePacket(), ReadContent(), CBrowseHeaderCtrl::Update(), CBrowseHostWnd::UpdateMessages(), and ~CHostBrowser().

GGUID CHostBrowser::m_pPushID
 

Definition at line 55 of file HostBrowser.h.

CVendor* CHostBrowser::m_pVendor
 

Definition at line 60 of file HostBrowser.h.

Referenced by CHostBrowser(), OnHeaderLine(), and StreamHTML().

CString CHostBrowser::m_sServer
 

Definition at line 63 of file HostBrowser.h.

Referenced by OnHeaderLine().

DWORD CHostBrowser::m_tPushed
 

Definition at line 57 of file HostBrowser.h.

Referenced by CHostBrowser(), OnDropped(), OnPush(), SendPush(), Stop(), StreamHTML(), and CBrowseHostWnd::UpdateMessages().


The documentation for this class was generated from the following files:
Generated on Thu Dec 15 10:40:07 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2