-bool DNS::ReverseLookup(const std::string &ip, bool ins)
-{
- if (ServerInstance && ServerInstance->stats)
- ServerInstance->stats->statsDns++;
- binip = dns_aton4(ip.c_str());
- if (binip == NULL)
- {
- return false;
- }
-
- this->myfd = dns_getname4(binip);
- if (this->myfd == -1)
- {
- return false;
- }
- log(DEBUG,"DNS: ReverseLookup, fd=%d",this->myfd);
-#ifndef THREADED_DNS
- if (ins)
- {
- if (ServerInstance && ServerInstance->SE)
- ServerInstance->SE->AddFd(this->myfd,true,X_ESTAB_DNS);
- }
-#endif
- return true;
-}
-
-bool DNS::ForwardLookup(const std::string &host, bool ins)
-{
- if (ServerInstance && ServerInstance->stats)
- ServerInstance->stats->statsDns++;
- this->myfd = dns_getip4(host.c_str());
- if (this->myfd == -1)
- {
- return false;
- }
- log(DEBUG,"DNS: ForwardLookup, fd=%d",this->myfd);
-#ifndef THREADED_DNS
- if (ins)
- {
- if (ServerInstance && ServerInstance->SE)
- ServerInstance->SE->AddFd(this->myfd,true,X_ESTAB_DNS);
- }
-#endif
- return true;
-}
-
-bool DNS::ForwardLookupWithFD(const std::string &host, int &fd)
-{
- if (ServerInstance && ServerInstance->stats)
- ServerInstance->stats->statsDns++;
- this->myfd = dns_getip4(host.c_str());
- fd = this->myfd;
- if (this->myfd == -1)
- {
- return false;
- }
- log(DEBUG,"DNS: ForwardLookupWithFD, fd=%d",this->myfd);
- if (ServerInstance && ServerInstance->SE)
- ServerInstance->SE->AddFd(this->myfd,true,X_ESTAB_MODULE);
- return true;
-}
-
-bool DNS::HasResult(int fd)
-{
- return (fd == this->myfd);
-}
-
-/* Only the multithreaded dns uses this poll() based
- * check now. As its in another thread we dont have
- * to worry about its performance that much.
- */
-bool DNS::HasResult()
-{
- log(DEBUG,"DNS: HasResult, fd=%d",this->myfd);
- pollfd polls;
- polls.fd = this->myfd;
- polls.events = POLLIN;
- int ret = poll(&polls,1,1);
- log(DEBUG,"DNS: Hasresult returning %d",ret);
- return (ret > 0);
-}
-
-int DNS::GetFD()