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

CLocalSearch Class Reference

#include <LocalSearch.h>

List of all members.

Public Member Functions

 CLocalSearch (CQuerySearch *pSearch, CNeighbour *pNeighbour, BOOL bWrapped=FALSE)
 CLocalSearch (CQuerySearch *pSearch, SOCKADDR_IN *pEndpoint)
 CLocalSearch (CQuerySearch *pSearch, CBuffer *pBuffer, PROTOCOLID nProtocol=PROTOCOL_G1)
virtual ~CLocalSearch ()
int Execute (int nMaximum=-1)
void WriteVirtualTree ()

Protected Member Functions

int ExecuteSharedFiles (int nMaximum)
BOOL AddHit (CLibraryFile *pFile, int nIndex)
BOOL AddHitG1 (CLibraryFile *pFile, int nIndex)
BOOL AddHitG2 (CLibraryFile *pFile, int nIndex)
int ExecutePartialFiles (int nMaximum)
void AddHit (CDownload *pDownload, int nIndex)
void CreatePacket (int nCount)
void CreatePacketG1 (int nCount)
void CreatePacketG2 ()
void AddMetadata (CSchema *pSchema, CXMLElement *pXML, int nIndex)
CString GetXMLString ()
void WriteTrailer ()
void WriteTrailerG1 ()
void WriteTrailerG2 ()
void DispatchPacket ()
void DestroyPacket ()
CG2PacketAlbumToPacket (CAlbumFolder *pFolder)
CG2PacketFoldersToPacket ()
CG2PacketFolderToPacket (CLibraryFolder *pFolder)

Protected Attributes

CQuerySearchm_pSearch
CNeighbourm_pNeighbour
SOCKADDR_IN * m_pEndpoint
CBufferm_pBuffer
DWORD m_nTTL
GGUID m_pGUID
PROTOCOLID m_nProtocol
BOOL m_bWrapped
CPacketm_pPacket
CMapPtrToPtr m_pSchemas


Constructor & Destructor Documentation

CLocalSearch::CLocalSearch CQuerySearch pSearch,
CNeighbour pNeighbour,
BOOL  bWrapped = FALSE
 

Definition at line 71 of file LocalSearch.cpp.

References CSettings::Gnutella1, m_bWrapped, CNeighbour::m_nProtocol, m_nProtocol, m_nTTL, m_pBuffer, m_pEndpoint, m_pNeighbour, m_pPacket, m_pSearch, CSettings::sGnutella1::MaximumTTL, NULL, PROTOCOL_G1, and Settings.

CLocalSearch::CLocalSearch CQuerySearch pSearch,
SOCKADDR_IN *  pEndpoint
 

Definition at line 85 of file LocalSearch.cpp.

References CSettings::Gnutella1, m_bWrapped, m_nProtocol, m_nTTL, m_pBuffer, m_pEndpoint, m_pNeighbour, m_pPacket, m_pSearch, CSettings::sGnutella1::MaximumTTL, NULL, PROTOCOL_G2, and Settings.

CLocalSearch::CLocalSearch CQuerySearch pSearch,
CBuffer pBuffer,
PROTOCOLID  nProtocol = PROTOCOL_G1
 

Definition at line 97 of file LocalSearch.cpp.

References CSettings::Gnutella1, m_bWrapped, m_nProtocol, m_nTTL, m_pBuffer, m_pEndpoint, m_pNeighbour, m_pPacket, m_pSearch, CSettings::sGnutella1::MaximumTTL, NULL, and Settings.

CLocalSearch::~CLocalSearch  )  [virtual]
 

Definition at line 109 of file LocalSearch.cpp.

References GetXMLString().


Member Function Documentation

void CLocalSearch::AddHit CDownload pDownload,
int  nIndex
[protected]
 

Definition at line 539 of file LocalSearch.cpp.

