]> git.ipfire.org Git - thirdparty/pdns.git/blame - pdns/lwres.hh
Avoid throwing an exception in Logger::log().
[thirdparty/pdns.git] / pdns / lwres.hh
CommitLineData
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 */
e8c59f2d 22#pragma once
0d8612f2
BH
23#include <string>
24#include <vector>
25#include <sys/types.h>
2353fffa 26#include "misc.hh"
996c89cc 27#include "iputils.hh"
76473b92
KM
28#include <netdb.h>
29#include <unistd.h>
30#include <sys/time.h>
31#include <sys/uio.h>
32#include <fcntl.h>
33#include <sys/socket.h>
34#include <netinet/in.h>
57769f13 35#include "dnsparser.hh"
76473b92
KM
36#include <arpa/inet.h>
37#undef res_mkquery
0d8612f2 38
5c409fa2 39#include "pdnsexception.hh"
0d8612f2 40#include "dns.hh"
10f4eea8 41#include "namespaces.hh"
4898a348 42#include "remote_logger.hh"
10ba6d01 43#include "fstrm_logger.hh"
4898a348 44#include "resolve-context.hh"
0d8612f2 45
b9fa43e0 46
a683e8bd 47int asendto(const char *data, size_t len, int flags, const ComboAddress& ip, uint16_t id,
c5c066bf 48 const DNSName& domain, uint16_t qtype, int* fd);
f128d20d 49int arecvfrom(std::string& packet, int flags, const ComboAddress& ip, size_t *d_len, uint16_t id,
a683e8bd 50 const DNSName& domain, uint16_t qtype, int fd, struct timeval* now);
0d8612f2 51
3f81d239 52class LWResException : public PDNSException
0d8612f2
BH
53{
54public:
dd079764 55 LWResException(const string &reason_) : PDNSException(reason_){}
0d8612f2
BH
56};
57
58//! LWRes class
263f6a5a 59class LWResult
0d8612f2
BH
60{
61public:
9de3e034 62 LWResult() : d_usec(0) {}
0d8612f2 63
e325f20c 64 vector<DNSRecord> d_records;
34c513f9 65 int d_rcode{0};
269ac73d 66 bool d_validpacket{false};
34c513f9
RG
67 bool d_aabit{false}, d_tcbit{false};
68 uint32_t d_usec{0};
69 bool d_haveEDNS{false};
0d8612f2
BH
70};
71
10ba6d01 72int 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, const std::shared_ptr<std::vector<std::unique_ptr<RemoteLogger>>>& outgoingLoggers, const std::shared_ptr<std::vector<std::unique_ptr<FrameStreamLogger>>>& fstrmLoggers, const std::set<uint16_t>& exportTypes, LWResult* res, bool* chained);