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

CShakeNeighbour Class Reference

#include <ShakeNeighbour.h>

Inheritance diagram for CShakeNeighbour:

CNeighbour CConnection List of all members.

Public Member Functions

 CShakeNeighbour ()
virtual ~CShakeNeighbour ()
virtual BOOL ConnectTo (IN_ADDR *pAddress, WORD nPost, BOOL bAutomatic=FALSE, BOOL bNoUltraPeer=FALSE)
virtual void AttachTo (CConnection *pConnection)
virtual void Close (UINT nError=IDS_CONNECTION_CLOSED)

Protected Member Functions

virtual BOOL OnConnected ()
virtual BOOL OnRead ()
virtual void OnDropped (BOOL bError)
virtual BOOL OnRun ()
virtual BOOL OnHeaderLine (CString &strHeader, CString &strValue)
virtual BOOL OnHeadersComplete ()
virtual BOOL OnHeadersCompleteG1 ()
virtual BOOL OnHeadersCompleteG2 ()
void SendMinimalHeaders ()
void SendPublicHeaders ()
void SendPrivateHeaders ()
void SendHostHeaders (LPCTSTR pszMessage=NULL)
BOOL ReadResponse ()
void OnHandshakeComplete ()
BOOL IsClientObsolete ()
BOOL IsClientBad ()
BOOL IsClientBanned ()

Protected Attributes

BOOL m_bCanDeflate
BOOL m_bSentAddress
BOOL m_bG2Send
BOOL m_bG2Accept
BOOL m_bDeflateSend
BOOL m_bDeflateAccept
TRISTATE m_bUltraPeerSet
TRISTATE m_bUltraPeerNeeded
TRISTATE m_bUltraPeerLoaded

Constructor & Destructor Documentation

CShakeNeighbour::CShakeNeighbour  ) 
 

Definition at line 51 of file ShakeNeighbour.cpp.

References CSettings::sGnutella::DeflateHub2Hub, CSettings::sGnutella::DeflateLeaf2Hub, CSettings::Gnutella, CNeighboursWithConnect::IsG2Leaf(), m_bCanDeflate, m_bDeflateAccept, m_bDeflateSend, m_bG2Accept, m_bG2Send, m_bSentAddress, m_bUltraPeerLoaded, m_bUltraPeerNeeded, m_bUltraPeerSet, Neighbours, Settings, and TS_UNKNOWN.

CShakeNeighbour::~CShakeNeighbour  )  [virtual]
 

Definition at line 71 of file ShakeNeighbour.cpp.


Member Function Documentation

void CShakeNeighbour::AttachTo CConnection pConnection  )  [virtual]
 

Reimplemented from CConnection.

Definition at line 122 of file ShakeNeighbour.cpp.

References CNeighboursBase::Add(), CConnection::AttachTo(), CConnection::m_hSocket, CNeighbour::m_nState, CNetwork::m_pWakeup, Neighbours, Network, and nrsHandshake1.

Referenced by CNeighboursWithConnect::OnAccept().

void CShakeNeighbour::Close UINT  nError = IDS_CONNECTION_CLOSED  )  [virtual]
 

Reimplemented from CNeighbour.

Definition at line 146 of file ShakeNeighbour.cpp.

References CConnection::Close(), HostCache, CConnection::m_bInitiated, CNeighbour::m_nState, CConnection::m_pHost, nrsHandshake2, and CHostCache::OnFailure().

BOOL CShakeNeighbour::ConnectTo IN_ADDR *  pAddress,
WORD  nPost,
BOOL  bAutomatic = FALSE,
BOOL  bNoUltraPeer = FALSE
[virtual]
 

Definition at line 83 of file ShakeNeighbour.cpp.

References CNeighboursBase::Add(), CConnection::ConnectTo(), IDS_CONNECTION_ATTEMPTING, IDS_CONNECTION_CONNECT_FAIL, CNeighbour::m_bAutomatic, m_bUltraPeerSet, CConnection::m_hSocket, CNeighbour::m_nState, CConnection::m_pHost, CNetwork::m_pWakeup, CConnection::m_sAddress, CShareazaApp::Message(), MSG_DEFAULT, MSG_ERROR, Neighbours, Network, nrsConnecting, theApp, TS_FALSE, and TS_UNKNOWN.

