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

CG2Neighbour Class Reference

#include <G2Neighbour.h>

Inheritance diagram for CG2Neighbour:

CNeighbour CConnection List of all members.

Public Member Functions

 CG2Neighbour (CNeighbour *pBase)
virtual ~CG2Neighbour ()
virtual BOOL Send (CPacket *pPacket, BOOL bRelease=TRUE, BOOL bBuffered=FALSE)
virtual BOOL SendQuery (CQuerySearch *pSearch, CPacket *pPacket, BOOL bLocal)

Public Attributes

DWORD m_nLeafCount
DWORD m_nLeafLimit
BOOL m_bCachedKeys
CRouteCachem_pGUIDCache
CHubHorizonGroupm_pHubGroup

Protected Member Functions

virtual BOOL OnRead ()
virtual BOOL OnWrite ()
virtual BOOL OnRun ()
void SendStartups ()
BOOL ProcessPackets ()
BOOL OnPacket (CG2Packet *pPacket)
BOOL OnPing (CG2Packet *pPacket)
void SendLNI ()
BOOL OnLNI (CG2Packet *pPacket)
void SendKHL ()
BOOL OnKHL (CG2Packet *pPacket)
void SendHAW ()
BOOL OnHAW (CG2Packet *pPacket)
BOOL OnQuery (CG2Packet *pPacket)
BOOL OnQueryAck (CG2Packet *pPacket)
BOOL OnQueryKeyReq (CG2Packet *pPacket)
BOOL OnQueryKeyAns (CG2Packet *pPacket)
BOOL OnPush (CG2Packet *pPacket)
BOOL OnProfileChallenge (CG2Packet *pPacket)
BOOL OnProfileDelivery (CG2Packet *pPacket)

Protected Attributes

LONG m_tAdjust
DWORD m_tLastPingIn
DWORD m_tLastPingOut
DWORD m_tWaitLNI
DWORD m_tLastKHL
DWORD m_tLastHAW
CPtrList m_pOutbound
int m_nQueryLimiter
DWORD m_tQueryTimer
BOOL m_bBlacklisted

Constructor & Destructor Documentation

CG2Neighbour::CG2Neighbour CNeighbour pBase  ) 
 

Definition at line 59 of file G2Neighbour.cpp.

References CSettings::Gnutella2, IDS_HANDSHAKE_ONLINE_G2, CSettings::sGnutella2::KHLPeriod, m_bBlacklisted, m_bCachedKeys, m_nLeafCount, m_nLeafLimit, m_nQueryLimiter, m_pGUIDCache, m_pHubGroup, CConnection::m_sAddress, CConnection::m_sUserAgent, m_tAdjust, m_tLastHAW, m_tLastKHL, CNeighbour::m_tLastPacket, m_tLastPingIn, m_tLastPingOut, m_tQueryTimer, m_tWaitLNI, CShareazaApp::Message(), MSG_DEFAULT, SendStartups(), Settings, and theApp.

CG2Neighbour::~CG2Neighbour  )  [virtual]
 

Definition at line 86 of file G2Neighbour.cpp.

References m_pGUIDCache, m_pHubGroup, m_pOutbound, and CPacket::Release().


Member Function Documentation

BOOL CG2Neighbour::OnHAW CG2Packet pPacket  )  [protected]
 

Definition at line 847 of file G2Neighbour.cpp.

References CRouteCache::Add(), CHostCacheList::Add(), CNeighboursWithG2::GetRandomHub(), CHostCache::Gnutella2, HostCache, CNetwork::IsFirewalledAddress(), m_pGUIDCache, Neighbours, and Network.

Referenced by OnPacket().

BOOL CG2Neighbour::OnKHL CG2Packet pPacket  )  [protected]
 

Definition at line 705 of file G2Neighbour.cpp.

