00001 // 00002 // NeighboursBase.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_NEIGHBOURSBASE_H__EE5DBF25_1EC6_40A7_9343_7373A2A882AD__INCLUDED_) 00023 #define AFX_NEIGHBOURSBASE_H__EE5DBF25_1EC6_40A7_9343_7373A2A882AD__INCLUDED_ 00024 00025 #pragma once 00026 00027 class CNeighbour; 00028 00029 00030 class CNeighboursBase 00031 { 00032 // Construction 00033 public: 00034 CNeighboursBase(); 00035 virtual ~CNeighboursBase(); 00036 00037 // Attributes 00038 protected: 00039 CMapPtrToPtr m_pUniques; 00040 DWORD m_nUnique; 00041 DWORD m_nRunCookie; 00042 public: 00043 DWORD m_nStableCount; 00044 DWORD m_nLeafCount; 00045 DWORD m_nLeafContent; 00046 DWORD m_nBandwidthIn; 00047 DWORD m_nBandwidthOut; 00048 00049 // Operations 00050 public: 00051 POSITION GetIterator() const; 00052 CNeighbour* GetNext(POSITION& pos) const; 00053 CNeighbour* Get(DWORD nUnique) const; 00054 CNeighbour* Get(IN_ADDR* pAddress) const; 00055 int GetCount(PROTOCOLID nProtocol, int nState, int nNodeType) const; 00056 BOOL NeighbourExists(PROTOCOLID nProtocol, int nState, int nNodeType) const; 00057 public: 00058 virtual void Connect(); 00059 virtual void Close(); 00060 virtual void OnRun(); 00061 protected: 00062 virtual void Add(CNeighbour* pNeighbour, BOOL bAssignUnique = TRUE); 00063 virtual void Remove(CNeighbour* pNeighbour); 00064 00065 friend class CNeighbour; 00066 friend class CShakeNeighbour; 00067 friend class CEDNeighbour; 00068 }; 00069 00070 00071 #endif // !defined(AFX_NEIGHBOURSBASE_H__EE5DBF25_1EC6_40A7_9343_7373A2A882AD__INCLUDED_)