Referenced by CNeighboursWithConnect::ConnectTo().

BOOL CShakeNeighbour::IsClientBad  )  [protected]
 

Definition at line 1507 of file ShakeNeighbour.cpp.

References _tcsistr(), and CConnection::m_sUserAgent.

Referenced by OnHeaderLine().

BOOL CShakeNeighbour::IsClientBanned  )  [protected]
 

Definition at line 1546 of file ShakeNeighbour.cpp.

References CConnection::m_sUserAgent.

Referenced by OnHeaderLine().

BOOL CShakeNeighbour::IsClientObsolete  )  [protected]
 

Definition at line 1455 of file ShakeNeighbour.cpp.

References _tcsistr(), and CConnection::m_sUserAgent.

Referenced by OnHeaderLine().

BOOL CShakeNeighbour::OnConnected  )  [protected, virtual]
 

Reimplemented from CConnection.

Definition at line 169 of file ShakeNeighbour.cpp.

References IDS_CONNECTION_CONNECTED, CNeighbour::m_nState, CConnection::m_pOutput, CConnection::m_sAddress, CShareazaApp::Message(), MSG_DEFAULT, nrsHandshake1, CConnection::OnConnected(), CNeighbour::OnWrite(), CBuffer::Print(), SendHostHeaders(), SendPublicHeaders(), and theApp.

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

Reimplemented from CNeighbour.

Definition at line 198 of file ShakeNeighbour.cpp.

References CConnection::Close(), IDS_CONNECTION_DROPPED, IDS_CONNECTION_REFUSED, CNeighbour::m_nState, and nrsConnecting.

void CShakeNeighbour::OnHandshakeComplete  )  [protected]
 

Definition at line 1354 of file ShakeNeighbour.cpp.

References CSettings::Bandwidth, CSettings::Connection, CSettings::sBandwidth::HubIn, CSettings::sBandwidth::HubOut, IDS_HANDSHAKE_GOTLEAF, IDS_HANDSHAKE_GOTPEER, CSettings::sBandwidth::LeafIn, CSettings::sBandwidth::LeafOut, m_bDeflateAccept, m_bDeflateSend, m_bG2Accept, m_bG2Send, CNeighbour::m_bQueryRouting, CNeighbour::m_bShareaza, CConnection::m_hSocket, CConnection::m_mInput, CConnection::m_mOutput, CNeighbour::m_nNodeType, CNeighbour::m_nProtocol, CNeighbour::m_pZInput, CNeighbour::m_pZOutput, CConnection::m_sAddress, CShareazaApp::Message(), MSG_DEFAULT, Neighbours, ntHub, ntLeaf, ntNode, NULL, CSettings::sBandwidth::PeerIn, CSettings::sBandwidth::PeerOut, CNeighboursWithConnect::PeerPrune(), TCPBandwidthMeter::pLimit, PROTOCOL_G1, PROTOCOL_G2, CNeighboursWithG1::Remove(), CSettings::sConnection::SendBuffer, Settings, and theApp.

Referenced by OnHeadersCompleteG1(), OnHeadersCompleteG2(), and ReadResponse().

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

Reimplemented from CConnection.

Definition at line 612 of file ShakeNeighbour.cpp.

References _tcsistr(), CNetwork::AcquireLocalAddress(), CHostCacheList::Add(), CSecurity::Ban(), ban2Hours, CSettings::Connection, DiscoveryServices, CSettings::sGnutella1::EnableGGEP, CSettings::sGnutella2::EnableToday, CHostCache::Gnutella1, CSettings::Gnutella1, CHostCache::Gnutella2, CSettings::Gnutella2, GNUTELLA_DEFAULT_PORT, HostCache, IDS_HANDSHAKE_REJECTED, CSettings::sConnection::InPort, CConnection::IsAgentBlocked(), IsClientBad(), IsClientBanned(), IsClientObsolete(), CNeighbour::m_bBadClient, m_bCanDeflate, m_bDeflateAccept, m_bDeflateSend, m_bG2Accept, m_bG2Send, CNeighbour::m_bGGEP, CNeighbour::m_bObsoleteClient, CNeighbour::m_bPongCaching, CNeighbour::m_bQueryRouting, CNeighbour::m_bShareaza, m_bUltraPeerLoaded, m_bUltraPeerNeeded, m_bUltraPeerSet, CNeighbour::m_bVendorMsg, CNeighbour::m_nState, CConnection::m_pHost, CConnection::m_sAddress, CConnection::m_sUserAgent, CShareazaApp::Message(), MSG_DEBUG, MSG_ERROR, Network, nrsRejected, NULL, CDiscoveryServices::OnGnutellaAdded(), Security, Settings, SHAREAZA_VENDOR_T, theApp, TS_FALSE, and TS_TRUE.

