From 58f8ed27f34f6113dda70d86e9f2c4ffc7334fdc Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Fri, 26 Jan 2024 11:46:05 +0100 Subject: [PATCH] rec: tidy ResolveContext Plus some changes to const& for ResolveContext arguments --- pdns/recursordist/lwres.cc | 8 +++---- pdns/recursordist/resolve-context.hh | 34 ++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/pdns/recursordist/lwres.cc b/pdns/recursordist/lwres.cc index 96425df3d5..13afdd9016 100644 --- a/pdns/recursordist/lwres.cc +++ b/pdns/recursordist/lwres.cc @@ -104,7 +104,7 @@ static bool isEnabledForQueries(const std::shared_ptr>>& fstreamLoggers, const struct timeval& queryTime, const ComboAddress& localip, const ComboAddress& ip, DnstapMessage::ProtocolType protocol, boost::optional auth, const vector& packet) +static void logFstreamQuery(const std::shared_ptr>>& fstreamLoggers, const struct timeval& queryTime, const ComboAddress& localip, const ComboAddress& ip, DnstapMessage::ProtocolType protocol, const boost::optional& auth, const vector& packet) { if (fstreamLoggers == nullptr) return; @@ -134,7 +134,7 @@ static bool isEnabledForResponses(const std::shared_ptr>>& fstreamLoggers, const ComboAddress& localip, const ComboAddress& ip, DnstapMessage::ProtocolType protocol, boost::optional auth, const PacketBuffer& packet, const struct timeval& queryTime, const struct timeval& replyTime) +static void logFstreamResponse(const std::shared_ptr>>& fstreamLoggers, const ComboAddress& localip, const ComboAddress& ip, DnstapMessage::ProtocolType protocol, const boost::optional& auth, const PacketBuffer& packet, const struct timeval& queryTime, const struct timeval& replyTime) { if (fstreamLoggers == nullptr) return; @@ -154,7 +154,7 @@ static void logFstreamResponse(const std::shared_ptr>>& outgoingLoggers, boost::optional initialRequestId, const boost::uuids::uuid& uuid, const ComboAddress& ip, const DNSName& domain, int type, uint16_t qid, bool doTCP, bool tls, size_t bytes, boost::optional& srcmask) +static void logOutgoingQuery(const std::shared_ptr>>& outgoingLoggers, const boost::optional& initialRequestId, const boost::uuids::uuid& uuid, const ComboAddress& ip, const DNSName& domain, int type, uint16_t qid, bool doTCP, bool tls, size_t bytes, const boost::optional& srcmask) { if (!outgoingLoggers) { return; @@ -211,7 +211,7 @@ static void logOutgoingQuery(const std::shared_ptr>>& outgoingLoggers, boost::optional initialRequestId, const boost::uuids::uuid& uuid, const ComboAddress& ip, const DNSName& domain, int type, uint16_t qid, bool doTCP, bool tls, boost::optional& srcmask, size_t bytes, int rcode, const std::vector& records, const struct timeval& queryTime, const std::set& exportTypes) +static void logIncomingResponse(const std::shared_ptr>>& outgoingLoggers, const boost::optional& initialRequestId, const boost::uuids::uuid& uuid, const ComboAddress& ip, const DNSName& domain, int type, uint16_t qid, bool doTCP, bool tls, const boost::optional& srcmask, size_t bytes, int rcode, const std::vector& records, const struct timeval& queryTime, const std::set& exportTypes) { if (!outgoingLoggers) { return; diff --git a/pdns/recursordist/resolve-context.hh b/pdns/recursordist/resolve-context.hh index c7354c7fe1..a89dd337ae 100644 --- a/pdns/recursordist/resolve-context.hh +++ b/pdns/recursordist/resolve-context.hh @@ -1,18 +1,44 @@ +/* + * This file is part of PowerDNS or dnsdist. + * Copyright -- PowerDNS.COM B.V. and its contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * In addition, for the avoidance of any doubt, permission is granted to + * link this program with OpenSSL and to (re)distribute the binaries + * produced as the result of such linking. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + #pragma once #include "config.h" #include #include +#include + +#include "dnsname.hh" struct ResolveContext { - ResolveContext() - { - } + ResolveContext() = default; + ~ResolveContext() = default; - ResolveContext(const ResolveContext& ctx) = delete; + ResolveContext(const ResolveContext&) = delete; ResolveContext& operator=(const ResolveContext&) = delete; + ResolveContext(ResolveContext&&) = delete; + ResolveContext& operator=(ResolveContext&&) = delete; boost::optional d_initialRequestId; DNSName d_nsName; -- 2.47.2