This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 7308e2fb2f List all includes explicitly in dns headers (#10655)
7308e2fb2f is described below

commit 7308e2fb2fc58681decbb0105053570825c92f4c
Author: JosiahWI <[email protected]>
AuthorDate: Mon Oct 30 11:50:45 2023 -0500

    List all includes explicitly in dns headers (#10655)
    
    This follows the 'include what you use' principle for all the headers in
    dns. The source files remain unchanged - I did the headers first because
    they get included by other components, and I ran into missing
    declarations very quickly when I started to write unit tests.
    
    Note: inkdns has a public dependency on a private header in inknet, but
    we can't link that directly because the cyclic dependency causes linking
    problems with RegressionSM.
---
 include/iocore/dns/DNSProcessor.h      | 17 +++++++++++++++--
 include/iocore/dns/SRV.h               |  4 ++--
 include/iocore/dns/SplitDNSProcessor.h |  5 +++++
 src/iocore/dns/CMakeLists.txt          | 13 ++++++++++++-
 src/iocore/dns/P_DNSConnection.h       |  7 +++++++
 src/iocore/dns/P_DNSProcessor.h        | 27 +++++++++++++++++++++++++--
 src/iocore/dns/P_SplitDNSProcessor.h   | 14 +++++++++++++-
 7 files changed, 79 insertions(+), 8 deletions(-)

diff --git a/include/iocore/dns/DNSProcessor.h 
b/include/iocore/dns/DNSProcessor.h
index 4730fa5350..2f2df825ad 100644
--- a/include/iocore/dns/DNSProcessor.h
+++ b/include/iocore/dns/DNSProcessor.h
@@ -23,10 +23,23 @@
 
 #pragma once
 
-#include "tscore/ink_resolver.h"
-#include "iocore/eventsystem/EventSystem.h"
 #include "iocore/dns/SRV.h"
 
+#include "iocore/eventsystem/Action.h"
+#include "iocore/eventsystem/Continuation.h"
+#include "iocore/eventsystem/EThread.h"
+#include "iocore/eventsystem/Event.h"
+#include "iocore/eventsystem/Processor.h"
+
+#include "tscore/ink_config.h"
+#include "tscore/ink_inet.h"
+#include "tscore/ink_platform.h"
+#include "tscore/ink_resolver.h"
+#include "tscore/Version.h"
+
+#include <cstdint>
+#include <string_view>
+
 // Events
 #define DNS_EVENT_LOOKUP DNS_EVENT_EVENTS_START
 
diff --git a/include/iocore/dns/SRV.h b/include/iocore/dns/SRV.h
index 560223636e..fe45fcd880 100644
--- a/include/iocore/dns/SRV.h
+++ b/include/iocore/dns/SRV.h
@@ -23,10 +23,10 @@
 
 #pragma once
 
-#include <vector>
 #include "tscore/ink_platform.h"
 
-struct HostDBInfo;
+#include <cstdlib>
+#include <vector>
 
 #define RAND_INV_RANGE(r) ((int)((RAND_MAX + 1) / (r)))
 
diff --git a/include/iocore/dns/SplitDNSProcessor.h 
b/include/iocore/dns/SplitDNSProcessor.h
index e1e011c4ac..6eefde2d49 100644
--- a/include/iocore/dns/SplitDNSProcessor.h
+++ b/include/iocore/dns/SplitDNSProcessor.h
@@ -30,6 +30,11 @@
 
 #pragma once
 
+#include "iocore/eventsystem/ConfigProcessor.h"
+#include "iocore/eventsystem/Lock.h"
+
+#include "tscore/Ptr.h"
+
 struct SplitDNS;
 
 /* --------------------------------------------------------------
diff --git a/src/iocore/dns/CMakeLists.txt b/src/iocore/dns/CMakeLists.txt
index 5f51b23a48..cfd83b69f0 100644
--- a/src/iocore/dns/CMakeLists.txt
+++ b/src/iocore/dns/CMakeLists.txt
@@ -18,4 +18,15 @@
 add_library(inkdns STATIC DNS.cc DNSConnection.cc DNSEventIO.cc Inline.cc 
SplitDNS.cc)
 add_library(ts::inkdns ALIAS inkdns)
 
-target_link_libraries(inkdns PUBLIC ts::inkevent ts::inkhostdb ts::proxy 
ts::tscore)
+target_include_directories(
+  inkdns
+  PUBLIC "${PROJECT_SOURCE_DIR}/include"
+  PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}"
+)
+
+target_link_libraries(
+  inkdns
+  PUBLIC libswoc ts::inkevent ts::inkhostdb
+         #ts::inknet cyclic dependency
+         ts::proxy ts::tsapicore ts::tscore
+)
diff --git a/src/iocore/dns/P_DNSConnection.h b/src/iocore/dns/P_DNSConnection.h
index 800711883b..d5d18a3297 100644
--- a/src/iocore/dns/P_DNSConnection.h
+++ b/src/iocore/dns/P_DNSConnection.h
@@ -33,6 +33,13 @@
 #include "iocore/dns/DNSEventIO.h"
 #include "iocore/dns/DNSProcessor.h"
 
+#include "tscore/ink_platform.h"
+#include "tscore/ink_rand.h"
+#include "tscore/List.h"
+#include "tscore/Ptr.h"
+
+#include <swoc/IPEndpoint.h>
+
 //
 // Connection
 //
diff --git a/src/iocore/dns/P_DNSProcessor.h b/src/iocore/dns/P_DNSProcessor.h
index 0427f83f04..f3536ea254 100644
--- a/src/iocore/dns/P_DNSProcessor.h
+++ b/src/iocore/dns/P_DNSProcessor.h
@@ -23,10 +23,33 @@
 
 #pragma once
 
-#include "iocore/eventsystem/EventSystem.h"
-#include "tscore/PendingAction.h"
+#include "iocore/dns/DNSProcessor.h"
+#include "P_DNSConnection.h"
+
+#include "iocore/eventsystem/Action.h"
+#include "iocore/eventsystem/Continuation.h"
+#include "iocore/eventsystem/EThread.h"
+#include "iocore/eventsystem/Event.h"
+
 #include "api/Metrics.h"
 
+#include "tscore/ink_apidefs.h"
+#include "tscore/ink_hrtime.h"
+#include "tscore/ink_inet.h"
+#include "tscore/ink_platform.h"
+#include "tscore/ink_rand.h"
+#include "tscore/ink_resolver.h"
+#include "tscore/List.h"
+#include "tscore/PendingAction.h"
+#include "tscore/Ptr.h"
+
+#include "ts/DbgCtl.h"
+
+#include <swoc/IPEndpoint.h>
+
+#include <cstdint>
+#include <cstring>
+
 using ts::Metrics;
 
 #define MAX_NAMED                       32
diff --git a/src/iocore/dns/P_SplitDNSProcessor.h 
b/src/iocore/dns/P_SplitDNSProcessor.h
index 5a3888a900..66205a8998 100644
--- a/src/iocore/dns/P_SplitDNSProcessor.h
+++ b/src/iocore/dns/P_SplitDNSProcessor.h
@@ -30,10 +30,22 @@
 
 #pragma once
 
-#include "iocore/eventsystem/ConfigProcessor.h"
+#include "iocore/dns/SplitDNSProcessor.h"
+#include "P_DNSProcessor.h"
 
+#include "proxy/ControlBase.h"
 #include "proxy/ControlMatcher.h"
+
+#include "iocore/eventsystem/ConfigProcessor.h"
+
 #include "tscore/HostLookup.h"
+#include "tscore/ink_apidefs.h"
+#include "tscore/ink_assert.h"
+#include "tscore/ink_platform.h"
+
+#include <swoc/TextView.h>
+
+#include <cstdint>
 
 /* ---------------------------
    forward declarations ...

Reply via email to