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

Function IsDDNetControlMsg

src/engine/shared/network_server.cpp:564–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

562}
563
564static bool IsDDNetControlMsg(const CNetPacketConstruct *pPacket)
565{
566 if(!(pPacket->m_Flags & NET_PACKETFLAG_CONTROL) || pPacket->m_DataSize < 1)
567 {
568 return false;
569 }
570 if(pPacket->m_aChunkData[0] == NET_CTRLMSG_CONNECT && pPacket->m_DataSize >= (int)(1 + sizeof(SECURITY_TOKEN_MAGIC) + sizeof(SECURITY_TOKEN)) && mem_comp(&pPacket->m_aChunkData[1], SECURITY_TOKEN_MAGIC, sizeof(SECURITY_TOKEN_MAGIC)) == 0)
571 {
572 // DDNet CONNECT
573 return true;
574 }
575 if(pPacket->m_aChunkData[0] == NET_CTRLMSG_ACCEPT && pPacket->m_DataSize >= 1 + (int)sizeof(SECURITY_TOKEN))
576 {
577 // DDNet ACCEPT
578 return true;
579 }
580 return false;
581}
582
583/*
584 TODO: chopp up this function into smaller working parts

Callers 1

RecvMethod · 0.85

Calls 1

mem_compFunction · 0.85

Tested by

no test coverage detected