00001 // 00002 // HubHorizon.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_HUBHORIZON_H__CDEFE0F8_036F_4647_9A85_CE2E41984B01__INCLUDED_) 00023 #define AFX_HUBHORIZON_H__CDEFE0F8_036F_4647_9A85_CE2E41984B01__INCLUDED_ 00024 00025 #pragma once 00026 00027 class CG2Packet; 00028 00029 00030 class CHubHorizonHub 00031 { 00032 public: 00033 IN_ADDR m_pAddress; 00034 WORD m_nPort; 00035 DWORD m_nReference; 00036 CHubHorizonHub* m_pNext; 00037 }; 00038 00039 00040 class CHubHorizonGroup 00041 { 00042 // Construction 00043 public: 00044 CHubHorizonGroup(); 00045 virtual ~CHubHorizonGroup(); 00046 00047 // Attributes 00048 protected: 00049 CHubHorizonHub** m_pList; 00050 DWORD m_nCount; 00051 DWORD m_nBuffer; 00052 00053 // Operations 00054 public: 00055 void Add(IN_ADDR* pAddress, WORD nPort); 00056 void Clear(); 00057 00058 }; 00059 00060 00061 class CHubHorizonPool 00062 { 00063 // Construction 00064 public: 00065 CHubHorizonPool(); 00066 virtual ~CHubHorizonPool(); 00067 00068 // Attributes 00069 protected: 00070 CHubHorizonHub* m_pBuffer; 00071 DWORD m_nBuffer; 00072 CHubHorizonHub* m_pFree; 00073 CHubHorizonHub* m_pActive; 00074 DWORD m_nActive; 00075 00076 // Operations 00077 public: 00078 void Setup(); 00079 void Clear(); 00080 CHubHorizonHub* Add(IN_ADDR* pAddress, WORD nPort); 00081 void Remove(CHubHorizonHub* pHub); 00082 CHubHorizonHub* Find(IN_ADDR* pAddress); 00083 int AddHorizonHubs(CG2Packet* pPacket); 00084 00085 }; 00086 00087 extern CHubHorizonPool HubHorizonPool; 00088 00089 #endif // !defined(AFX_HUBHORIZON_H__CDEFE0F8_036F_4647_9A85_CE2E41984B01__INCLUDED_)