Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

NeighboursWithConnect.h

Go to the documentation of this file.
00001 //
00002 // NeighboursWithConnect.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_NEIGHBOURSWITHCONNECT_H__7BAE2435_FF99_4E23_8EBE_B7C3E5FFCCB0__INCLUDED_)
00023 #define AFX_NEIGHBOURSWITHCONNECT_H__7BAE2435_FF99_4E23_8EBE_B7C3E5FFCCB0__INCLUDED_
00024 
00025 #pragma once
00026 
00027 #include "NeighboursWithRouting.h"
00028 
00029 class CConnection;
00030 
00031 
00032 class CNeighboursWithConnect : public CNeighboursWithRouting
00033 {
00034 // Construction
00035 public:
00036         CNeighboursWithConnect();
00037         virtual ~CNeighboursWithConnect();
00038 
00039 // Operations
00040 public:
00041         CNeighbour*             ConnectTo(IN_ADDR* pAddress, WORD nPort, PROTOCOLID nProtocol, BOOL bAutomatic = FALSE, BOOL bNoUltraPeer = FALSE);
00042         CNeighbour*             OnAccept(CConnection* pConnection);
00043 public:
00044         //G2
00045         BOOL    IsG2Leaf();                                                                     //Check if this node is a G2 Leaf
00046         BOOL    IsG2Hub();                                                                      //Check if this node is a G2 Hub
00047         DWORD   IsG2HubCapable(BOOL bDebug = FALSE);            //Check if this node can be a G2 Hub
00048         //G1
00049         BOOL    IsG1Leaf();                                                                     //Check if this node is a G1 Leaf
00050         BOOL    IsG1Ultrapeer();                                                        //Check if this node is a G1 Ultrapeer
00051         DWORD   IsG1UltrapeerCapable(BOOL bDebug = FALSE);      //Check if this node can be a G1 Ultrapeer
00052         //Either protocol
00053         BOOL    NeedMoreHubs(PROTOCOLID nProtocol);                     //Does this node need more hubs for the specified protocol
00054         BOOL    NeedMoreLeafs(PROTOCOLID nProtocol);            //Does this node need more leaves for the specified protocol
00055         BOOL    IsHubLoaded(PROTOCOLID nProtocol);                      //Is this hub/up at more than 3/4 capacity?
00056 protected:
00057         BOOL    m_bG2Leaf;                                                                      // Are we a G2 leaf?
00058         BOOL    m_bG2Hub;                                                                       // Are we a G2 hub?
00059         BOOL    m_bG1Leaf;                                                                      // Are we a G1 leaf?
00060         BOOL    m_bG1Ultrapeer;                                                         // Are we a G1 ultrapeer?
00061 
00062         DWORD   m_tHubG2Promotion;                                                      // Time we were promoted to a G2 hub
00063 public:
00064         virtual void    OnRun();
00065 protected:
00066         void    Maintain();                                                                     //Initiate/close connections as required
00067         void    PeerPrune(PROTOCOLID nProtocol);                        //Close peer connections (if you get a hub/up)
00068 
00069 // Data
00070 protected:
00071         DWORD   m_tPresent[8];
00072 
00073 };
00074 
00075 #endif // !defined(AFX_NEIGHBOURSWITHCONNECT_H__7BAE2435_FF99_4E23_8EBE_B7C3E5FFCCB0__INCLUDED_)

Generated on Thu Dec 15 10:39:45 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2