00001 // 00002 // G2Neighbour.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_G2NEIGHBOUR_H__F3C423B0_60F0_4721_81A3_1109E59CD425__INCLUDED_) 00023 #define AFX_G2NEIGHBOUR_H__F3C423B0_60F0_4721_81A3_1109E59CD425__INCLUDED_ 00024 00025 #pragma once 00026 00027 #include "Neighbour.h" 00028 00029 class CG2Packet; 00030 class CHubHorizonGroup; 00031 00032 00033 class CG2Neighbour : public CNeighbour 00034 { 00035 // Construction 00036 public: 00037 CG2Neighbour(CNeighbour* pBase); 00038 virtual ~CG2Neighbour(); 00039 00040 // Attributes 00041 public: 00042 DWORD m_nLeafCount; 00043 DWORD m_nLeafLimit; 00044 BOOL m_bCachedKeys; 00045 CRouteCache* m_pGUIDCache; 00046 CHubHorizonGroup* m_pHubGroup; 00047 protected: 00048 LONG m_tAdjust; 00049 DWORD m_tLastPingIn; 00050 DWORD m_tLastPingOut; 00051 DWORD m_tWaitLNI; 00052 DWORD m_tLastKHL; 00053 DWORD m_tLastHAW; 00054 protected: 00055 CPtrList m_pOutbound; 00056 00057 protected: 00058 int m_nQueryLimiter; // Counter for query limiting 00059 DWORD m_tQueryTimer; // Timer for query limiting 00060 BOOL m_bBlacklisted; // Has this client been over-querying. 00061 00062 // Operations 00063 public: 00064 virtual BOOL Send(CPacket* pPacket, BOOL bRelease = TRUE, BOOL bBuffered = FALSE); 00065 virtual BOOL SendQuery(CQuerySearch* pSearch, CPacket* pPacket, BOOL bLocal); 00066 protected: 00067 virtual BOOL OnRead(); 00068 virtual BOOL OnWrite(); 00069 virtual BOOL OnRun(); 00070 protected: 00071 void SendStartups(); 00072 BOOL ProcessPackets(); 00073 BOOL OnPacket(CG2Packet* pPacket); 00074 BOOL OnPing(CG2Packet* pPacket); 00075 void SendLNI(); 00076 BOOL OnLNI(CG2Packet* pPacket); 00077 void SendKHL(); 00078 BOOL OnKHL(CG2Packet* pPacket); 00079 void SendHAW(); 00080 BOOL OnHAW(CG2Packet* pPacket); 00081 BOOL OnQuery(CG2Packet* pPacket); 00082 BOOL OnQueryAck(CG2Packet* pPacket); 00083 BOOL OnQueryKeyReq(CG2Packet* pPacket); 00084 BOOL OnQueryKeyAns(CG2Packet* pPacket); 00085 BOOL OnPush(CG2Packet* pPacket); 00086 BOOL OnProfileChallenge(CG2Packet* pPacket); 00087 BOOL OnProfileDelivery(CG2Packet* pPacket); 00088 00089 }; 00090 00091 #endif // !defined(AFX_G2NEIGHBOUR_H__F3C423B0_60F0_4721_81A3_1109E59CD425__INCLUDED_)