00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00035 public:
00036 CEDClients();
00037 virtual ~CEDClients();
00038
00039
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
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_)