MCPcopy Create free account
hub / github.com/cppla/ServerStatus / IsBanned

Method IsBanned

server/src/netban.cpp:436–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

434}
435
436bool CNetBan::IsBanned(const NETADDR *pAddr, char *pBuf, unsigned BufferSize) const
437{
438 CNetHash aHash[17];
439 int Length = CNetHash::MakeHashArray(pAddr, aHash);
440
441 // check ban adresses
442 CBanAddr *pBan = m_BanAddrPool.Find(pAddr, &aHash[Length]);
443 if(pBan)
444 {
445 MakeBanInfo(pBan, pBuf, BufferSize, MSGTYPE_PLAYER);
446 return true;
447 }
448
449 // check ban ranges
450 for(int i = Length-1; i >= 0; --i)
451 {
452 for(CBanRange *pBan = m_BanRangePool.First(&aHash[i]); pBan; pBan = pBan->m_pHashNext)
453 {
454 if(NetMatch(&pBan->m_Data, pAddr, i, Length))
455 {
456 MakeBanInfo(pBan, pBuf, BufferSize, MSGTYPE_PLAYER);
457 return true;
458 }
459 }
460 }
461
462 return false;
463}

Callers 1

UpdateMethod · 0.80

Calls 2

FindMethod · 0.80
FirstMethod · 0.80

Tested by

no test coverage detected