References CHubHorizonGroup::Add(), CHostCacheList::Add(), CHubHorizonGroup::Clear(), CHostCache::Gnutella2, HostCache, CNetwork::IsFirewalledAddress(), m_bCachedKeys, CG2Packet::m_bCompound, CHostCacheHost::m_nKeyHost, CHostCacheHost::m_nKeyValue, CNeighbour::m_nNodeType, CPacket::m_nPosition, CConnection::m_pHost, CNetwork::m_pHost, m_pHubGroup, m_tAdjust, Network, ntHub, NULL, CPacket::ReadLongBE(), CPacket::ReadLongLE(), CG2Packet::ReadPacket(), CPacket::ReadShortBE(), CG2Packet::ReadString(), and CHostCacheHost::SetKey().

Referenced by OnPacket().

BOOL CG2Neighbour::OnLNI CG2Packet pPacket  )  [protected]
 

Definition at line 551 of file G2Neighbour.cpp.

References CHostCacheList::Add(), CHostCache::Gnutella2, HostCache, CNetwork::IsFirewalledAddress(), CVendorCache::Lookup(), m_bCachedKeys, CG2Packet::m_bCompound, CNeighbour::m_bGUID, CNeighbour::m_nFileCount, CNeighbour::m_nFileVolume, m_nLeafCount, m_nLeafLimit, CNeighbour::m_nNodeType, CPacket::m_nPosition, CNeighbour::m_pGUID, CConnection::m_pHost, CNeighbour::m_pVendor, CVendor::m_sCode, m_tWaitLNI, Network, ntLeaf, NULL, CPacket::Read(), CPacket::ReadLongBE(), CPacket::ReadLongLE(), CG2Packet::ReadPacket(), CPacket::ReadShortBE(), and VendorCache.

Referenced by OnPacket().

BOOL CG2Neighbour::OnPacket CG2Packet pPacket  )  [protected]
 

Definition at line 332 of file G2Neighbour.cpp.

References CStatistics::Current, G2_PACKET_HAW, G2_PACKET_HIT, G2_PACKET_HIT_WRAP, G2_PACKET_KHL, G2_PACKET_LNI, G2_PACKET_PING, G2_PACKET_PROFILE_CHALLENGE, G2_PACKET_PROFILE_DELIVERY, G2_PACKET_PUSH, G2_PACKET_QHT, G2_PACKET_QUERY, G2_PACKET_QUERY_ACK, G2_PACKET_QUERY_KEY_ANS, G2_PACKET_QUERY_KEY_REQ, G2_PACKET_QUERY_WRAP, CNeighbour::m_nInputCount, CNeighbour::m_tLastPacket, CShareazaApp::Message(), MSG_DEBUG, Network, NULL, CNeighbour::OnCommonHit(), CNeighbour::OnCommonQueryHash(), OnHAW(), OnKHL(), OnLNI(), OnPing(), OnProfileChallenge(), OnProfileDelivery(), OnPush(), OnQuery(), OnQueryAck(), OnQueryKeyAns(), OnQueryKeyReq(), CNetwork::RoutePacket(), CPacket::SmartDump(), Statistics, and theApp.

Referenced by ProcessPackets().

BOOL CG2Neighbour::OnPing CG2Packet pPacket  )  [protected]
 

Definition at line 410 of file G2Neighbour.cpp.

References Datagrams, G2_PACKET_PONG, CNeighboursBase::GetIterator(), CNeighboursBase::GetNext(), CSettings::Gnutella1, CSettings::Gnutella2, CNetwork::IsFirewalledAddress(), CG2Packet::m_bCompound, CPacket::m_nPosition, CNeighbour::m_nProtocol, CNeighbour::m_nState, CConnection::m_sAddress, m_tLastPingIn, CShareazaApp::Message(), MSG_DEBUG, Neighbours, Network, CG2Packet::New(), nrsConnected, CSettings::sGnutella1::PingFlood, CSettings::sGnutella2::PingRelayLimit, PROTOCOL_G2, CPacket::ReadLongLE(), CG2Packet::ReadPacket(), CPacket::ReadShortBE(), CDatagrams::Send(), Send(), Settings, theApp, CPacket::WriteGetPointer(), and CG2Packet::WritePacket().

