Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class 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         char localbuf[1024];
00041         int t;
00042         void dns_init();
00043         int myfd;
00044         void dns_init_2(const char* dnsserver);
00045         in_addr *dns_aton4(const char * const ipstring);
00046         char *dns_ntoa4(const in_addr * const ip);
00047         int dns_getip4(const char * const name);
00048         int dns_getip4list(const char * const name);
00049         int dns_getname4(const in_addr * const ip);
00050         char *dns_getresult(const int fd);
00051         in_addr *dns_aton4_s(const char * const ipstring, in_addr * const ip);
00052         char *dns_ntoa4_s(const in_addr * const ip, char * const result);
00053         char *dns_getresult_s(const int fd, char * const result);
00054         in_addr *dns_aton4_r(const char * const ipstring);
00055         char *dns_ntoa4_r(const in_addr * const ip);
00056         char *dns_getresult_r(const int fd);
00057 public:
00064         DNS();
00068         DNS(std::string dnsserver);
00071         ~DNS();
00076         bool ReverseLookup(std::string ip);
00080         bool ForwardLookup(std::string host);
00084         bool HasResult();
00088         std::string GetResult();
00089         std::string GetResultIP();
00093         int GetFD();
00094         void SetNS(std::string dnsserver);
00095 };
00096 
00097 #endif

Generated on Fri Dec 9 20:20:03 2005 for InspIRCd by  doxygen 1.4.4-20050815