References CG2Packet::GetStringLen(), CDownloadWithFile::GetVolumeComplete(), CSHA::HashToString(), CBTInfo::IsAvailable(), CQuerySearch::m_bBTH, CDownloadBase::m_bBTH, CDownloadBase::m_bED2K, CDownloadBase::m_bSHA1, CDownloadBase::m_bTiger, CQuerySearch::m_bWantDN, CQuerySearch::m_bWantURL, CDownloadBase::m_nSize, CDownloadBase::m_pBTH, CDownloadBase::m_pED2K, CNetwork::m_pHost, m_pPacket, CDownloadWithTorrent::m_pPeerID, m_pSearch, CDownloadBase::m_pSHA1, CDownloadBase::m_pTiger, CDownloadWithTorrent::m_pTorrent, CDownloadBase::m_sRemoteName, Network, NULL, CPacket::Write(), CPacket::WriteInt64(), CPacket::WriteLongBE(), CG2Packet::WritePacket(), and CG2Packet::WriteString().

BOOL CLocalSearch::AddHit CLibraryFile pFile,
int  nIndex
[protected]
 

Definition at line 184 of file LocalSearch.cpp.

References AddHitG1(), AddHitG2(), CSettings::sGnutella1::EnableToday, CSettings::Gnutella1, m_nProtocol, m_pPacket, CShareazaApp::Message(), MSG_ERROR, NULL, PROTOCOL_G1, Settings, and theApp.

Referenced by ExecutePartialFiles(), and ExecuteSharedFiles().

BOOL CLocalSearch::AddHitG1 CLibraryFile pFile,
int  nIndex
[protected]
 

Definition at line 205 of file LocalSearch.cpp.

References AddMetadata(), CSettings::Gnutella1, CED2K::HashToString(), CTigerNode::HashToString(), CSHA::HashToString(), CSettings::sGnutella1::HitQueueLimit, CQuerySearch::m_bWantXML, m_pPacket, m_pSearch, NULL, PROTOCOL_HTTP, CSettings::sGnutella1::QueryHitUTF8, CUploadQueues::QueueRank(), Settings, UploadQueues, CPacket::WriteByte(), CPacket::WriteLongLE(), CPacket::WriteString(), and CPacket::WriteStringUTF8().

Referenced by AddHit().

BOOL CLocalSearch::AddHitG2 CLibraryFile pFile,
int  nIndex
[protected]
 

Definition at line 267 of file LocalSearch.cpp.

References _tcsistr(), CLibraryFile::GetSize(), CG2Packet::GetStringLen(), CLibraryFile::IsAvailable(), CLibraryFile::m_bBogus, CLibraryFile::m_bCachedPreview, CLibraryFile::m_bED2K, CLibraryFile::m_bSHA1, CLibraryFile::m_bTiger, CQuerySearch::m_bWantCOM, CQuerySearch::m_bWantDN, CQuerySearch::m_bWantURL, CQuerySearch::m_bWantXML, CLibraryFile::m_nIndex, CUploadQueue::m_nIndex, CLibraryFile::m_nRating, CLibraryFile::m_pED2K, CLibraryFile::m_pMetadata, m_pPacket, m_pSearch, CUploadQueues::m_pSection, CLibraryFile::m_pSHA1, CLibraryFile::m_pSources, CLibraryFile::m_pTiger, CLibraryFile::m_sComments, CLibraryFile::m_sName, NULL, PROTOCOL_HTTP, Replace(), CUploadQueues::SelectQueue(), Settings, CSettings::sUploads::SharePreviews, CXMLElement::ToString(), UploadQueues, CSettings::Uploads, CXMLNode::ValueToString(), CPacket::Write(), CPacket::WriteByte(), CPacket::WriteInt64(), CPacket::WriteLongBE(), CG2Packet::WritePacket(), CPacket::WriteShortBE(), and CG2Packet::WriteString().

Referenced by AddHit().

void CLocalSearch::AddMetadata CSchema pSchema,
CXMLElement pXML,
int  nIndex
[protected]
 

Definition at line 789 of file LocalSearch.cpp.

References CXMLElement::AddAttribute(), CXMLNode::GetParent(), CSchema::Instantiate(), m_pSchemas, and NULL.

Referenced by AddHitG1().