Referenced by OnPacket().

BOOL CG2Neighbour::OnProfileChallenge CG2Packet pPacket  )  [protected]
 

Definition at line 1211 of file G2Neighbour.cpp.

References G2_PACKET_PROFILE_DELIVERY, CG2Packet::GetStringLen(), CGProfile::GetXML(), CGProfile::IsValid(), MyProfile, CG2Packet::New(), NULL, Send(), CG2Packet::WritePacket(), and CG2Packet::WriteString().

Referenced by OnPacket().

BOOL CG2Neighbour::OnProfileDelivery CG2Packet pPacket  )  [protected]
 

Definition at line 1230 of file G2Neighbour.cpp.

References CXMLElement::FromString(), CGProfile::FromXML(), CG2Packet::m_bCompound, CPacket::m_nPosition, CNeighbour::m_pProfile, NULL, CG2Packet::ReadPacket(), and CG2Packet::ReadString().

Referenced by OnPacket().

BOOL CG2Neighbour::OnPush CG2Packet pPacket  )  [protected]
 

Definition at line 1173 of file G2Neighbour.cpp.

References CStatistics::Current, CG2Packet::Debug(), CPacket::GetRemaining(), Handshakes, IDS_PROTOCOL_ZERO_PUSH, CSecurity::IsDenied(), CNetwork::IsFirewalledAddress(), CG2Packet::m_bCompound, CNeighbour::m_nDropCount, CConnection::m_sAddress, CShareazaApp::Message(), MSG_ERROR, Network, CHandshakes::PushTo(), CPacket::ReadLongLE(), CPacket::ReadShortBE(), Security, CG2Packet::SkipCompound(), Statistics, and theApp.

Referenced by OnPacket().

BOOL CG2Neighbour::OnQuery CG2Packet pPacket  )  [protected]
 

Definition at line 935 of file G2Neighbour.cpp.

References CRouteCache::Add(), CNeighboursWithG2::CreateQueryWeb(), CStatistics::Current, CLocalSearch::Execute(), CQuerySearch::FromPacket(), G2_PACKET_QUERY_WRAP, IDS_PROTOCOL_BAD_QUERY, CG2Packet::IsType(), m_bBlacklisted, CQuerySearch::m_bBTH, CQuerySearch::m_bED2K, CQuerySearch::m_bSHA1, CQuerySearch::m_bUDP, CNeighbour::m_nDropCount, CNeighbour::m_nNodeType, m_nQueryLimiter, CQuerySearch::m_pEndpoint, CQuerySearch::m_pGUID, CConnection::m_pHost, CConnection::m_sAddress, CShareazaApp::Message(), MSG_DEBUG, MSG_DEFAULT, MSG_SYSTEM, Neighbours, Network, ntHub, ntLeaf, NULL, CNetwork::OnQuerySearch(), CNetwork::QueryRoute, CNeighboursWithRouting::RouteQuery(), Send(), Statistics, and theApp.

Referenced by OnPacket().

BOOL CG2Neighbour::OnQueryAck CG2Packet pPacket  )  [protected]
 

Definition at line 1060 of file G2Neighbour.cpp.

References CHostCacheList::Add(), CHostCache::Gnutella2, HostCache, CConnection::m_pHost, NULL, CSearchManager::OnQueryAck(), and SearchManager.

Referenced by OnPacket().

BOOL CG2Neighbour::OnQueryKeyAns CG2Packet pPacket  )  [protected]
 

Definition at line 1127 of file G2Neighbour.cpp.

References CHostCacheList::Add(), CHostCache::Gnutella2, HostCache, CNetwork::IsFirewalledAddress(), m_bCachedKeys, CNeighbour::m_nNodeType, CConnection::m_pHost, CConnection::m_sAddress, CShareazaApp::Message(), MSG_DEBUG, Network, ntHub, NULL, CHostCacheHost::SetKey(), and theApp.

