2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-08-24 21:38:40 +00:00
|
|
|
#ifndef ENGINE_SERVER_REGISTER_H
|
|
|
|
#define ENGINE_SERVER_REGISTER_H
|
|
|
|
|
|
|
|
#include <engine/masterserver.h>
|
|
|
|
|
|
|
|
class CRegister
|
|
|
|
{
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
REGISTERSTATE_START=0,
|
|
|
|
REGISTERSTATE_UPDATE_ADDRS,
|
|
|
|
REGISTERSTATE_QUERY_COUNT,
|
|
|
|
REGISTERSTATE_HEARTBEAT,
|
|
|
|
REGISTERSTATE_REGISTERED,
|
|
|
|
REGISTERSTATE_ERROR
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CMasterserverInfo
|
|
|
|
{
|
|
|
|
NETADDR m_Addr;
|
|
|
|
int m_Count;
|
|
|
|
int m_Valid;
|
|
|
|
int64 m_LastSend;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CNetServer *m_pNetServer;
|
|
|
|
class IEngineMasterServer *m_pMasterServer;
|
2010-08-17 22:06:00 +00:00
|
|
|
class IConsole *m_pConsole;
|
2010-08-24 21:38:40 +00:00
|
|
|
|
|
|
|
int m_RegisterState;
|
|
|
|
int64 m_RegisterStateStart;
|
|
|
|
int m_RegisterFirst;
|
|
|
|
int m_RegisterCount;
|
|
|
|
|
2011-04-19 09:54:44 +00:00
|
|
|
CMasterserverInfo m_aMasterserverInfo[IMasterServer::MAX_MASTERSERVERS];
|
2010-08-24 21:38:40 +00:00
|
|
|
int m_RegisterRegisteredServer;
|
|
|
|
|
|
|
|
void RegisterNewState(int State);
|
|
|
|
void RegisterSendFwcheckresponse(NETADDR *pAddr);
|
|
|
|
void RegisterSendHeartbeat(NETADDR Addr);
|
|
|
|
void RegisterSendCountRequest(NETADDR Addr);
|
2011-04-19 09:54:44 +00:00
|
|
|
void RegisterGotCount(struct CNetChunk *pChunk);
|
2010-08-24 21:38:40 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
CRegister();
|
2010-08-17 22:06:00 +00:00
|
|
|
void Init(class CNetServer *pNetServer, class IEngineMasterServer *pMasterServer, class IConsole *pConsole);
|
2011-04-04 16:20:05 +00:00
|
|
|
void RegisterUpdate(int Nettype);
|
2011-04-19 09:54:44 +00:00
|
|
|
int RegisterProcessPacket(struct CNetChunk *pPacket);
|
2010-08-24 21:38:40 +00:00
|
|
|
};
|
|
|
|
|
2010-10-11 01:50:43 +00:00
|
|
|
#endif
|