]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/lwres.hh
Standardize license text in all PDNS files
[thirdparty/pdns.git] / pdns / lwres.hh
1 /*
2 * This file is part of PowerDNS or dnsdist.
3 * Copyright -- PowerDNS.COM B.V. and its contributors
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * In addition, for the avoidance of any doubt, permission is granted to
10 * link this program with OpenSSL and to (re)distribute the binaries
11 * produced as the result of such linking.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22 #ifndef PDNS_LWRES_HH
23 #define PDNS_LWRES_HH
24 #include <string>
25 #include <vector>
26 #include <sys/types.h>
27 #include "misc.hh"
28 #include "iputils.hh"
29 #include <netdb.h>
30 #include <unistd.h>
31 #include <sys/time.h>
32 #include <sys/uio.h>
33 #include <fcntl.h>
34 #include <sys/socket.h>
35 #include <netinet/in.h>
36 #include "dnsparser.hh"
37 #include <arpa/inet.h>
38 #undef res_mkquery
39
40 #include "pdnsexception.hh"
41 #include "dns.hh"
42 #include "namespaces.hh"
43
44 int asendto(const char *data, size_t len, int flags, const ComboAddress& ip, uint16_t id,
45 const DNSName& domain, uint16_t qtype, int* fd);
46 int arecvfrom(char *data, size_t len, int flags, const ComboAddress& ip, size_t *d_len, uint16_t id,
47 const DNSName& domain, uint16_t qtype, int fd, struct timeval* now);
48
49 class LWResException : public PDNSException
50 {
51 public:
52 LWResException(const string &reason) : PDNSException(reason){}
53 };
54
55 //! LWRes class
56 class LWResult
57 {
58 public:
59 LWResult() : d_usec(0) {}
60
61 vector<DNSRecord> d_records;
62 int d_rcode{0};
63 bool d_aabit{false}, d_tcbit{false};
64 uint32_t d_usec{0};
65 bool d_haveEDNS{false};
66 };
67
68 int asyncresolve(const ComboAddress& ip, const DNSName& domain, int type, bool doTCP, bool sendRDQuery, int EDNS0Level, struct timeval* now, boost::optional<Netmask>& srcmask, LWResult* res);
69 #endif // PDNS_LWRES_HH