00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(AFX_LOCALSEARCH_H__5588AE7C_89B4_4B75_95C5_1519DD6F6D9E__INCLUDED_)
00023 #define AFX_LOCALSEARCH_H__5588AE7C_89B4_4B75_95C5_1519DD6F6D9E__INCLUDED_
00024
00025 #pragma once
00026
00027 class CQuerySearch;
00028 class CNeighbour;
00029 class CLibraryFile;
00030 class CAlbumFolder;
00031 class CLibraryFolder;
00032 class CSchema;
00033 class CXMLElement;
00034 class CBuffer;
00035 class CDownload;
00036 class CPacket;
00037 class CG2Packet;
00038
00039
00040 class CLocalSearch
00041 {
00042
00043 public:
00044 CLocalSearch(CQuerySearch* pSearch, CNeighbour* pNeighbour, BOOL bWrapped = FALSE);
00045 CLocalSearch(CQuerySearch* pSearch, SOCKADDR_IN* pEndpoint);
00046 CLocalSearch(CQuerySearch* pSearch, CBuffer* pBuffer, PROTOCOLID nProtocol = PROTOCOL_G1);
00047 virtual ~CLocalSearch();
00048
00049
00050 protected:
00051 CQuerySearch* m_pSearch;
00052 CNeighbour* m_pNeighbour;
00053 SOCKADDR_IN* m_pEndpoint;
00054 CBuffer* m_pBuffer;
00055 DWORD m_nTTL;
00056 GGUID m_pGUID;
00057 PROTOCOLID m_nProtocol;
00058 BOOL m_bWrapped;
00059 protected:
00060 CPacket* m_pPacket;
00061 CMapPtrToPtr m_pSchemas;
00062
00063
00064 public:
00065 int Execute(int nMaximum = -1);
00066 void WriteVirtualTree();
00067 protected:
00068 int ExecuteSharedFiles(int nMaximum);
00069 BOOL AddHit(CLibraryFile* pFile, int nIndex);
00070 BOOL AddHitG1(CLibraryFile* pFile, int nIndex);
00071 BOOL AddHitG2(CLibraryFile* pFile, int nIndex);
00072 int ExecutePartialFiles(int nMaximum);
00073 void AddHit(CDownload* pDownload, int nIndex);
00074 protected:
00075 void CreatePacket(int nCount);
00076 void CreatePacketG1(int nCount);
00077 void CreatePacketG2();
00078 void AddMetadata(CSchema* pSchema, CXMLElement* pXML, int nIndex);
00079 CString GetXMLString();
00080 void WriteTrailer();
00081 void WriteTrailerG1();
00082 void WriteTrailerG2();
00083 void DispatchPacket();
00084 void DestroyPacket();
00085 CG2Packet* AlbumToPacket(CAlbumFolder* pFolder);
00086 CG2Packet* FoldersToPacket();
00087 CG2Packet* FolderToPacket(CLibraryFolder* pFolder);
00088
00089 };
00090
00091 #endif // !defined(AFX_LOCALSEARCH_H__5588AE7C_89B4_4B75_95C5_1519DD6F6D9E__INCLUDED_)