CG2Packet * CLocalSearch::AlbumToPacket CAlbumFolder pFolder  )  [protected]
 

Definition at line 1013 of file LocalSearch.cpp.

References CXMLElement::AddAttribute(), CXMLElement::AddElement(), CXMLElement::Clone(), CAlbumFolder::GetFileCount(), CAlbumFolder::GetFileIterator(), CSchema::GetFirstMemberName(), CAlbumFolder::GetFolderIterator(), CAlbumFolder::GetNextFile(), CAlbumFolder::GetNextFolder(), CAlbumFolder::GetSharedCount(), CG2Packet::GetStringLen(), CSchema::Instantiate(), CSchema::m_bPrivate, CLibraryFile::m_nIndex, CAlbumFolder::m_pSchema, CAlbumFolder::m_pXML, CAlbumFolder::m_sName, CSchema::m_sSingular, CG2Packet::New(), NULL, CXMLElement::ToString(), CPacket::WriteLongBE(), CG2Packet::WritePacket(), and CG2Packet::WriteString().

Referenced by WriteVirtualTree().

void CLocalSearch::CreatePacket int  nCount  )  [protected]
 

Definition at line 674 of file LocalSearch.cpp.

References CreatePacketG1(), CreatePacketG2(), GetXMLString(), m_nProtocol, m_pPacket, m_pSchemas, NULL, and PROTOCOL_G1.

Referenced by ExecuteSharedFiles().

void CLocalSearch::CreatePacketG1 int  nCount  )  [protected]
 

Definition at line 686 of file LocalSearch.cpp.

References CSettings::Connection, G1_PACKET_HIT, CUploads::m_bStable, CUploads::m_nBestSpeed, m_nTTL, m_pGUID, CNetwork::m_pHost, m_pPacket, Network, CG1Packet::New(), CSettings::sConnection::OutSpeed, Settings, Uploads, CPacket::WriteByte(), CPacket::WriteLongLE(), and CPacket::WriteShortLE().

Referenced by CreatePacket().

void CLocalSearch::CreatePacketG2  )  [protected]
 

Definition at line 704 of file LocalSearch.cpp.

References CSettings::sCommunity::ChatEnable, CSettings::Community, Datagrams, G2_PACKET_HIT, CUploadQueues::GetIterator(), CNeighboursBase::GetIterator(), CUploadQueues::GetNext(), CNeighboursBase::GetNext(), CGProfile::GetNick(), CUploadQueue::GetPredictedBandwidth(), CUploadQueue::GetQueuedCount(), CG2Packet::GetStringLen(), CUploadQueue::GetTransferCount(), CGProfile::GUID, CDatagrams::IsStable(), CNetwork::IsStable(), CUploads::m_bStable, CNeighbour::m_nNodeType, CNeighbour::m_nProtocol, CConnection::m_pHost, CNetwork::m_pHost, m_pPacket, CUploadQueues::m_pSection, CNetwork::m_pSection, MyProfile, Neighbours, Network, CG2Packet::New(), ntLeaf, PROTOCOL_G2, CSettings::sCommunity::ServeFiles, CSettings::sCommunity::ServeProfile, Settings, SHAREAZA_VENDOR_A, UploadQueues, Uploads, CPacket::Write(), CPacket::WriteByte(), CPacket::WriteLongBE(), CPacket::WriteLongLE(), CG2Packet::WritePacket(), CPacket::WriteShortBE(), and CG2Packet::WriteString().

Referenced by CreatePacket(), and ExecutePartialFiles().

void CLocalSearch::DestroyPacket  )  [protected]
 

Definition at line 983 of file LocalSearch.cpp.

References m_pPacket, NULL, and CPacket::Release().

Referenced by ExecuteSharedFiles().

void CLocalSearch::DispatchPacket  )  [protected]
 

Definition at line 949 of file LocalSearch.cpp.

References Datagrams, G2_PACKET_HIT_WRAP, m_bWrapped, m_pBuffer, m_pEndpoint, m_pNeighbour, m_pPacket, CShareazaApp::Message(), MSG_DEFAULT, CG2Packet::New(), NULL, CPacket::Release(), CDatagrams::Send(), CNeighbour::Send(), theApp, and CPacket::ToBuffer().

