diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-01 17:08:31 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-01 17:08:31 +0000 |
commit | ade5e948783377dfb7820f8ba8957fe9ae0e3147 (patch) | |
tree | fbf21b8743670d3b17488ad38bc84fac3cd776ff /include | |
parent | f326e475e311bf0fa211ccd052ba38d8235efa12 (diff) |
Added nonblocking dns
*** BUG BUG BUG - If dns is slow, things will go wrong!!!! do not use this on a live net without accepting the risk involved! ***
Will be fixed by next commit.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@938 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r-- | include/dns.h | 62 | ||||
-rw-r--r-- | include/dnsqueue.h | 5 | ||||
-rw-r--r-- | include/users.h | 4 |
3 files changed, 71 insertions, 0 deletions
diff --git a/include/dns.h b/include/dns.h new file mode 100644 index 000000000..9a93a9da7 --- /dev/null +++ b/include/dns.h @@ -0,0 +1,62 @@ +/* +dns.h - dns library declarations based on firedns Copyright (C) 2002 Ian Gulliver + +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as +published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _DNS_H +#define _DNS_H + +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <string> + +struct dns_ip4list { + in_addr ip; + dns_ip4list *next; +}; + +class DNS +{ +private: + char *result; + in_addr *binip; + int t,i; + void dns_init(); + unsigned int fd; + void dns_init_2(const char* dnsserver); + in_addr *dns_aton4(const char * const ipstring); + char *dns_ntoa4(const in_addr * const ip); + int dns_getip4(const char * const name); + int dns_getip4list(const char * const name); + int dns_getname4(const in_addr * const ip); + char *dns_getresult(const int fd); + in_addr *dns_aton4_s(const char * const ipstring, in_addr * const ip); + char *dns_ntoa4_s(const in_addr * const ip, char * const result); + char *dns_getresult_s(const int fd, char * const result); + in_addr *dns_aton4_r(const char * const ipstring); + char *dns_ntoa4_r(const in_addr * const ip); + char *dns_getresult_r(const int fd); +public: + DNS(); + DNS(std::string dnsserver); + ~DNS(); + bool ReverseLookup(std::string ip); + bool ForwardLookup(std::string host); + bool HasResult(); + std::string GetResult(); +}; + +#endif diff --git a/include/dnsqueue.h b/include/dnsqueue.h new file mode 100644 index 000000000..683257242 --- /dev/null +++ b/include/dnsqueue.h @@ -0,0 +1,5 @@ +#include "inspircd.h" +#include "users.h" + +bool lookup_dns(userrec* u); +void dns_poll(); diff --git a/include/users.h b/include/users.h index fbe71d00a..b5a737c88 100644 --- a/include/users.h +++ b/include/users.h @@ -155,6 +155,10 @@ class userrec : public connection */ char oper[NICKMAX]; + /** True when DNS lookups are completed. + */ + bool dns_done; + userrec(); virtual ~userrec() { } |