BOOL CShakeNeighbour::OnHeadersComplete  )  [protected, virtual]
 

Reimplemented from CConnection.

Definition at line 821 of file ShakeNeighbour.cpp.

References m_bG2Accept, m_bG2Send, CConnection::m_bInitiated, CNeighbour::m_nProtocol, OnHeadersCompleteG1(), OnHeadersCompleteG2(), PROTOCOL_G1, and PROTOCOL_G2.

BOOL CShakeNeighbour::OnHeadersCompleteG1  )  [protected, virtual]
 

Definition at line 1113 of file ShakeNeighbour.cpp.

References CSettings::sGnutella1::ClientMode, CConnection::Close(), CNeighbour::DelayClose(), CSettings::sGnutella1::EnableToday, CNeighboursBase::GetCount(), CSettings::Gnutella1, HostCache, IDS_HANDSHAKE_BACK2LEAF, IDS_HANDSHAKE_CANTBEPEER, IDS_HANDSHAKE_IAMLEAF, IDS_HANDSHAKE_NEEDAPEER, IDS_HANDSHAKE_NOTG2, IDS_HANDSHAKE_NOULTRAPEER, IDS_HANDSHAKE_SURPLUS, CNeighboursWithConnect::IsG1Leaf(), CNeighboursWithConnect::IsG1Ultrapeer(), CNeighboursWithConnect::IsG1UltrapeerCapable(), CNeighbour::m_bBadClient, CConnection::m_bInitiated, CNeighbour::m_bObsoleteClient, m_bUltraPeerNeeded, m_bUltraPeerSet, CNeighbour::m_nNodeType, CNeighbour::m_nState, CConnection::m_pHost, CConnection::m_pOutput, CConnection::m_sAddress, CShareazaApp::Message(), MODE_LEAF, MODE_ULTRAPEER, MSG_DEBUG, MSG_DEFAULT, CNeighboursWithConnect::NeedMoreHubs(), CNeighboursWithConnect::NeedMoreLeafs(), Neighbours, nrsConnected, nrsHandshake1, nrsHandshake3, nrsRejected, ntHub, ntLeaf, ntNode, CHostCache::OnFailure(), OnHandshakeComplete(), CBuffer::Print(), PROTOCOL_G1, SendHostHeaders(), SendMinimalHeaders(), SendPrivateHeaders(), SendPublicHeaders(), Settings, theApp, TS_FALSE, and TS_TRUE.

Referenced by OnHeadersComplete().

BOOL CShakeNeighbour::OnHeadersCompleteG2  )  [protected, virtual]
 

Definition at line 841 of file ShakeNeighbour.cpp.

References CSettings::sGnutella2::ClientMode, CConnection::Close(), CNeighbour::DelayClose(), CNeighboursBase::GetCount(), CSettings::Gnutella2, IDS_HANDSHAKE_BACK2LEAF, IDS_HANDSHAKE_CANTBEPEER, IDS_HANDSHAKE_IAMLEAF, IDS_HANDSHAKE_NEEDAPEER, IDS_HANDSHAKE_NOULTRAPEER, IDS_HANDSHAKE_SURPLUS, CNeighboursWithConnect::IsG2Hub(), CNeighboursWithConnect::IsG2HubCapable(), CNeighboursWithConnect::IsG2Leaf(), CNeighbour::m_bBadClient, CConnection::m_bInitiated, CNeighbour::m_bObsoleteClient, CNeighbour::m_bShareaza, m_bUltraPeerNeeded, m_bUltraPeerSet, CNeighbour::m_nNodeType, CNeighbour::m_nState, CConnection::m_pOutput, CConnection::m_sAddress, CConnection::m_sUserAgent, CShareazaApp::Message(), MODE_HUB, MODE_LEAF, MSG_DEBUG, MSG_DEFAULT, MSG_ERROR, CNeighboursWithConnect::NeedMoreHubs(), CNeighboursWithConnect::NeedMoreLeafs(), Neighbours, nrsConnected, nrsHandshake1, nrsHandshake3, nrsRejected, ntHub, ntLeaf, ntNode, CSettings::sGnutella2::NumLeafs, OnHandshakeComplete(), CBuffer::Print(), PROTOCOL_G2, SendHostHeaders(), SendMinimalHeaders(), SendPrivateHeaders(), SendPublicHeaders(), Settings, theApp, TS_FALSE, and TS_TRUE.

