From ea3c679101cdf72dfaa04548ad0dc36f01d27055 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Fri, 22 May 2020 14:39:23 -0700 Subject: [PATCH 1/3] Remove the inclusion of Func.h from NetVar.h, which reduces the inclusion of Func.h overall. --- aux/bifcl | 2 +- src/NetVar.h | 1 - src/Stats.cc | 1 + src/analyzer/protocol/tcp/TCP_Endpoint.cc | 2 ++ src/broker/Data.cc | 17 +++++++++-------- src/broker/Manager.cc | 1 + src/input/Manager.cc | 1 + src/logging/Manager.cc | 1 + src/util.cc | 10 ++++++---- src/zeek-setup.cc | 1 + 10 files changed, 23 insertions(+), 14 deletions(-) diff --git a/aux/bifcl b/aux/bifcl index 02a43adc1c..01f12f4fad 160000 --- a/aux/bifcl +++ b/aux/bifcl @@ -1 +1 @@ -Subproject commit 02a43adc1cafe5b42f01d3021c5327114fad6e05 +Subproject commit 01f12f4fadb9c40d9b47aeafb653438971328277 diff --git a/src/NetVar.h b/src/NetVar.h index a9d286d0f0..ac616d03a9 100644 --- a/src/NetVar.h +++ b/src/NetVar.h @@ -3,7 +3,6 @@ #pragma once #include "Val.h" -#include "Func.h" #include "EventRegistry.h" #include "Stats.h" diff --git a/src/Stats.cc b/src/Stats.cc index 24e550a3d2..39f645bf13 100644 --- a/src/Stats.cc +++ b/src/Stats.cc @@ -13,6 +13,7 @@ #include "threading/Manager.h" #include "broker/Manager.h" #include "input.h" +#include "Func.h" uint64_t killed_by_inactivity = 0; diff --git a/src/analyzer/protocol/tcp/TCP_Endpoint.cc b/src/analyzer/protocol/tcp/TCP_Endpoint.cc index 272bc0b563..04749932b4 100644 --- a/src/analyzer/protocol/tcp/TCP_Endpoint.cc +++ b/src/analyzer/protocol/tcp/TCP_Endpoint.cc @@ -1,5 +1,7 @@ // See the file "COPYING" in the main distribution directory for copyright. +#include + #include "Net.h" #include "NetVar.h" #include "analyzer/protocol/tcp/TCP.h" diff --git a/src/broker/Data.cc b/src/broker/Data.cc index 0c3a04aee3..eeb5167f5f 100644 --- a/src/broker/Data.cc +++ b/src/broker/Data.cc @@ -1,3 +1,11 @@ +#include +#include +#include + +#include +#include "broker/data.bif.h" +#include "3rdparty/doctest.h" + #include "Data.h" #include "File.h" #include "Desc.h" @@ -5,15 +13,8 @@ #include "RE.h" #include "ID.h" #include "Scope.h" +#include "Func.h" #include "module_util.h" -#include "3rdparty/doctest.h" -#include "broker/data.bif.h" - -#include - -#include -#include -#include using namespace std; diff --git a/src/broker/Manager.cc b/src/broker/Manager.cc index 469cc997f0..3c6bce5f00 100644 --- a/src/broker/Manager.cc +++ b/src/broker/Manager.cc @@ -6,6 +6,7 @@ #include #include +#include "Func.h" #include "Data.h" #include "Store.h" #include "util.h" diff --git a/src/input/Manager.cc b/src/input/Manager.cc index 4914fc6fe4..13183eb731 100644 --- a/src/input/Manager.cc +++ b/src/input/Manager.cc @@ -17,6 +17,7 @@ #include "NetVar.h" #include "Net.h" #include "CompHash.h" +#include "Func.h" #include "../file_analysis/Manager.h" #include "../threading/SerialTypes.h" diff --git a/src/logging/Manager.cc b/src/logging/Manager.cc index 8ab3ba9f51..5b89a7f7cf 100644 --- a/src/logging/Manager.cc +++ b/src/logging/Manager.cc @@ -12,6 +12,7 @@ #include "File.h" #include "input.h" #include "IntrusivePtr.h" +#include "Func.h" #include "broker/Manager.h" #include "threading/Manager.h" diff --git a/src/util.cc b/src/util.cc index ce86990645..f4c014f03e 100644 --- a/src/util.cc +++ b/src/util.cc @@ -20,10 +20,6 @@ #include #endif -#include -#include -#include -#include #include #include #include @@ -43,6 +39,12 @@ # include #endif +#include +#include +#include +#include +#include + #include "Desc.h" #include "Dict.h" #include "digest.h" diff --git a/src/zeek-setup.cc b/src/zeek-setup.cc index fdbfbe7ec7..3145a40bef 100644 --- a/src/zeek-setup.cc +++ b/src/zeek-setup.cc @@ -45,6 +45,7 @@ extern "C" { #include "Traverse.h" #include "Trigger.h" #include "Hash.h" +#include "Func.h" #include "supervisor/Supervisor.h" #include "threading/Manager.h" From c558d771e4a8eaefe9e42994ef661dcd48ddd082 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Fri, 22 May 2020 16:44:08 -0700 Subject: [PATCH 2/3] Remove IPAddr.h from Reporter.h --- src/Anon.cc | 2 +- src/CompHash.cc | 7 ++++--- src/Desc.cc | 1 + src/IPAddr.h | 1 + src/Reporter.h | 5 ++++- src/RuleMatcher.cc | 1 + src/SerializationFormat.cc | 2 +- src/analyzer/protocol/mime/MIME.h | 1 + src/broker/Data.h | 5 +++++ src/broker/Manager.h | 1 + src/threading/Manager.cc | 1 + src/threading/MsgThread.h | 4 ++++ src/threading/SerialTypes.cc | 1 + src/zeekygen/ScriptInfo.cc | 1 + 14 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/Anon.cc b/src/Anon.cc index e6b0ee3b80..ee1d296732 100644 --- a/src/Anon.cc +++ b/src/Anon.cc @@ -12,7 +12,7 @@ #include "Reporter.h" #include "Scope.h" #include "ID.h" - +#include "IPAddr.h" AnonymizeIPAddr* ip_anonymizer[NUM_ADDR_ANONYMIZATION_METHODS] = {nullptr}; diff --git a/src/CompHash.cc b/src/CompHash.cc index 7bdc3eba6a..34acd57cba 100644 --- a/src/CompHash.cc +++ b/src/CompHash.cc @@ -2,6 +2,9 @@ #include "zeek-config.h" +#include +#include + #include "CompHash.h" #include "BroString.h" #include "Dict.h" @@ -9,9 +12,7 @@ #include "RE.h" #include "Reporter.h" #include "Func.h" - -#include -#include +#include "IPAddr.h" CompositeHash::CompositeHash(IntrusivePtr composite_type) : type(std::move(composite_type)) diff --git a/src/Desc.cc b/src/Desc.cc index 57edf40d39..978ddff24c 100644 --- a/src/Desc.cc +++ b/src/Desc.cc @@ -11,6 +11,7 @@ #include "File.h" #include "Reporter.h" #include "ConvertUTF.h" +#include "IPAddr.h" #define DEFAULT_SIZE 128 #define SLOP 10 diff --git a/src/IPAddr.h b/src/IPAddr.h index a945c8b53f..ff2a188409 100644 --- a/src/IPAddr.h +++ b/src/IPAddr.h @@ -9,6 +9,7 @@ #include #include "threading/SerialTypes.h" +#include "IPAddr.h" struct ConnID; class BroString; diff --git a/src/Reporter.h b/src/Reporter.h index 9224b3e8b6..337b3664ea 100644 --- a/src/Reporter.h +++ b/src/Reporter.h @@ -11,7 +11,7 @@ #include #include -#include "IPAddr.h" +#include "BroList.h" namespace analyzer { class Analyzer; } namespace file_analysis { class File; } @@ -35,6 +35,9 @@ protected: InterpreterException() {} }; +class IPAddr; +class Expr; + #define FMT_ATTR __attribute__((format(printf, 2, 3))) // sic! 1st is "this" I guess. class Reporter { diff --git a/src/RuleMatcher.cc b/src/RuleMatcher.cc index 2e79ed185f..8b0b279e95 100644 --- a/src/RuleMatcher.cc +++ b/src/RuleMatcher.cc @@ -21,6 +21,7 @@ #include "Reporter.h" #include "module_util.h" #include "Var.h" +#include "IPAddr.h" using namespace std; diff --git a/src/SerializationFormat.cc b/src/SerializationFormat.cc index 2074cd4756..ff0ff36155 100644 --- a/src/SerializationFormat.cc +++ b/src/SerializationFormat.cc @@ -5,6 +5,7 @@ #include "DebugLogger.h" #include "Reporter.h" #include "net_util.h" +#include "IPAddr.h" const float SerializationFormat::GROWTH_FACTOR = 2.5; @@ -435,4 +436,3 @@ bool BinarySerializationFormat::Write(const char* buf, int len, const char* tag) uint32_t l = htonl(len); return WriteData(&l, sizeof(l)) && WriteData(buf, len); } - diff --git a/src/analyzer/protocol/mime/MIME.h b/src/analyzer/protocol/mime/MIME.h index 50fdb8366b..bfea4ef6a2 100644 --- a/src/analyzer/protocol/mime/MIME.h +++ b/src/analyzer/protocol/mime/MIME.h @@ -10,6 +10,7 @@ #include "Reporter.h" #include "analyzer/Analyzer.h" +class TableVal; class StringVal; class Base64Converter; diff --git a/src/broker/Data.h b/src/broker/Data.h index d6578ceb99..906e5376ed 100644 --- a/src/broker/Data.h +++ b/src/broker/Data.h @@ -10,6 +10,11 @@ class IntrusivePtr; class ODesc; +namespace threading { +struct Value; +struct Field; +} + namespace bro_broker { extern IntrusivePtr opaque_of_data_type; diff --git a/src/broker/Manager.h b/src/broker/Manager.h index a57b86057c..255b62bfa7 100644 --- a/src/broker/Manager.h +++ b/src/broker/Manager.h @@ -23,6 +23,7 @@ class Frame; class Func; +class VectorType; namespace bro_broker { diff --git a/src/threading/Manager.cc b/src/threading/Manager.cc index b4025bc68d..58d6c30dea 100644 --- a/src/threading/Manager.cc +++ b/src/threading/Manager.cc @@ -6,6 +6,7 @@ #include "NetVar.h" #include "iosource/Manager.h" #include "Event.h" +#include "IPAddr.h" using namespace threading; diff --git a/src/threading/MsgThread.h b/src/threading/MsgThread.h index 8bda2d40b8..42ce20984f 100644 --- a/src/threading/MsgThread.h +++ b/src/threading/MsgThread.h @@ -8,11 +8,15 @@ #include "iosource/IOSource.h" #include "Flare.h" +class BroObj; + namespace threading { class BasicInputMessage; class BasicOutputMessage; class HeartbeatMessage; +struct Value; +struct Field; /** * A specialized thread that provides bi-directional message passing between diff --git a/src/threading/SerialTypes.cc b/src/threading/SerialTypes.cc index dbea04ef3a..6f3825ae2a 100644 --- a/src/threading/SerialTypes.cc +++ b/src/threading/SerialTypes.cc @@ -12,6 +12,7 @@ #include "ID.h" #include "Expr.h" #include "Scope.h" +#include "IPAddr.h" using namespace threading; diff --git a/src/zeekygen/ScriptInfo.cc b/src/zeekygen/ScriptInfo.cc index 827bac5979..ddd0d8009c 100644 --- a/src/zeekygen/ScriptInfo.cc +++ b/src/zeekygen/ScriptInfo.cc @@ -10,6 +10,7 @@ #include "Reporter.h" #include "Desc.h" +#include "Type.h" using namespace std; using namespace zeekygen; From b75d2a31cf0846aabd303df923545f2b67369ec2 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 26 May 2020 10:17:35 -0700 Subject: [PATCH 3/3] Remove Analyzer.h from bro-bif.h --- src/bro-bif.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/bro-bif.h b/src/bro-bif.h index 30a694b7ef..b72d676312 100644 --- a/src/bro-bif.h +++ b/src/bro-bif.h @@ -1,8 +1,6 @@ - #pragma once // Headers to include by generated BiF code. -#include "analyzer/Analyzer.h" #include "Conn.h" #include "NetVar.h" #include "Event.h"