Referenced by ExecutePartialFiles(), ExecuteSharedFiles(), and WriteVirtualTree().

int CLocalSearch::Execute int  nMaximum = -1  ) 
 

Definition at line 117 of file LocalSearch.cpp.

References CNetwork::CreateID(), ExecutePartialFiles(), ExecuteSharedFiles(), CUploadQueues::GetQueueRemaining(), CSettings::Gnutella, CQuerySearch::m_bWantPFS, m_nProtocol, m_pBuffer, CQuerySearch::m_pGUID, m_pGUID, m_pSearch, CSettings::sGnutella::MaxHits, Network, NULL, PROTOCOL_G2, Settings, and UploadQueues.

Referenced by CG2Neighbour::OnQuery(), CG1Neighbour::OnQuery(), CDatagrams::OnQuery(), and CUploadTransferHTTP::RequestHostBrowse().

int CLocalSearch::ExecutePartialFiles int  nMaximum  )  [protected]
 

Definition at line 494 of file LocalSearch.cpp.

References AddHit(), CreatePacketG2(), DispatchPacket(), Downloads, CDownloads::GetIterator(), CDownloads::GetNext(), CDownload::IsShared(), CDownload::IsStarted(), CDownloadBase::m_bBTH, CQuerySearch::m_bBTH, CDownloadBase::m_bED2K, CQuerySearch::m_bED2K, CDownloadBase::m_bSHA1, CQuerySearch::m_bSHA1, CDownloadBase::m_bTiger, CQuerySearch::m_bTiger, m_nProtocol, CDownloadBase::m_pBTH, CQuerySearch::m_pBTH, CDownloadBase::m_pED2K, CQuerySearch::m_pED2K, m_pPacket, m_pSearch, CTransfers::m_pSection, CDownloadBase::m_pSHA1, CQuerySearch::m_pSHA1, CDownloadBase::m_pTiger, CQuerySearch::m_pTiger, NULL, PROTOCOL_G2, Transfers, and WriteTrailerG2().

Referenced by Execute().

int CLocalSearch::ExecuteSharedFiles int  nMaximum  )  [protected]
 

Definition at line 151 of file LocalSearch.cpp.

References AddHit(), CreatePacket(), DestroyPacket(), DispatchPacket(), CSettings::Gnutella, CSettings::sGnutella::HitsPerPacket, Library, m_pSearch, CLibrary::m_pSection, NULL, CLibrary::Search(), Settings, and WriteTrailer().

Referenced by Execute().

CG2Packet * CLocalSearch::FoldersToPacket  )  [protected]
 

Definition at line 1063 of file LocalSearch.cpp.

References FolderToPacket(), CLibraryFolders::GetFolderIterator(), CLibraryFolders::GetNextFolder(), LibraryFolders, CG2Packet::New(), and CG2Packet::WritePacket().

Referenced by WriteVirtualTree().

CG2Packet * CLocalSearch::FolderToPacket CLibraryFolder pFolder  )  [protected]
 

Definition at line 1079 of file LocalSearch.cpp.

References CG2Packet::GetStringLen(), CLibraryFile::m_nIndex, CG2Packet::New(), NULL, CPacket::WriteLongBE(), CG2Packet::WritePacket(), and CG2Packet::WriteString().

Referenced by FoldersToPacket().

CString CLocalSearch::GetXMLString  )  [protected]
 

Definition at line 813 of file LocalSearch.cpp.

References CXMLElement::DeleteAttribute(), CXMLElement::Detach(), and m_pSchemas.

Referenced by CreatePacket(), WriteTrailerG1(), and ~CLocalSearch().

void CLocalSearch::WriteTrailer  )  [protected]
 

Definition at line 845 of file LocalSearch.cpp.

References m_nProtocol, m_pPacket, NULL, PROTOCOL_G1, WriteTrailerG1(), and WriteTrailerG2().

Referenced by ExecuteSharedFiles().