Referenced by OnHeadersComplete().

BOOL CShakeNeighbour::OnRead  )  [protected, virtual]
 

Reimplemented from CNeighbour.

Definition at line 219 of file ShakeNeighbour.cpp.

References CNeighbour::m_nState, nrsHandshake1, nrsHandshake2, nrsHandshake3, nrsRejected, CConnection::OnRead(), CConnection::ReadHeaders(), and ReadResponse().

BOOL CShakeNeighbour::OnRun  )  [protected, virtual]
 

Reimplemented from CNeighbour.

Definition at line 249 of file ShakeNeighbour.cpp.

References CConnection::Close(), CSettings::Connection, DiscoveryServices, IDS_CONNECTION_TIMEOUT_CONNECT, IDS_HANDSHAKE_TIMEOUT, CNeighbour::m_nState, CConnection::m_pHost, CConnection::m_tConnected, nrsClosing, nrsConnecting, nrsHandshake1, nrsHandshake2, nrsHandshake3, nrsRejected, CDiscoveryServices::OnGnutellaFailed(), Settings, CSettings::sConnection::TimeoutConnect, and CSettings::sConnection::TimeoutHandshake.

BOOL CShakeNeighbour::ReadResponse  )  [protected]
 

Definition at line 536 of file ShakeNeighbour.cpp.

References CConnection::Close(), CNeighbour::DelayClose(), IDS_HANDSHAKE_FAIL, IDS_HANDSHAKE_REJECTED, IDS_HANDSHAKE_SURPLUS, CConnection::m_bInitiated, CNeighbour::m_nState, CConnection::m_pInput, CConnection::m_sAddress, CShareazaApp::Message(), MSG_DEBUG, MSG_ERROR, nrsHandshake2, nrsHandshake3, nrsRejected, OnHandshakeComplete(), CBuffer::ReadLine(), and theApp.

Referenced by OnRead().

void CShakeNeighbour::SendHostHeaders LPCTSTR  pszMessage = NULL  )  [protected]
 

Definition at line 467 of file ShakeNeighbour.cpp.

References CHostCacheHost::CanQuote(), CHostCacheList::GetNewest(), CHostCache::Gnutella1, CSettings::Gnutella1, CHostCache::Gnutella2, HostCache, m_bG2Accept, m_bG2Send, CNeighbour::m_bShareaza, CConnection::m_pOutput, CHostCacheHost::m_pPrevTime, NULL, CSettings::sGnutella1::PongCount, CBuffer::Print(), SendMinimalHeaders(), Settings, and CHostCacheHost::ToString().

Referenced by OnConnected(), OnHeadersCompleteG1(), and OnHeadersCompleteG2().

void CShakeNeighbour::SendMinimalHeaders  )  [protected]
 

Definition at line 303 of file ShakeNeighbour.cpp.

References CSettings::sGnutella2::EnableToday, CSettings::Gnutella2, m_bG2Accept, CConnection::m_bInitiated, CNeighbour::m_nProtocol, CConnection::m_pOutput, CBuffer::Print(), PROTOCOL_G1, Settings, and CSettings::SmartAgent().

Referenced by OnHeadersCompleteG1(), OnHeadersCompleteG2(), and SendHostHeaders().

void CShakeNeighbour::SendPrivateHeaders  )  [protected]
 

Definition at line 433 of file ShakeNeighbour.cpp.

