00001 // 00002 // SearchManager.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_SEARCHMANAGER_H__FE71D8A9_8260_4548_B331_C1BF2D0DFEF0__INCLUDED_) 00023 #define AFX_SEARCHMANAGER_H__FE71D8A9_8260_4548_B331_C1BF2D0DFEF0__INCLUDED_ 00024 00025 #pragma once 00026 00027 class CManagedSearch; 00028 class CG2Packet; 00029 class CQueryHit; 00030 00031 00032 class CSearchManager 00033 { 00034 // Construction 00035 public: 00036 CSearchManager(); 00037 virtual ~CSearchManager(); 00038 00039 // Attributes 00040 public: 00041 CMutex m_pSection; 00042 GGUID m_pLastED2KSearch; 00043 protected: 00044 CPtrList m_pList; 00045 DWORD m_tLastTick; 00046 int m_nPriorityClass; 00047 int m_nPriorityCount; 00048 00049 // Operations 00050 public: 00051 POSITION GetIterator() const; 00052 CManagedSearch* GetNext(POSITION& pos) const; 00053 int GetCount() const; 00054 CManagedSearch* Find(GGUID* pGUID); 00055 void OnRun(); 00056 BOOL OnQueryAck(CG2Packet* pPacket, SOCKADDR_IN* pHost, GGUID* pGUID); 00057 BOOL OnQueryHits(CQueryHit* pHits); 00058 WORD OnQueryStatusRequest(GGUID* pGUID); 00059 protected: 00060 void Add(CManagedSearch* pSearch); 00061 void Remove(CManagedSearch* pSearch); 00062 00063 friend class CManagedSearch; 00064 00065 }; 00066 00067 extern CSearchManager SearchManager; 00068 00069 #endif // !defined(AFX_SEARCHMANAGER_H__FE71D8A9_8260_4548_B331_C1BF2D0DFEF0__INCLUDED_)