]>
Commit | Line | Data |
---|---|---|
0d8612f2 | 1 | /* |
12471842 PL |
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 | */ | |
288f4aa9 BH |
22 | #ifndef PDNS_LWRES_HH |
23 | #define PDNS_LWRES_HH | |
0d8612f2 BH |
24 | #include <string> |
25 | #include <vector> | |
26 | #include <sys/types.h> | |
2353fffa | 27 | #include "misc.hh" |
996c89cc | 28 | #include "iputils.hh" |
76473b92 KM |
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> | |
57769f13 | 36 | #include "dnsparser.hh" |
76473b92 KM |
37 | #include <arpa/inet.h> |
38 | #undef res_mkquery | |
0d8612f2 | 39 | |
5c409fa2 | 40 | #include "pdnsexception.hh" |
0d8612f2 | 41 | #include "dns.hh" |
10f4eea8 | 42 | #include "namespaces.hh" |
4898a348 RG |
43 | #include "remote_logger.hh" |
44 | #include "resolve-context.hh" | |
0d8612f2 | 45 | |
a683e8bd | 46 | int asendto(const char *data, size_t len, int flags, const ComboAddress& ip, uint16_t id, |
c5c066bf | 47 | const DNSName& domain, uint16_t qtype, int* fd); |
a683e8bd RG |
48 | int arecvfrom(char *data, size_t len, int flags, const ComboAddress& ip, size_t *d_len, uint16_t id, |
49 | const DNSName& domain, uint16_t qtype, int fd, struct timeval* now); | |
0d8612f2 | 50 | |
3f81d239 | 51 | class LWResException : public PDNSException |
0d8612f2 BH |
52 | { |
53 | public: | |
dd079764 | 54 | LWResException(const string &reason_) : PDNSException(reason_){} |
0d8612f2 BH |
55 | }; |
56 | ||
57 | //! LWRes class | |
263f6a5a | 58 | class LWResult |
0d8612f2 BH |
59 | { |
60 | public: | |
9de3e034 | 61 | LWResult() : d_usec(0) {} |
0d8612f2 | 62 | |
e325f20c | 63 | vector<DNSRecord> d_records; |
34c513f9 RG |
64 | int d_rcode{0}; |
65 | bool d_aabit{false}, d_tcbit{false}; | |
66 | uint32_t d_usec{0}; | |
67 | bool d_haveEDNS{false}; | |
0d8612f2 BH |
68 | }; |
69 | ||
4898a348 | 70 | int asyncresolve(const ComboAddress& ip, const DNSName& domain, int type, bool doTCP, bool sendRDQuery, int EDNS0Level, struct timeval* now, boost::optional<Netmask>& srcmask, boost::optional<const ResolveContext&> context, std::shared_ptr<RemoteLogger> outgoingLogger, LWResult* res); |
288f4aa9 | 71 | #endif // PDNS_LWRES_HH |