MCPcopy Create free account
hub / github.com/ddnet/ddnet / CRegister

Method CRegister

src/engine/server/register.cpp:516–543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

514}
515
516CRegister::CRegister(CConfig *pConfig, IConsole *pConsole, IEngine *pEngine, IHttp *pHttp, int ServerPort, unsigned SixupSecurityToken) :
517 m_pConfig(pConfig),
518 m_pConsole(pConsole),
519 m_pEngine(pEngine),
520 m_pHttp(pHttp),
521 m_ServerPort(ServerPort),
522 m_aProtocols{
523 CProtocol(this, PROTOCOL_TW6_IPV6),
524 CProtocol(this, PROTOCOL_TW6_IPV4),
525 CProtocol(this, PROTOCOL_TW7_IPV6),
526 CProtocol(this, PROTOCOL_TW7_IPV4),
527 }
528{
529 static constexpr int HEADER_LEN = sizeof(SERVERBROWSE_CHALLENGE);
530 mem_copy(m_aVerifyPacketPrefix, SERVERBROWSE_CHALLENGE, HEADER_LEN);
531 FormatUuid(m_ChallengeSecret, m_aVerifyPacketPrefix + HEADER_LEN, sizeof(m_aVerifyPacketPrefix) - HEADER_LEN);
532 m_aVerifyPacketPrefix[HEADER_LEN + UUID_MAXSTRSIZE - 1] = ':';
533
534 // The DDNet code uses the `unsigned` security token in big-endian byte order.
535 str_format(m_aConnlessTokenHex, sizeof(m_aConnlessTokenHex), "%08x", SixupSecurityToken);
536
537 m_pConsole->Chain("sv_register", ConchainOnConfigChange, this);
538 m_pConsole->Chain("sv_register_extra", ConchainOnConfigChange, this);
539 m_pConsole->Chain("sv_register_url", ConchainOnConfigChange, this);
540 m_pConsole->Chain("sv_register_community_token", ConchainOnConfigChange, this);
541 m_pConsole->Chain("sv_sixup", ConchainOnConfigChange, this);
542 m_pConsole->Chain("sv_ipv4only", ConchainOnConfigChange, this);
543}
544
545void CRegister::Update()
546{

Callers

nothing calls this directly

Calls 5

mem_copyFunction · 0.85
FormatUuidFunction · 0.85
str_formatFunction · 0.85
ChainMethod · 0.80
CProtocolClass · 0.70

Tested by

no test coverage detected