Reads in BOTH the blacklist AND whitelist file

Return TypeFunction nameArguments
hzEcodeInitIpInfo(hzString&,)

Declared in file: hzIpaddr.h
Defined in file : hzIpServer.cpp

Function Logic:

0:START 1:unknown 2:Return E_ARGUMENT 3:rc 4:unknown 5:Return rc 6:dataDir 7:s_status_ip_fname rc 8:unknown 9:items 10:unknown 11:Return hzerr(E_OPENFAIL,Cannot open file %s\n,*s_status_ip_fname) 12:unknown 13:items 14:unknown 15:ipa 16:unknown 17:Return hzerr(E_FORMAT,Line %d of file %s, is not a valid IP address,nLine,*s_status_ip_fname) 18:items 19:items items items 20:unknown 21:Return hzerr(rc,File error %s\n,*s_status_ip_fname) 22:rc items 23:unknown 24:Return hzerr(E_OPENFAIL,Cannot open %s for writing,*s_status_ip_fname) 25:Return rc

Function body:

hzEcode InitIpInfo (hzString& dataDir)
{
   //  Category: Internet Server
   //  
   //  Reads in BOTH the blacklist AND whitelist file
   _hzfunc(__func__) ;
   ifstream    is ;            //  For reading the lists
   hzIpinfo    ipi ;           //  IP block info
   hzIpaddr    ipa ;           //  IP address
   uint32_t    nLine ;         //  Line number
   char        buf [24];       //  Line buffer
   hzEcode     rc = E_OK ;     //  Return code
   if (!dataDir)
       return E_ARGUMENT ;
   rc = AssertDir(dataDir, 0666);
   if (rc != E_OK)
       return rc ;
   s_status_ip_fname = dataDir + "/status_ip.ips" ;
   rc = TestFile(s_status_ip_fname) ;
   if (rc == E_OK)
   {
       is.open(*s_status_ip_fname) ;
       if (is.fail())
           return hzerr(E_OPENFAIL, "Cannot open file %s\n", *s_status_ip_fname) ;
       for (nLine = 1;; nLine++)
       {
           is.getline(buf, 23);
           if (!is.gcount())
               break ;
           ipa = buf ;
           if (!ipa)
               return hzerr(E_FORMAT, "Line %d of file %s, is not a valid IP address", nLine, *s_status_ip_fname) ;
           _hzGlobal_StatusIP.Insert(ipa, ipi) ;
       }
       is.close() ;
       is.clear() ;
       threadLog("Loaded %d IP address in WHITELIST\n", _hzGlobal_StatusIP.Count()) ;
   }
   else
   {
       if (rc != E_NOTFOUND && rc != E_NODATA)
           return hzerr(rc, "File error %s\n", *s_status_ip_fname) ;
   }
   rc = E_OK ;
   //  Now open the file for writing new entries
   s_status_ip_os.open(*s_status_ip_fname, ios::app) ;
   if (s_status_ip_os.fail())
       return hzerr(E_OPENFAIL, "Cannot open %s for writing", *s_status_ip_fname) ;
   return rc ;
}