2 PowerDNS Versatile Database Driven Nameserver
3 Copyright (C) 2002 PowerDNS.COM BV
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <sys/types.h>
26 # include <arpa/nameser.h>
30 # include <sys/time.h>
33 # include <sys/socket.h>
34 # include <netinet/in.h>
35 # include <arpa/inet.h>
39 #include "ahuexception.hh"
43 class ResolverException : public AhuException
46 ResolverException(const string &reason) : AhuException(reason){}
57 typedef vector<DNSResourceRecord> res_t;
58 void makeSocket(int type);
60 void makeTCPSocket(const string &ip, u_int16_t port=53);
61 int notify(int sock, const string &domain, const string &ip, u_int16_t id);
62 int resolve(const string &ip, const char *domain, int type);
63 char* sendReceive(const string &ip, u_int16_t remotePort, const char *packet, int length, unsigned int *replylen);
64 int getSoaSerial(const string &, const string &, u_int32_t *);
65 int axfrChunk(Resolver::res_t &res);
66 vector<DNSResourceRecord> result();
68 void setRemote(const string &remote);
69 int axfr(const string &ip, const char *domain);
72 void timeoutReadn(char *buffer, int bytes);