| Return Type | Function name | Arguments |
|---|---|---|
| void | SetStatusIP | (hzIpaddr,hzIpStatus,unsigned int,) |
Declared in file: hzIpaddr.h
Defined in file : hzIpServer.cpp
Function Logic:
Function body:
void SetStatusIP (hzIpaddr ipa, hzIpStatus reason, unsigned int nDelay)
{
_hzfunc(__func__) ;
hzIpinfo ipi ;
if (ipa == IPADDR_BAD || ipa == IPADDR_NULL || ipa == IPADDR_LOCAL)
return ;
threadLog("Setting Status of IP %s\n", *ipa) ;
if (!_hzGlobal_StatusIP.Exists(ipa))
{
s_status_ip_os << ipa << "\n" ;
if (!s_status_ip_os.fail())
s_status_ip_os.flush() ;
ipi.m_nSince = 1;
ipi.m_nTotal = 1;
ipi.m_bInfo |= (reason & 0xff);
if (reason & HZ_IPSTATUS_BLACK)
ipi.m_tBlack = time(0);
if (reason & HZ_IPSTATUS_WHITE)
ipi.m_tWhite = time(0);
_hzGlobal_StatusIP.Insert(ipa, ipi) ;
}
else
{
ipi = _hzGlobal_StatusIP[ipa] ;
if ((ipi.m_bInfo | reason) != ipi.m_bInfo)
{
ipi.m_bInfo |= reason ;
if (reason & HZ_IPSTATUS_BLACK)
ipi.m_tBlack = nDelay ? nDelay + time(0): 0;
if (reason & HZ_IPSTATUS_WHITE)
ipi.m_tWhite = nDelay ? nDelay + time(0): 0;
}
s_status_ip_os << ipa << "\n" ;
if (s_status_ip_os.fail())
threadLog("BLOCKED IP ADDR NOT RECORDED %s\n", *ipa) ;
else
s_status_ip_os.flush() ;
}
}