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

EDClients.h

Go to the documentation of this file.
00001 //
00002 // EDClients.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_EDCLIENTS_H__CAA5D657_A66D_4F1E_97E7_64279D0B821D__INCLUDED_)
00023 #define AFX_EDCLIENTS_H__CAA5D657_A66D_4F1E_97E7_64279D0B821D__INCLUDED_
00024 
00025 #pragma once
00026 
00027 class CConnection;
00028 class CEDClient;
00029 class CEDPacket;
00030 
00031 
00032 class CEDClients
00033 {
00034 // Construction
00035 public:
00036         CEDClients();
00037         virtual ~CEDClients();
00038 
00039 // Attributes
00040 protected:
00041         CEDClient*              m_pFirst;
00042         CEDClient*              m_pLast;
00043         int                             m_nCount;
00044         DWORD                   m_tLastRun;
00045         DWORD                   m_tLastMaxClients;
00046         DWORD                   m_tLastServerStats;
00047         in_addr                 m_pLastServer;
00048         DWORD                   m_nLastServerKey;
00049         BOOL                    m_bAllServersDone;
00050 
00051 // Operations
00052 protected:
00053         void                    Add(CEDClient* pClient);
00054         void                    Remove(CEDClient* pClient);
00055 public:
00056         void                    Clear();
00057         BOOL                    PushTo(DWORD nClientID, WORD nClientPort);
00058         CEDClient*              Connect(DWORD nClientID, WORD nClientPort, IN_ADDR* pServerAddress, WORD nServerPort, GGUID* pGUID = NULL);
00059         CEDClient*              GetByIP(IN_ADDR* pAddress);
00060         CEDClient*              GetByID(DWORD nClientID, IN_ADDR* pServer = NULL, GGUID* pGUID = NULL);
00061         CEDClient*              GetByGUID(GGUID* pHash);
00062         BOOL                    Merge(CEDClient* pClient);
00063         BOOL                    IsFull(CEDClient* pCheckThis = NULL);
00064         BOOL                    IsOverloaded();
00065 public:
00066         void                    OnRun();
00067         BOOL                    OnAccept(CConnection* pConnection);
00068         BOOL                    OnUDP(SOCKADDR_IN* pHost, CEDPacket* pPacket);
00069 private:
00070         void                    OnServerStatus(SOCKADDR_IN* pHost, CEDPacket* pPacket);
00071         void                    RequestServerStatus(IN_ADDR* pHost, WORD nPort);
00072         void                    RunGlobalStatsRequests(DWORD tNow);
00073 
00074 public:
00075 
00076         inline CEDClient* GetFirst() const
00077         {
00078                 return m_pFirst;
00079         }
00080 
00081         friend class CEDClient;
00082 };
00083 
00084 
00085 extern CEDClients EDClients;
00086 
00087 
00088 #endif // !defined(AFX_EDCLIENTS_H__CAA5D657_A66D_4F1E_97E7_64279D0B821D__INCLUDED_)

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