References m_bDeflateAccept, m_bDeflateSend, m_bG2Accept, m_bG2Send, CConnection::m_bInitiated, m_bSentAddress, CNeighbour::m_nProtocol, CConnection::m_pOutput, CBuffer::Print(), PROTOCOL_G1, and CConnection::SendMyAddress().

Referenced by OnHeadersCompleteG1(), and OnHeadersCompleteG2().

void CShakeNeighbour::SendPublicHeaders  )  [protected]
 

Definition at line 332 of file ShakeNeighbour.cpp.

References CSettings::sGnutella2::ClientMode, CSettings::sGnutella1::ClientMode, CSettings::sGnutella1::EnableGGEP, CSettings::sGnutella1::EnableToday, CSettings::sGnutella2::EnableToday, CSettings::Gnutella1, CSettings::Gnutella2, CNeighboursWithConnect::IsG1Ultrapeer(), CNeighboursWithConnect::IsG1UltrapeerCapable(), CNeighboursWithConnect::IsG2Hub(), CNeighboursWithConnect::IsG2HubCapable(), m_bCanDeflate, m_bDeflateAccept, CConnection::m_bInitiated, m_bSentAddress, m_bUltraPeerSet, CNeighbour::m_nProtocol, CConnection::m_pHost, CConnection::m_pOutput, MODE_HUB, MODE_ULTRAPEER, Neighbours, CBuffer::Print(), PROTOCOL_G1, PROTOCOL_G2, CConnection::SendMyAddress(), Settings, CSettings::SmartAgent(), TS_FALSE, TS_UNKNOWN, and CSettings::sGnutella1::VendorMsg.

Referenced by OnConnected(), OnHeadersCompleteG1(), and OnHeadersCompleteG2().


Member Data Documentation

BOOL CShakeNeighbour::m_bCanDeflate [protected]
 

Definition at line 48 of file ShakeNeighbour.h.

Referenced by CShakeNeighbour(), OnHeaderLine(), and SendPublicHeaders().

BOOL CShakeNeighbour::m_bDeflateAccept [protected]
 

Definition at line 75 of file ShakeNeighbour.h.

Referenced by CShakeNeighbour(), OnHandshakeComplete(), OnHeaderLine(), SendPrivateHeaders(), and SendPublicHeaders().

BOOL CShakeNeighbour::m_bDeflateSend [protected]
 

Definition at line 70 of file ShakeNeighbour.h.

Referenced by CShakeNeighbour(), OnHandshakeComplete(), OnHeaderLine(), and SendPrivateHeaders().

BOOL CShakeNeighbour::m_bG2Accept [protected]
 

Definition at line 64 of file ShakeNeighbour.h.

Referenced by CShakeNeighbour(), OnHandshakeComplete(), OnHeaderLine(), OnHeadersComplete(), SendHostHeaders(), SendMinimalHeaders(), and SendPrivateHeaders().

BOOL CShakeNeighbour::m_bG2Send [protected]
 

Definition at line 58 of file ShakeNeighbour.h.

Referenced by CShakeNeighbour(), OnHandshakeComplete(), OnHeaderLine(), OnHeadersComplete(), SendHostHeaders(), and SendPrivateHeaders().

BOOL CShakeNeighbour::m_bSentAddress [protected]
 

Definition at line 51 of file ShakeNeighbour.h.

Referenced by CShakeNeighbour(), SendPrivateHeaders(), and SendPublicHeaders().

TRISTATE CShakeNeighbour::m_bUltraPeerLoaded [protected]
 

Definition at line 106 of file ShakeNeighbour.h.

Referenced by CShakeNeighbour(), and OnHeaderLine().

TRISTATE CShakeNeighbour::m_bUltraPeerNeeded [protected]
 

Definition at line 92 of file ShakeNeighbour.h.

Referenced by CShakeNeighbour(), OnHeaderLine(), OnHeadersCompleteG1(), and OnHeadersCompleteG2().

TRISTATE CShakeNeighbour::m_bUltraPeerSet [protected]
 

Definition at line 80 of file ShakeNeighbour.h.

Referenced by ConnectTo(), CShakeNeighbour(), OnHeaderLine(), OnHeadersCompleteG1(), OnHeadersCompleteG2(), and SendPublicHeaders().


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