ddnet/src/engine/server/register.h
2024-01-13 15:28:53 +03:00

30 lines
817 B
C++

#ifndef ENGINE_SERVER_REGISTER_H
#define ENGINE_SERVER_REGISTER_H
class CConfig;
class IConsole;
class IEngine;
class IHttp;
struct CNetChunk;
class IRegister
{
public:
virtual ~IRegister() {}
virtual void Update() = 0;
// Call `OnConfigChange` if you change relevant config variables
// without going through the console.
virtual void OnConfigChange() = 0;
// Returns `true` if the packet was a packet related to registering
// code and doesn't have to processed furtherly.
virtual bool OnPacket(const CNetChunk *pPacket) = 0;
// `pInfo` must be an encoded JSON object.
virtual void OnNewInfo(const char *pInfo) = 0;
virtual void OnShutdown() = 0;
};
IRegister *CreateRegister(CConfig *pConfig, IConsole *pConsole, IEngine *pEngine, IHttp *pHttp, int ServerPort, unsigned SixupSecurityToken);
#endif