Referenced by OnPacket().

BOOL CG2Neighbour::OnQueryKeyReq CG2Packet pPacket  )  [protected]
 

Definition at line 1070 of file G2Neighbour.cpp.

References Datagrams, CHostCacheList::Find(), G2_PACKET_QUERY_KEY_ANS, G2_PACKET_QUERY_KEY_REQ, CHostCache::Gnutella2, HostCache, CNetwork::IsFirewalledAddress(), CHostCacheHost::m_nKeyHost, CHostCacheHost::m_nKeyValue, CNeighbour::m_nNodeType, CConnection::m_pHost, CNetwork::m_pHost, Network, CG2Packet::New(), ntLeaf, NULL, CDatagrams::Send(), Send(), CPacket::WriteLongBE(), CPacket::WriteLongLE(), CG2Packet::WritePacket(), and CPacket::WriteShortBE().

Referenced by OnPacket().

BOOL CG2Neighbour::OnRead  )  [protected, virtual]
 

Reimplemented from CNeighbour.

Definition at line 101 of file G2Neighbour.cpp.

References CNeighbour::OnRead(), and ProcessPackets().

BOOL CG2Neighbour::OnRun  )  [protected, virtual]
 

Reimplemented from CNeighbour.

Definition at line 130 of file G2Neighbour.cpp.

References CConnection::Close(), Datagrams, G2_PACKET_PING, CSettings::Gnutella1, CSettings::Gnutella2, CSettings::sGnutella2::HAWPeriod, IDS_CONNECTION_TIMEOUT_TRAFFIC, CNetwork::IsListening(), CDatagrams::IsStable(), CSettings::sGnutella2::KHLPeriod, CNeighbour::m_nNodeType, m_nQueryLimiter, CConnection::m_pHost, CNetwork::m_pHost, m_tLastHAW, m_tLastKHL, m_tLastPingOut, m_tQueryTimer, m_tWaitLNI, Network, CG2Packet::New(), ntLeaf, CNeighbour::OnRun(), CSettings::sGnutella1::PingRate, CDatagrams::Send(), Send(), SendHAW(), SendKHL(), SendLNI(), Settings, CPacket::WriteLongLE(), CG2Packet::WritePacket(), and CPacket::WriteShortBE().

BOOL CG2Neighbour::OnWrite  )  [protected, virtual]
 

Reimplemented from CNeighbour.

Definition at line 107 of file G2Neighbour.cpp.

References CBuffer::m_nLength, CNeighbour::m_nOutbound, m_pOutbound, CConnection::m_pOutput, CNeighbour::m_pZOutput, CNeighbour::OnWrite(), CPacket::Release(), and CG2Packet::ToBuffer().

BOOL CG2Neighbour::ProcessPackets  )  [protected]
 

Definition at line 257 of file G2Neighbour.cpp.

References CConnection::Close(), G2_FLAG_BIG_ENDIAN, CSettings::Gnutella1, IDS_PROTOCOL_TOO_LARGE, CBuffer::m_nLength, CBuffer::m_pBuffer, CConnection::m_pInput, CNeighbour::m_pZInput, CSettings::sGnutella1::MaximumPacket, CG2Packet::New(), OnPacket(), CPacket::Release(), CBuffer::Remove(), and Settings.

Referenced by OnRead().

BOOL CG2Neighbour::Send CPacket pPacket,
BOOL  bRelease = TRUE,
BOOL  bBuffered = FALSE
[virtual]
 

Reimplemented from CNeighbour.

Definition at line 192 of file G2Neighbour.cpp.

