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>
|
2020-09-25 16:11:59 +00:00
|
|
|
#include <engine/shared/network.h>
|
2010-08-24 21:38:40 +00:00
|
|
|
|
|
|
|
class CRegister
|
|
|
|
{
|
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
REGISTERSTATE_START = 0,
|
2010-08-24 21:38:40 +00:00
|
|
|
REGISTERSTATE_UPDATE_ADDRS,
|
|
|
|
REGISTERSTATE_QUERY_COUNT,
|
|
|
|
REGISTERSTATE_HEARTBEAT,
|
|
|
|
REGISTERSTATE_REGISTERED,
|
|
|
|
REGISTERSTATE_ERROR
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CMasterserverInfo
|
|
|
|
{
|
|
|
|
NETADDR m_Addr;
|
|
|
|
int m_Count;
|
|
|
|
int m_Valid;
|
2021-06-23 05:05:49 +00:00
|
|
|
int64_t m_LastSend;
|
2020-06-16 12:41:30 +00:00
|
|
|
SECURITY_TOKEN m_Token;
|
2010-08-24 21:38:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CNetServer *m_pNetServer;
|
|
|
|
class IEngineMasterServer *m_pMasterServer;
|
2021-01-10 12:47:07 +00:00
|
|
|
class CConfig *m_pConfig;
|
2010-08-17 22:06:00 +00:00
|
|
|
class IConsole *m_pConsole;
|
2010-08-24 21:38:40 +00:00
|
|
|
|
2020-06-16 12:41:30 +00:00
|
|
|
bool m_Sixup;
|
|
|
|
const char *m_pName;
|
2021-06-23 05:05:49 +00:00
|
|
|
int64_t m_LastTokenRequest;
|
2020-06-16 12:41:30 +00:00
|
|
|
|
2010-08-24 21:38:40 +00:00
|
|
|
int m_RegisterState;
|
2021-06-23 05:05:49 +00:00
|
|
|
int64_t m_RegisterStateStart;
|
2010-08-24 21:38:40 +00:00
|
|
|
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);
|
2020-06-16 12:41:30 +00:00
|
|
|
void RegisterSendFwcheckresponse(NETADDR *pAddr, SECURITY_TOKEN ResponseToken);
|
|
|
|
void RegisterSendHeartbeat(NETADDR Addr, SECURITY_TOKEN ResponseToken);
|
|
|
|
void RegisterSendCountRequest(NETADDR Addr, SECURITY_TOKEN ResponseToken);
|
2011-04-19 09:54:44 +00:00
|
|
|
void RegisterGotCount(struct CNetChunk *pChunk);
|
2010-08-24 21:38:40 +00:00
|
|
|
|
|
|
|
public:
|
2020-06-16 12:41:30 +00:00
|
|
|
CRegister(bool Sixup);
|
2021-01-10 12:47:07 +00:00
|
|
|
void Init(class CNetServer *pNetServer, class IEngineMasterServer *pMasterServer, class CConfig *pConfig, class IConsole *pConsole);
|
2011-04-04 16:20:05 +00:00
|
|
|
void RegisterUpdate(int Nettype);
|
2020-06-16 12:41:30 +00:00
|
|
|
int RegisterProcessPacket(struct CNetChunk *pPacket, SECURITY_TOKEN ResponseToken = 0);
|
|
|
|
void FeedToken(NETADDR Addr, SECURITY_TOKEN ResponseToken);
|
2010-08-24 21:38:40 +00:00
|
|
|
};
|
|
|
|
|
2010-10-11 01:50:43 +00:00
|
|
|
#endif
|