00001 // 00002 // ManagedSearch.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_MANAGEDSEARCH_H__F6DF037C_8FF5_4D18_AB90_3BF637B3CAA9__INCLUDED_) 00023 #define AFX_MANAGEDSEARCH_H__F6DF037C_8FF5_4D18_AB90_3BF637B3CAA9__INCLUDED_ 00024 00025 #pragma once 00026 00027 class CPacket; 00028 class CQuerySearch; 00029 class CNeighbour; 00030 00031 00032 class CManagedSearch 00033 { 00034 // Construction 00035 public: 00036 CManagedSearch(CQuerySearch* pSearch = NULL, int nPriority = 0); 00037 virtual ~CManagedSearch(); 00038 00039 enum { spHighest, spMedium, spLowest, spMax }; 00040 00041 // Attributes 00042 public: 00043 CQuerySearch* m_pSearch; 00044 int m_nPriority; 00045 BOOL m_bAllowG2; 00046 BOOL m_bAllowG1; 00047 BOOL m_bAllowED2K; 00048 public: 00049 BOOL m_bActive; 00050 BOOL m_bReceive; 00051 public: 00052 DWORD m_tStarted; // Time search was started 00053 DWORD m_nHits; // Hits 00054 DWORD m_nHubs; // Number of G2 hubs searched 00055 DWORD m_nLeaves; // Number of G2 leaves searched 00056 DWORD m_nQueryCount; // Total Gnutella2 queries sent 00057 DWORD m_tLastG2; // Time a G2 hub was last searched 00058 DWORD m_tLastED2K; // Time an ed2k server was last searched 00059 DWORD m_tMoreResults; // Time more results were requested from an ed2k server 00060 DWORD m_nEDServers; // Number of EDonkey servers searched 00061 DWORD m_nEDClients; // Number of ED2K clients searched (Guess) 00062 protected: 00063 CMapPtrToPtr m_pNodes; 00064 DWORD m_tExecute; 00065 00066 // Operations 00067 public: 00068 void Serialize(CArchive& ar); 00069 void Start(); 00070 void Stop(); 00071 BOOL Execute(); 00072 void OnHostAcknowledge(DWORD nAddress); 00073 BOOL IsLastED2KSearch(); 00074 protected: 00075 BOOL ExecuteNeighbours(DWORD tTicks, DWORD tSecs); 00076 BOOL ExecuteG2Mesh(DWORD tTicks, DWORD tSecs); 00077 BOOL ExecuteDonkeyMesh(DWORD tTicks, DWORD tSecs); 00078 00079 // Inlines 00080 public: 00081 00082 inline CQuerySearch* GetSearch() const { return m_pSearch; } 00083 inline BOOL IsActive() const { return m_bActive; } 00084 inline int GetPriority() const { return m_nPriority; } 00085 inline void SetPriority(int nPriority) { m_nPriority = nPriority; } 00086 00087 }; 00088 00089 #endif // !defined(AFX_MANAGEDSEARCH_H__F6DF037C_8FF5_4D18_AB90_3BF637B3CAA9__INCLUDED_)