References CPacket::AddRef(), CStatistics::Current, CSettings::Gnutella1, CNeighbour::m_nOutbound, CNeighbour::m_nOutputCount, CPacket::m_nProtocol, CNeighbour::m_nState, m_pOutbound, CConnection::m_pOutput, CNeighbour::m_pZOutput, nrsConnected, NULL, CSettings::sGnutella1::PacketBufferSize, PROTOCOL_G2, CConnection::QueueRun(), CPacket::Release(), Settings, CPacket::SmartDump(), Statistics, and CPacket::ToBuffer().

Referenced by OnPing(), OnProfileChallenge(), OnQuery(), OnQueryKeyReq(), OnRun(), SendHAW(), SendKHL(), SendLNI(), SendQuery(), and SendStartups().

void CG2Neighbour::SendHAW  )  [protected]
 

Definition at line 800 of file G2Neighbour.cpp.

References CRouteCache::Add(), CNetwork::CreateID(), G2_PACKET_HAW, CNeighboursBase::GetIterator(), CNeighboursBase::GetNext(), CNeighboursWithConnect::IsG2Leaf(), CNeighbour::m_nNodeType, CNeighbour::m_nState, m_pGUIDCache, CNetwork::m_pHost, m_tLastHAW, Neighbours, Network, CG2Packet::New(), nrsConnected, ntLeaf, Send(), SHAREAZA_VENDOR_A, CPacket::Write(), CPacket::WriteByte(), CPacket::WriteLongLE(), CG2Packet::WritePacket(), CPacket::WriteShortBE(), and CG2Packet::WriteString().

Referenced by OnRun().

void CG2Neighbour::SendKHL  )  [protected]
 

Definition at line 614 of file G2Neighbour.cpp.

References G2_PACKET_KHL, CNeighboursBase::Get(), CNeighboursBase::GetIterator(), CHostCacheList::GetNewest(), CNeighboursBase::GetNext(), CHostCache::Gnutella2, CSettings::Gnutella2, HostCache, CSettings::sGnutella2::KHLHubCount, m_nLeafCount, CNeighbour::m_nNodeType, CPacket::m_nPosition, CNeighbour::m_nProtocol, CNeighbour::m_nState, CNetwork::m_pHost, CConnection::m_pHost, CNeighbour::m_pVendor, CVendor::m_sCode, m_tLastKHL, Neighbours, Network, CG2Packet::New(), nrsConnected, ntLeaf, NULL, PROTOCOL_G2, Send(), Settings, CPacket::WriteByte(), CPacket::WriteLongBE(), CPacket::WriteLongLE(), CG2Packet::WritePacket(), CPacket::WriteShortBE(), and CG2Packet::WriteString().

Referenced by OnRun().

void CG2Neighbour::SendLNI  )  [protected]
 

Definition at line 497 of file G2Neighbour.cpp.

References G2_PACKET_LNI, CNeighboursBase::GetIterator(), CNeighboursBase::GetNext(), CLibraryMaps::GetStatistics(), CSettings::Gnutella2, CGProfile::GUID, CNeighboursWithConnect::IsG2Leaf(), LibraryMaps, CNeighbour::m_nFileCount, CNeighbour::m_nFileVolume, CNeighbour::m_nNodeType, CNeighbour::m_nState, CNetwork::m_pHost, MyProfile, Neighbours, Network, CG2Packet::New(), nrsConnected, ntLeaf, CSettings::sGnutella2::NumLeafs, Send(), Settings, SHAREAZA_VENDOR_A, CPacket::Write(), CPacket::WriteLongBE(), CPacket::WriteLongLE(), CG2Packet::WritePacket(), CPacket::WriteShortBE(), and CG2Packet::WriteString().

Referenced by OnRun().

BOOL CG2Neighbour::SendQuery CQuerySearch pSearch,
CPacket pPacket,
BOOL  bLocal
[virtual]
 

Reimplemented from CNeighbour.

Definition at line 907 of file G2Neighbour.cpp.

References CQueryHashTable::Check(), CQueryHashTable::m_bLive, CNeighbour::m_nNodeType, CPacket::m_nProtocol, CNeighbour::m_nState, CNeighbour::m_pQueryTableRemote, nrsConnected, ntHub, ntLeaf, NULL, PROTOCOL_G2, and Send().

