]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Move carbon configuration into a separate header file
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 8 Nov 2021 16:44:51 +0000 (17:44 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 22 Dec 2021 08:30:43 +0000 (09:30 +0100)
pdns/dnsdist-carbon.cc
pdns/dnsdist-lua.cc
pdns/dnsdist.cc
pdns/dnsdist.hh
pdns/dnsdistdist/Makefile.am
pdns/dnsdistdist/dnsdist-carbon.hh [new file with mode: 0644]

index 4f3859aeeaa3e671a23a97987c9499ce06435cea..e411c09befba47af52a0cf62d8b9dbd9ca722849 100644 (file)
 #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<vector<CarbonConfig> > g_carbon;
index 26808d4c65dd4a0876c9f6a929ec99a80008a6dd..db5de00859fc1690c43200e90dd3e7f58137a72a 100644 (file)
@@ -32,6 +32,7 @@
 #include <thread>
 
 #include "dnsdist.hh"
+#include "dnsdist-carbon.hh"
 #include "dnsdist-console.hh"
 #include "dnsdist-dynblocks.hh"
 #include "dnsdist-ecs.hh"
index 78dce34649112ff7d115823b14126bb32b347d13..68933ea86ef7a60f0aba5b0b0919c3f76cc5d508 100644 (file)
@@ -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"
index 865f6dec26c905307ed77262beadae963bbe6e3d..028f1a6bf87c11edc56cf70e3a4625d1b749a5f6 100644 (file)
@@ -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<SuffixMatchTree<DynBlock>> g_dynblockSMT;
 extern DNSAction::Action g_dynBlockAction;
 
-extern GlobalStateHolder<vector<CarbonConfig> > g_carbon;
 extern GlobalStateHolder<ServerPolicy> g_policy;
 extern GlobalStateHolder<servers_t> g_dstates;
 extern GlobalStateHolder<pools_t> g_pools;
@@ -1087,4 +1077,3 @@ int pickBackendSocketForSending(std::shared_ptr<DownstreamState>& state);
 ssize_t udpClientSendRequestToBackend(const std::shared_ptr<DownstreamState>& 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();
index f1a614026b551d1edc4df1b091a760f1cf6b5427..fb09c81869c7c398b2ad9f72ed5f29f01fdb9572 100644 (file)
@@ -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 (file)
index 0000000..6dbb995
--- /dev/null
@@ -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<std::vector<CarbonConfig> > g_carbon;
+void carbonDumpThread();