Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

dns.h

Go to the documentation of this file.
00001 /*
00002 dns.h - dns library declarations based on firedns Copyright (C) 2002 Ian Gulliver
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of version 2 of the GNU General Public License as
00006 published by the Free Software Foundation.
00007 
00008 This program is distributed in the hope that it will be useful,
00009 but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 GNU General Public License for more details.
00012 
00013 You should have received a copy of the GNU General Public License
00014 along with this program; if not, write to the Free Software
00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00016 */
00017 
00018 #ifndef _DNS_H
00019 #define _DNS_H
00020 
00021 #include <sys/types.h>
00022 #include <sys/socket.h>
00023 #include <netinet/in.h>
00024 #include <string>
00025 
00026 struct dns_ip4list {
00027         in_addr ip;
00028         dns_ip4list *next;
00029 };
00030 
00031 
00035 class DNS
00036 {
00037 private:
00038         in_addr *binip;
00039         char* result;
00040         int t;
00041         void dns_init();
00042         unsigned int fd;
00043         void dns_init_2(const char* dnsserver);
00044         in_addr *dns_aton4(const char * const ipstring);
00045         char *dns_ntoa4(const in_addr * const ip);
00046         int dns_getip4(const char * const name);
00047         int dns_getip4list(const char * const name);
00048         int dns_getname4(const in_addr * const ip);
00049         char *dns_getresult(const int fd);
00050         in_addr *dns_aton4_s(const char * const ipstring, in_addr * const ip);
00051         char *dns_ntoa4_s(const in_addr * const ip, char * const result);
00052         char *dns_getresult_s(const int fd, char * const result);
00053         in_addr *dns_aton4_r(const char * const ipstring);
00054         char *dns_ntoa4_r(const in_addr * const ip);
00055         char *dns_getresult_r(const int fd);
00056 public:
00063         DNS();
00067         DNS(std::string dnsserver);
00070         ~DNS();
00075         bool ReverseLookup(std::string ip);
00079         bool ForwardLookup(std::string host);
00083         bool HasResult();
00087         std::string GetResult();
00091         int GetFD();
00092         void SetNS(std::string dnsserver);
00093 };
00094 
00095 #endif

Generated on Fri May 13 01:58:42 2005 for InspIRCd by doxygen 1.3.3