void CG2Neighbour::SendStartups  )  [protected]
 

Definition at line 235 of file G2Neighbour.cpp.

References Datagrams, G2_PACKET_PING, G2_PACKET_PROFILE_CHALLENGE, CNetwork::IsListening(), CConnection::m_pHost, CNetwork::m_pHost, m_tLastPingOut, Network, CG2Packet::New(), CDatagrams::Send(), Send(), CPacket::WriteLongLE(), CG2Packet::WritePacket(), and CPacket::WriteShortBE().

Referenced by CG2Neighbour().


Member Data Documentation

BOOL CG2Neighbour::m_bBlacklisted [protected]
 

Definition at line 60 of file G2Neighbour.h.

Referenced by CG2Neighbour(), and OnQuery().

BOOL CG2Neighbour::m_bCachedKeys
 

Definition at line 44 of file G2Neighbour.h.

Referenced by CG2Neighbour(), OnKHL(), OnLNI(), and OnQueryKeyAns().

DWORD CG2Neighbour::m_nLeafCount
 

Definition at line 42 of file G2Neighbour.h.

Referenced by CG2Neighbour(), CNeighboursWithG2::CreateQueryWeb(), OnLNI(), CRemote::PageNetworkNetwork(), SendKHL(), and CNeighboursWnd::Update().

DWORD CG2Neighbour::m_nLeafLimit
 

Definition at line 43 of file G2Neighbour.h.

Referenced by CG2Neighbour(), OnLNI(), CRemote::PageNetworkNetwork(), and CNeighboursWnd::Update().

int CG2Neighbour::m_nQueryLimiter [protected]
 

Definition at line 58 of file G2Neighbour.h.

Referenced by CG2Neighbour(), OnQuery(), and OnRun().

CRouteCache* CG2Neighbour::m_pGUIDCache
 

Definition at line 45 of file G2Neighbour.h.

Referenced by CG2Neighbour(), CNeighboursWithG2::GetRandomHub(), OnHAW(), SendHAW(), and ~CG2Neighbour().

CHubHorizonGroup* CG2Neighbour::m_pHubGroup
 

Definition at line 46 of file G2Neighbour.h.

Referenced by CG2Neighbour(), OnKHL(), and ~CG2Neighbour().

CPtrList CG2Neighbour::m_pOutbound [protected]
 

Definition at line 55 of file G2Neighbour.h.

Referenced by OnWrite(), Send(), and ~CG2Neighbour().

LONG CG2Neighbour::m_tAdjust [protected]
 

Definition at line 48 of file G2Neighbour.h.

Referenced by CG2Neighbour(), and OnKHL().

DWORD CG2Neighbour::m_tLastHAW [protected]
 

Definition at line 53 of file G2Neighbour.h.

Referenced by CG2Neighbour(), OnRun(), and SendHAW().

DWORD CG2Neighbour::m_tLastKHL [protected]
 

Definition at line 52 of file G2Neighbour.h.

Referenced by CG2Neighbour(), OnRun(), and SendKHL().

DWORD CG2Neighbour::m_tLastPingIn [protected]
 

Definition at line 49 of file G2Neighbour.h.

Referenced by CG2Neighbour(), and OnPing().

DWORD CG2Neighbour::m_tLastPingOut [protected]
 

Definition at line 50 of file G2Neighbour.h.

Referenced by CG2Neighbour(), OnRun(), and SendStartups().

DWORD CG2Neighbour::m_tQueryTimer [protected]
 

Definition at line 59 of file G2Neighbour.h.

Referenced by CG2Neighbour(), and OnRun().

DWORD CG2Neighbour::m_tWaitLNI [protected]
 

Definition at line 51 of file G2Neighbour.h.

Referenced by CG2Neighbour(), OnLNI(), and OnRun().


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