From: Remi Gacogne Date: Mon, 8 Nov 2021 16:44:51 +0000 (+0100) Subject: dnsdist: Move carbon configuration into a separate header file X-Git-Tag: auth-4.7.0-alpha1~103^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b96a91816b5f8c203c5b83945cc779be6285d63;p=thirdparty%2Fpdns.git dnsdist: Move carbon configuration into a separate header file --- diff --git a/pdns/dnsdist-carbon.cc b/pdns/dnsdist-carbon.cc index 4f3859aeea..e411c09bef 100644 --- a/pdns/dnsdist-carbon.cc +++ b/pdns/dnsdist-carbon.cc @@ -22,12 +22,12 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "iputils.hh" -#include "dolog.hh" -#include "sstuff.hh" -#include "namespaces.hh" +#include "dnsdist-carbon.hh" #include "dnsdist.hh" +#include "dnsdist-carbon.hh" +#include "dolog.hh" +#include "sstuff.hh" #include "threadname.hh" GlobalStateHolder > g_carbon; diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 26808d4c65..db5de00859 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -32,6 +32,7 @@ #include #include "dnsdist.hh" +#include "dnsdist-carbon.hh" #include "dnsdist-console.hh" #include "dnsdist-dynblocks.hh" #include "dnsdist-ecs.hh" diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index 78dce34649..68933ea86e 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -46,6 +46,7 @@ #include "dnsdist.hh" #include "dnsdist-cache.hh" +#include "dnsdist-carbon.hh" #include "dnsdist-console.hh" #include "dnsdist-dynblocks.hh" #include "dnsdist-ecs.hh" diff --git a/pdns/dnsdist.hh b/pdns/dnsdist.hh index 865f6dec26..028f1a6bf8 100644 --- a/pdns/dnsdist.hh +++ b/pdns/dnsdist.hh @@ -947,15 +947,6 @@ private: bool d_useECS{false}; }; -struct CarbonConfig -{ - ComboAddress server; - std::string namespace_name; - std::string ourname; - std::string instance_name; - unsigned int interval; -}; - enum ednsHeaderFlags { EDNS_HEADER_FLAG_NONE = 0, EDNS_HEADER_FLAG_DO = 32768 @@ -982,7 +973,6 @@ struct DNSDistResponseRuleAction extern GlobalStateHolder> g_dynblockSMT; extern DNSAction::Action g_dynBlockAction; -extern GlobalStateHolder > g_carbon; extern GlobalStateHolder g_policy; extern GlobalStateHolder g_dstates; extern GlobalStateHolder g_pools; @@ -1087,4 +1077,3 @@ int pickBackendSocketForSending(std::shared_ptr& state); ssize_t udpClientSendRequestToBackend(const std::shared_ptr& ss, const int sd, const PacketBuffer& request, bool healthCheck = false); void handleResponseSent(const IDState& ids, double udiff, const ComboAddress& client, const ComboAddress& backend, unsigned int size, const dnsheader& cleartextDH, dnsdist::Protocol protocol); -void carbonDumpThread(); diff --git a/pdns/dnsdistdist/Makefile.am b/pdns/dnsdistdist/Makefile.am index f1a614026b..fb09c81869 100644 --- a/pdns/dnsdistdist/Makefile.am +++ b/pdns/dnsdistdist/Makefile.am @@ -135,7 +135,7 @@ dnsdist_SOURCES = \ dnscrypt.cc dnscrypt.hh \ dnsdist-backend.cc \ dnsdist-cache.cc dnsdist-cache.hh \ - dnsdist-carbon.cc \ + dnsdist-carbon.cc dnsdist-carbon.hh \ dnsdist-console.cc dnsdist-console.hh \ dnsdist-dnscrypt.cc \ dnsdist-dynblocks.cc dnsdist-dynblocks.hh \ diff --git a/pdns/dnsdistdist/dnsdist-carbon.hh b/pdns/dnsdistdist/dnsdist-carbon.hh new file mode 100644 index 0000000000..6dbb995419 --- /dev/null +++ b/pdns/dnsdistdist/dnsdist-carbon.hh @@ -0,0 +1,37 @@ +/* + * 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 "sholder.hh" +#include "iputils.hh" + +struct CarbonConfig +{ + ComboAddress server; + std::string namespace_name; + std::string ourname; + std::string instance_name; + unsigned int interval; +}; + +extern GlobalStateHolder > g_carbon; +void carbonDumpThread();