ddnet/src/engine/server/register.h
def 3be8a592e5 Run clang-format
Purely automatic change. In case of conflict with this change, apply the
other change and rerun the formatting to restore it:

$ python scripts/fix_style.py
2020-09-26 21:50:15 +02:00

61 lines
1.6 KiB
C++

/* (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. */
#ifndef ENGINE_SERVER_REGISTER_H
#define ENGINE_SERVER_REGISTER_H
#include <engine/masterserver.h>
#include <engine/shared/network.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;
SECURITY_TOKEN m_Token;
};
class CNetServer *m_pNetServer;
class IEngineMasterServer *m_pMasterServer;
class IConsole *m_pConsole;
bool m_Sixup;
const char *m_pName;
int64 m_LastTokenRequest;
int m_RegisterState;
int64 m_RegisterStateStart;
int m_RegisterFirst;
int m_RegisterCount;
CMasterserverInfo m_aMasterserverInfo[IMasterServer::MAX_MASTERSERVERS];
int m_RegisterRegisteredServer;
void RegisterNewState(int State);
void RegisterSendFwcheckresponse(NETADDR *pAddr, SECURITY_TOKEN ResponseToken);
void RegisterSendHeartbeat(NETADDR Addr, SECURITY_TOKEN ResponseToken);
void RegisterSendCountRequest(NETADDR Addr, SECURITY_TOKEN ResponseToken);
void RegisterGotCount(struct CNetChunk *pChunk);
public:
CRegister(bool Sixup);
void Init(class CNetServer *pNetServer, class IEngineMasterServer *pMasterServer, class IConsole *pConsole);
void RegisterUpdate(int Nettype);
int RegisterProcessPacket(struct CNetChunk *pPacket, SECURITY_TOKEN ResponseToken = 0);
void FeedToken(NETADDR Addr, SECURITY_TOKEN ResponseToken);
};
#endif