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

LocalSearch.h

Go to the documentation of this file.
00001 //
00002 // LocalSearch.h
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 // Construction
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 // Attributes
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 // Operations
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_)

Generated on Thu Dec 15 10:39:44 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2