void CLocalSearch::WriteTrailerG1  )  [protected]
 

Definition at line 855 of file LocalSearch.cpp.

References CSettings::sCommunity::ChatEnable, CSettings::Community, CZLib::Compress(), CSettings::sGnutella1::EnableGGEP, G1_QHD_BUSY, G1_QHD_GGEP, G1_QHD_PUSH, G1_QHD_SPEED, G1_QHD_STABLE, GetXMLString(), GGEP_HDR_LAST, GGEP_LEN_LAST, GGEP_MAGIC, CSettings::Gnutella1, CGProfile::GUID, CNetwork::IsListening(), CUploadQueues::IsTransferAvailable(), CUploads::m_bStable, m_pPacket, MyProfile, Network, NULL, CSettings::sCommunity::ServeFiles, Settings, SHAREAZA_VENDOR_T, UploadQueues, Uploads, CPacket::Write(), CPacket::WriteByte(), CPacket::WriteShortLE(), and CPacket::WriteString().

Referenced by WriteTrailer().

void CLocalSearch::WriteTrailerG2  )  [protected]
 

Definition at line 937 of file LocalSearch.cpp.

References m_pGUID, m_pPacket, CPacket::Write(), and CPacket::WriteByte().

Referenced by ExecutePartialFiles(), and WriteTrailer().

void CLocalSearch::WriteVirtualTree  ) 
 

Definition at line 995 of file LocalSearch.cpp.

References AlbumToPacket(), DispatchPacket(), FoldersToPacket(), CLibrary::GetAlbumRoot(), Library, m_pPacket, CLibrary::m_pSection, and NULL.

Referenced by CUploadTransferHTTP::RequestHostBrowse().


Member Data Documentation

BOOL CLocalSearch::m_bWrapped [protected]
 

Definition at line 58 of file LocalSearch.h.

Referenced by CLocalSearch(), and DispatchPacket().

PROTOCOLID CLocalSearch::m_nProtocol [protected]
 

Definition at line 57 of file LocalSearch.h.

Referenced by AddHit(), CLocalSearch(), CreatePacket(), Execute(), ExecutePartialFiles(), and WriteTrailer().

DWORD CLocalSearch::m_nTTL [protected]
 

Definition at line 55 of file LocalSearch.h.

Referenced by CLocalSearch(), and CreatePacketG1().

CBuffer* CLocalSearch::m_pBuffer [protected]
 

Definition at line 54 of file LocalSearch.h.

Referenced by CLocalSearch(), DispatchPacket(), and Execute().

SOCKADDR_IN* CLocalSearch::m_pEndpoint [protected]
 

Definition at line 53 of file LocalSearch.h.

Referenced by CLocalSearch(), and DispatchPacket().

GGUID CLocalSearch::m_pGUID [protected]
 

Definition at line 56 of file LocalSearch.h.

Referenced by CreatePacketG1(), Execute(), and WriteTrailerG2().

CNeighbour* CLocalSearch::m_pNeighbour [protected]
 

Definition at line 52 of file LocalSearch.h.

Referenced by CLocalSearch(), and DispatchPacket().

CPacket* CLocalSearch::m_pPacket [protected]
 

Definition at line 60 of file LocalSearch.h.

Referenced by AddHit(), AddHitG1(), AddHitG2(), CLocalSearch(), CreatePacket(), CreatePacketG1(), CreatePacketG2(), DestroyPacket(), DispatchPacket(), ExecutePartialFiles(), WriteTrailer(), WriteTrailerG1(), WriteTrailerG2(), and WriteVirtualTree().

CMapPtrToPtr CLocalSearch::m_pSchemas [protected]
 

Definition at line 61 of file LocalSearch.h.

Referenced by AddMetadata(), CreatePacket(), and GetXMLString().

CQuerySearch* CLocalSearch::m_pSearch [protected]
 

Definition at line 51 of file LocalSearch.h.

Referenced by AddHit(), AddHitG1(), AddHitG2(), CLocalSearch(), Execute(), ExecutePartialFiles(), and ExecuteSharedFiles().


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