From 4ad08172d02ca59f41520ff62bd0891d577f4ede Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Mon, 1 Feb 2021 17:04:58 -0700 Subject: [PATCH] Remove obsolete ZEEK_FORWARD_DECLARE_NAMESPACED macros --- auxil/binpac | 2 +- src/Attr.h | 3 +- src/Base64.h | 11 +++--- src/BifReturnVal.h | 11 +++--- src/CompHash.h | 10 +++--- src/Conn.h | 36 ++++++++++++------- src/DNS_Mgr.h | 18 +++++----- src/DbgBreakpoint.h | 6 ++-- src/DbgDisplay.h | 4 +-- src/DbgWatch.h | 3 +- src/Debug.h | 15 ++++---- src/DebugLogger.h | 4 +-- src/Desc.h | 5 ++- src/Dict.h | 9 ++--- src/Discard.h | 8 ++--- src/EquivClass.h | 4 +-- src/Event.h | 4 +-- src/EventHandler.h | 4 +-- src/EventRegistry.h | 8 ++--- src/Expr.h | 5 ++- src/File.h | 13 ++++--- src/Frag.h | 16 +++++---- src/Frame.h | 9 +++-- src/Func.h | 16 ++++----- src/Hash.h | 9 +++-- src/ID.h | 15 ++++---- src/IP.h | 11 +++--- src/IPAddr.h | 5 ++- src/NFA.h | 16 +++++---- src/Obj.h | 5 +-- src/OpaqueVal.h | 6 ++-- src/PacketFilter.h | 11 +++--- src/PrefixTable.h | 12 ++++--- src/PriorityQueue.h | 4 +-- src/RE.h | 14 ++++---- src/RandTest.h | 9 +++-- src/Reporter.h | 29 +++++++++------ src/Rule.h | 12 +++---- src/RuleAction.h | 6 ++-- src/RuleCondition.h | 8 ++--- src/RuleMatcher.h | 29 ++++++++------- src/RunState.h | 20 +++++++---- src/Scope.h | 8 ++--- src/ScriptCoverageManager.h | 3 +- src/SerializationFormat.h | 11 +++--- src/Sessions.h | 10 +++--- src/Stats.h | 15 ++++---- src/Stmt.h | 5 ++- src/StmtBase.h | 17 ++++----- src/Tag.h | 5 ++- src/Timer.h | 2 +- src/Traverse.h | 18 ++++++---- src/TraverseTypes.h | 4 +-- src/Trigger.h | 23 +++++++----- src/TunnelEncapsulation.h | 4 +-- src/Type.h | 17 ++++----- src/Val.h | 28 +++++++-------- src/Var.h | 23 ++++++------ src/ZeekList.h | 17 +++++---- src/ZeekString.h | 6 ++-- src/analyzer/Analyzer.h | 19 +++++----- src/analyzer/Component.h | 12 ++++--- src/analyzer/Tag.h | 23 +++++++----- .../protocol/bittorrent/BitTorrentTracker.h | 9 +++-- src/analyzer/protocol/ftp/FTP.h | 2 +- src/analyzer/protocol/icmp/ICMP.h | 11 +++--- src/analyzer/protocol/login/NVT.h | 4 +-- src/analyzer/protocol/login/RSH.h | 4 +-- src/analyzer/protocol/login/Rlogin.h | 4 +-- src/analyzer/protocol/mime/MIME.h | 15 ++++---- src/analyzer/protocol/pia/PIA.h | 2 +- .../protocol/stepping-stone/SteppingStone.h | 9 +++-- src/analyzer/protocol/tcp/TCP.h | 9 ++--- src/analyzer/protocol/tcp/TCP_Endpoint.h | 16 +++++---- src/analyzer/protocol/tcp/TCP_Reassembler.h | 18 +++++++--- src/broker/Data.h | 20 +++++++---- src/broker/Manager.h | 11 +++--- src/file_analysis/Analyzer.h | 12 +++---- src/file_analysis/AnalyzerSet.h | 19 ++++++---- src/file_analysis/Component.h | 15 ++++---- src/file_analysis/File.h | 17 ++++----- src/file_analysis/FileReassembler.cc | 4 +-- src/file_analysis/FileReassembler.h | 13 ++++--- src/file_analysis/Manager.h | 21 +++++++---- src/file_analysis/Tag.h | 13 ++++--- src/file_analysis/analyzer/x509/OCSP.h | 9 +++-- src/file_analysis/analyzer/x509/X509Common.h | 22 +++++++----- src/input.h | 4 +-- src/input/Component.h | 6 ++-- src/input/Manager.h | 10 +++--- src/input/ReaderBackend.h | 4 +-- src/input/ReaderFrontend.h | 12 ++++--- src/input/Tag.h | 23 +++++++----- src/iosource/Component.h | 8 ++--- src/iosource/Manager.h | 6 ++-- src/iosource/Packet.h | 8 ++--- src/iosource/PktDumper.h | 9 +++-- src/iosource/PktSrc.h | 3 +- src/logging/Component.h | 6 ++-- src/logging/Manager.h | 9 ++--- src/logging/Tag.h | 23 +++++++----- src/logging/WriterBackend.h | 4 +-- src/logging/WriterFrontend.h | 4 +-- src/net_util.h | 6 ++-- src/packet_analysis/Manager.h | 5 +-- src/packet_analysis/protocol/ip/IP.h | 2 +- src/plugin/Component.h | 9 +++-- src/plugin/Plugin.h | 25 ++++++------- src/probabilistic/BloomFilter.h | 3 +- src/probabilistic/CounterVector.h | 4 +-- src/probabilistic/Topk.h | 2 +- src/threading/BasicThread.h | 4 +-- src/threading/Formatter.h | 4 +-- src/threading/SerialTypes.h | 2 +- src/util.h | 13 ++++--- src/zeekygen/IdentifierInfo.h | 9 +++-- src/zeekygen/Manager.h | 18 ++++++---- src/zeekygen/ScriptInfo.h | 4 +-- src/zeekygen/Target.h | 10 +++--- src/zeekygen/utils.h | 2 +- zeek-config.h.in | 14 -------- 121 files changed, 722 insertions(+), 547 deletions(-) diff --git a/auxil/binpac b/auxil/binpac index 4aba04a27c..410400cab1 160000 --- a/auxil/binpac +++ b/auxil/binpac @@ -1 +1 @@ -Subproject commit 4aba04a27cbf1e4c5ee7c659e9abb8b735ca1f4b +Subproject commit 410400cab13431814d5d9f88d643318845c84bcf diff --git a/src/Attr.h b/src/Attr.h index bd6d349387..5f1f2ab59f 100644 --- a/src/Attr.h +++ b/src/Attr.h @@ -9,8 +9,6 @@ #include "zeek/ZeekList.h" #include "zeek/IntrusivePtr.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail); - // Note that there are two kinds of attributes: the kind (here) which // modify expressions or supply metadata on types, and the kind that // are extra metadata on every variable instance. @@ -22,6 +20,7 @@ using TypePtr = IntrusivePtr; namespace detail { +class Expr; using ExprPtr = IntrusivePtr; enum AttrTag { diff --git a/src/Base64.h b/src/Base64.h index 270b3d7802..3e9bb79bed 100644 --- a/src/Base64.h +++ b/src/Base64.h @@ -3,10 +3,12 @@ #include "zeek/zeek-config.h" #include -namespace zeek { class String; } -ZEEK_FORWARD_DECLARE_NAMESPACED(Connection, zeek); +namespace zeek { -namespace zeek::detail { +class String; +class Connection; + +namespace detail { // Maybe we should have a base class for generic decoders? class Base64Converter { @@ -63,4 +65,5 @@ protected: String* decode_base64(const String* s, const String* a = nullptr, Connection* conn = nullptr); String* encode_base64(const String* s, const String* a = nullptr, Connection* conn = nullptr); -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/BifReturnVal.h b/src/BifReturnVal.h index 63ff0e957b..53f9ba9e20 100644 --- a/src/BifReturnVal.h +++ b/src/BifReturnVal.h @@ -5,12 +5,12 @@ #include "zeek/zeek-config.h" #include "zeek/IntrusivePtr.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); namespace zeek { -using ValPtr = IntrusivePtr; -} -namespace zeek::detail { +class Val; +using ValPtr = IntrusivePtr; + +namespace detail { /** * A simple wrapper class to use for the return value of BIFs so that @@ -30,4 +30,5 @@ public: ValPtr rval; }; -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/CompHash.h b/src/CompHash.h index 455a2edb7b..eeec3ac391 100644 --- a/src/CompHash.h +++ b/src/CompHash.h @@ -7,15 +7,17 @@ #include "zeek/Type.h" #include "zeek/IntrusivePtr.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(ListVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(HashKey, zeek::detail); - namespace zeek { + +class ListVal; using ListValPtr = zeek::IntrusivePtr; -} + +} // namespace zeek namespace zeek::detail { +class HashKey; + class CompositeHash { public: explicit CompositeHash(TypeListPtr composite_type); diff --git a/src/Conn.h b/src/Conn.h index f09c49ed3c..4f56563962 100644 --- a/src/Conn.h +++ b/src/Conn.h @@ -21,23 +21,33 @@ #include "zeek/analyzer/Tag.h" #include "zeek/analyzer/Analyzer.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Connection, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(ConnectionTimer, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(NetSessions, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(EncapsulationStack, zeek); - -ZEEK_FORWARD_DECLARE_NAMESPACED(Specific_RE_Matcher, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(RuleEndpointState, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(RuleHdrTest, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(TransportLayerAnalyzer, zeek, analyzer); -ZEEK_FORWARD_DECLARE_NAMESPACED(Analyzer, zeek, analyzer); - namespace zeek { + +class Connection; +class NetSessions; +class EncapsulationStack; +class Val; +class RecordVal; + using ValPtr = IntrusivePtr; using RecordValPtr = IntrusivePtr; +namespace detail { + +class ConnectionTimer; +class Specific_RE_Matcher; +class RuleEndpointState; +class RuleHdrTest; + +} // namespace detail + +namespace analyzer { + +class TransportLayerAnalyzer; +class Analyzer; + +} // namespace analyzer + enum ConnEventToFlag { NUL_IN_LINE, SINGULAR_CR, diff --git a/src/DNS_Mgr.h b/src/DNS_Mgr.h index 6903fc57f6..1551088b40 100644 --- a/src/DNS_Mgr.h +++ b/src/DNS_Mgr.h @@ -13,19 +13,20 @@ #include "zeek/IPAddr.h" #include "zeek/util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandler, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(DNS_Mgr_Request, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordType, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(ListVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(TableVal, zeek); - namespace zeek { + +class EventHandler; +class RecordType; +class Val; +class ListVal; +class TableVal; + template class IntrusivePtr; using ValPtr = IntrusivePtr; using ListValPtr = IntrusivePtr; using TableValPtr = IntrusivePtr; -} + +} // namespace zeek // Defined in nb_dns.h struct nb_dns_info; @@ -33,6 +34,7 @@ struct nb_dns_result; namespace zeek::detail { +class DNS_Mgr_Request; using DNS_mgr_request_list = PList; class DNS_Mapping; diff --git a/src/DbgBreakpoint.h b/src/DbgBreakpoint.h index 0fec02dba3..8168a0c7d0 100644 --- a/src/DbgBreakpoint.h +++ b/src/DbgBreakpoint.h @@ -5,11 +5,11 @@ #include #include "zeek/util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(ParseLocationRec, zeek::detail); - namespace zeek::detail { +class Stmt; +class ParseLocationRec; + enum BreakCode { BC_NO_HIT, BC_HIT, BC_HIT_AND_DELETE }; class DbgBreakpoint { enum Kind { BP_STMT = 0, BP_FUNC, BP_LINE, BP_TIME }; diff --git a/src/DbgDisplay.h b/src/DbgDisplay.h index 988d15adef..d511ef5fd9 100644 --- a/src/DbgDisplay.h +++ b/src/DbgDisplay.h @@ -2,10 +2,10 @@ #pragma once -ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail); - namespace zeek::detail { +class Expr; + // Automatic displays: display these at each stoppage. class DbgDisplay { public: diff --git a/src/DbgWatch.h b/src/DbgWatch.h index a26f1b8500..6082465b6d 100644 --- a/src/DbgWatch.h +++ b/src/DbgWatch.h @@ -4,11 +4,12 @@ #include "zeek/util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail); namespace zeek { class Obj; } namespace zeek::detail { +class Expr; + class DbgWatch { public: explicit DbgWatch(Obj* var_to_watch); diff --git a/src/Debug.h b/src/Debug.h index 9fe60047b6..8b3f902b77 100644 --- a/src/Debug.h +++ b/src/Debug.h @@ -11,14 +11,9 @@ #include "zeek/StmtEnums.h" #include "zeek/util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(DbgBreakpoint, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(DbgWatch, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(DbgDisplay, zeek::detail); - namespace zeek { + +class Val; template class IntrusivePtr; using ValPtr = zeek::IntrusivePtr; @@ -26,6 +21,12 @@ extern std::string current_module; namespace detail { +class Frame; +class Stmt; +class DbgBreakpoint; +class DbgWatch; +class DbgDisplay; + // This needs to be defined before we do the includes that come after it. enum ParseLocationRecType { PLR_UNKNOWN, PLR_FILE_AND_LINE, PLR_FUNCTION }; class ParseLocationRec { diff --git a/src/DebugLogger.h b/src/DebugLogger.h index 6aaac3daef..e819f17d74 100644 --- a/src/DebugLogger.h +++ b/src/DebugLogger.h @@ -22,10 +22,10 @@ #define PLUGIN_DBG_LOG(plugin, args...) ::zeek::detail::debug_logger.Log(plugin, args) -ZEEK_FORWARD_DECLARE_NAMESPACED(Plugin, zeek, plugin); - namespace zeek { +namespace plugin { class Plugin; } + // To add a new debugging stream, add a constant here as well as // an entry to DebugLogger::streams in DebugLogger.cc. diff --git a/src/Desc.h b/src/Desc.h index 524a310eeb..a290e5b68d 100644 --- a/src/Desc.h +++ b/src/Desc.h @@ -11,11 +11,10 @@ #include "zeek/ZeekString.h" // for byte_vec #include "zeek/util.h" // for bro_int_t -ZEEK_FORWARD_DECLARE_NAMESPACED(IPAddr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(IPPrefix, zeek); - namespace zeek { +class IPAddr; +class IPPrefix; class File; class Type; diff --git a/src/Dict.h b/src/Dict.h index edbcde7a8b..25ed3aec31 100644 --- a/src/Dict.h +++ b/src/Dict.h @@ -8,15 +8,14 @@ #include "zeek/Hash.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(IterCookie, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Dictionary, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(DictEntry, zeek::detail); - // Type for function to be called when deleting elements. typedef void (*dict_delete_func)(void*); namespace zeek { +class IterCookie; +class Dictionary; + enum DictOrder { ORDERED, UNORDERED }; // A dict_delete_func that just calls delete. @@ -24,6 +23,8 @@ extern void generic_delete_func(void*); namespace detail { +class DictEntry; + // Default number of hash buckets in dictionary. The dictionary will increase the size // of the hash table as needed. constexpr uint32_t HASH_MASK = 0xFFFFFFFF; //only lower 32 bits. diff --git a/src/Discard.h b/src/Discard.h index 309ff96c13..715ca4d099 100644 --- a/src/Discard.h +++ b/src/Discard.h @@ -7,11 +7,11 @@ #include "zeek/IntrusivePtr.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(IP_Hdr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); - namespace zeek { + +class IP_Hdr; +class Val; +class Func; using FuncPtr = IntrusivePtr; namespace detail { diff --git a/src/EquivClass.h b/src/EquivClass.h index d83469e363..afeea51399 100644 --- a/src/EquivClass.h +++ b/src/EquivClass.h @@ -4,10 +4,10 @@ #include -ZEEK_FORWARD_DECLARE_NAMESPACED(CCL, zeek::detail); - namespace zeek::detail { +class CCL; + class EquivClass { public: explicit EquivClass(int size); diff --git a/src/Event.h b/src/Event.h index 3f953efd29..77794b1919 100644 --- a/src/Event.h +++ b/src/Event.h @@ -12,10 +12,10 @@ #include "zeek/ZeekArgs.h" #include "zeek/IntrusivePtr.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(EventMgr, zeek); - namespace zeek { +class EventMgr; + class Event final : public Obj { public: Event(EventHandlerPtr handler, zeek::Args args, diff --git a/src/EventHandler.h b/src/EventHandler.h index f27edf2e80..c07801b649 100644 --- a/src/EventHandler.h +++ b/src/EventHandler.h @@ -9,9 +9,9 @@ #include "zeek/ZeekArgs.h" #include "zeek/Type.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek); - namespace zeek { + +class Func; using FuncPtr = IntrusivePtr; class EventHandler { diff --git a/src/EventRegistry.h b/src/EventRegistry.h index 70a0fedc2a..eb1533df3f 100644 --- a/src/EventRegistry.h +++ b/src/EventRegistry.h @@ -10,12 +10,12 @@ #include #include -ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandler, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandlerPtr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(RE_Matcher, zeek); - namespace zeek { +class EventHandler; +class EventHandlerPtr; +class RE_Matcher; + // The registry keeps track of all events that we provide or handle. class EventRegistry { public: diff --git a/src/Expr.h b/src/Expr.h index 9a6e932e42..05b1e541fe 100644 --- a/src/Expr.h +++ b/src/Expr.h @@ -18,14 +18,13 @@ #include "zeek/Val.h" #include "zeek/ZeekArgs.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Scope, zeek::detail); - namespace zeek { template class IntrusivePtr; namespace detail { +class Frame; +class Scope; struct function_ingredients; using IDPtr = IntrusivePtr; diff --git a/src/File.h b/src/File.h index a496f2ebf7..8ed5d0a13e 100644 --- a/src/File.h +++ b/src/File.h @@ -16,11 +16,16 @@ #include "zeek/IntrusivePtr.h" #include "zeek/util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(PrintStmt, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Attributes, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); - namespace zeek { + +namespace detail { + +class PrintStmt; +class Attributes; + +} // namespace detail; + +class RecordVal; class Type; using TypePtr = IntrusivePtr; diff --git a/src/Frag.h b/src/Frag.h index b9a2ad7656..32ca8176ca 100644 --- a/src/Frag.h +++ b/src/Frag.h @@ -10,12 +10,15 @@ #include "zeek/Reassem.h" #include "zeek/Timer.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(NetSessions, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(IP_Hdr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(FragReassembler, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(FragTimer, zeek::detail); +namespace zeek { -namespace zeek::detail { +class NetSessions; +class IP_Hdr; + +namespace detail { + +class FragReassembler; +class FragTimer; using FragReassemblerKey = std::tuple; @@ -103,4 +106,5 @@ private: FragReassembler* frag_reassembler; }; -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/Frame.h b/src/Frame.h index 53a4d6efc8..36d775ef9f 100644 --- a/src/Frame.h +++ b/src/Frame.h @@ -18,18 +18,21 @@ #include "zeek/IntrusivePtr.h" #include "zeek/ZeekArgs.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(CallExpr, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Trigger, zeek::detail::trigger); - namespace zeek { + using ValPtr = IntrusivePtr; namespace detail { + +class CallExpr; class ScriptFunc; using IDPtr = IntrusivePtr; namespace trigger { + +class Trigger; using TriggerPtr = IntrusivePtr; + } class Frame; diff --git a/src/Func.h b/src/Func.h index 730dad339c..db15fde849 100644 --- a/src/Func.h +++ b/src/Func.h @@ -18,14 +18,6 @@ #include "zeek/ZeekArgs.h" #include "zeek/BifReturnVal.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Scope, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(CallExpr, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(ID, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(FuncType, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail); - namespace caf { template class expected; } @@ -38,8 +30,16 @@ using caf::expected; namespace zeek { +class Val; +class FuncType; + namespace detail { +class Scope; +class Stmt; +class CallExpr; +class ID; +class Frame; using ScopePtr = IntrusivePtr; using IDPtr = IntrusivePtr; using StmtPtr = IntrusivePtr; diff --git a/src/Hash.h b/src/Hash.h index 775ae0c7e7..6074fac8e7 100644 --- a/src/Hash.h +++ b/src/Hash.h @@ -26,10 +26,13 @@ // to allow bro_md5_hmac access to the hmac seed #include "zeek/ZeekArgs.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(BifReturnVal, zeek::detail); - namespace zeek { class String; } +namespace zeek::detail { + +class Frame; +class BifReturnVal; + +} namespace zeek::BifFunc { extern zeek::detail::BifReturnVal md5_hmac_bif(zeek::detail::Frame* frame, const zeek::Args*); diff --git a/src/ID.h b/src/ID.h index 5fc6f990d7..9997967475 100644 --- a/src/ID.h +++ b/src/ID.h @@ -13,14 +13,14 @@ #include "zeek/Notifier.h" #include "zeek/TraverseTypes.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordType, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(TableType, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(VectorType, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(EnumType, zeek); - namespace zeek { + +class Func; +class Val; +class RecordType; +class TableType; +class VectorType; +class EnumType; class Type; using TypePtr = IntrusivePtr; using RecordTypePtr = IntrusivePtr; @@ -29,6 +29,7 @@ using VectorTypePtr = IntrusivePtr; using EnumTypePtr = IntrusivePtr; using ValPtr = IntrusivePtr; using FuncPtr = IntrusivePtr; + } namespace zeek::detail { diff --git a/src/IP.h b/src/IP.h index b6ff27b9de..915e105836 100644 --- a/src/IP.h +++ b/src/IP.h @@ -16,15 +16,16 @@ #include "zeek/IntrusivePtr.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(IPAddr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(VectorVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(FragReassembler, zeek::detail); - namespace zeek { + +class IPAddr; +class RecordVal; +class VectorVal; using RecordValPtr = IntrusivePtr; using VectorValPtr = IntrusivePtr; +namespace detail { class FragReassembler; } + #ifdef ENABLE_MOBILE_IPV6 #ifndef IPPROTO_MOBILITY diff --git a/src/IPAddr.h b/src/IPAddr.h index a85f5e15b7..c595791dbf 100644 --- a/src/IPAddr.h +++ b/src/IPAddr.h @@ -10,9 +10,6 @@ #include "zeek/threading/SerialTypes.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(HashKey, zeek::detail); -namespace analyzer { class ExpectedConn; } - typedef in_addr in4_addr; namespace zeek { @@ -22,6 +19,8 @@ struct ConnID; namespace detail { +class HashKey; + struct ConnIDKey { in6_addr ip1; in6_addr ip2; diff --git a/src/NFA.h b/src/NFA.h index 838ec08cc2..9d4e90062b 100644 --- a/src/NFA.h +++ b/src/NFA.h @@ -5,10 +5,6 @@ #include "zeek/Obj.h" #include "zeek/List.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(CCL, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(EquivClass, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek); - #define NO_ACCEPT 0 #define NO_UPPER_BOUND -1 @@ -20,7 +16,14 @@ ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek); #define SYM_EPSILON 259 #define SYM_CCL 260 -namespace zeek::detail { +namespace zeek { + +class Func; + +namespace detail { + +class CCL; +class EquivClass; class NFA_State; using NFA_state_list = PList; @@ -136,4 +139,5 @@ extern NFA_state_list* epsilon_closure(NFA_state_list* states); // For sorting NFA states based on their ID fields (decreasing) extern bool NFA_state_cmp_neg(const NFA_State* v1, const NFA_State* v2); -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/Obj.h b/src/Obj.h index b839e54d7d..503abbd3ac 100644 --- a/src/Obj.h +++ b/src/Obj.h @@ -6,9 +6,10 @@ #include -ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek); - namespace zeek { + +class ODesc; + namespace detail { class Location final { diff --git a/src/OpaqueVal.h b/src/OpaqueVal.h index 6d2f8d73d8..1898618c25 100644 --- a/src/OpaqueVal.h +++ b/src/OpaqueVal.h @@ -13,11 +13,11 @@ namespace broker { class data; } -ZEEK_FORWARD_DECLARE_NAMESPACED(BloomFilter, zeek, probabilistic); -ZEEK_FORWARD_DECLARE_NAMESPACED(CardinalityCounter, zeek, probabilistic, detail); - namespace zeek { +namespace probabilistic { class BloomFilter; } +namespace probabilistic::detail { class CardinalityCounter; } + class OpaqueVal; using OpaqueValPtr = IntrusivePtr; diff --git a/src/PacketFilter.h b/src/PacketFilter.h index 2d8803924c..d827301101 100644 --- a/src/PacketFilter.h +++ b/src/PacketFilter.h @@ -7,10 +7,12 @@ #include "zeek/IPAddr.h" #include "zeek/PrefixTable.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(IP_Hdr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); +namespace zeek { -namespace zeek::detail { +class IP_Hdr; +class Val; + +namespace detail { class PacketFilter { public: @@ -50,4 +52,5 @@ private: PrefixTable dst_filter; }; -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/PrefixTable.h b/src/PrefixTable.h index 33dee2ab69..3c130dc2a2 100644 --- a/src/PrefixTable.h +++ b/src/PrefixTable.h @@ -4,14 +4,17 @@ extern "C" { #include "zeek/patricia.h" } +#include #include #include "zeek/IPAddr.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(SubNetVal, zeek); +namespace zeek { -namespace zeek::detail { +class Val; +class SubNetVal; + +namespace detail { class PrefixTable { private: @@ -64,4 +67,5 @@ private: data_fn_t delete_function; }; -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/PriorityQueue.h b/src/PriorityQueue.h index d36933c165..17e3ffa20e 100644 --- a/src/PriorityQueue.h +++ b/src/PriorityQueue.h @@ -7,10 +7,10 @@ #include #include -ZEEK_FORWARD_DECLARE_NAMESPACED(PriorityQueue, zeek::detail); - namespace zeek::detail { +class PriorityQueue; + class PQ_Element { public: explicit PQ_Element(double t) : time(t) {} diff --git a/src/RE.h b/src/RE.h index d39eaaffec..fdbd023fd7 100644 --- a/src/RE.h +++ b/src/RE.h @@ -14,22 +14,22 @@ typedef int (*cce_func)(int); -ZEEK_FORWARD_DECLARE_NAMESPACED(NFA_Machine, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(DFA_Machine, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(DFA_State, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Specific_RE_Matcher, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(RE_Matcher, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(CCL, zeek::detail); - // This method is automatically generated by flex and shouldn't be namespaced extern int re_lex(void); namespace zeek { class String; +class RE_Matcher; namespace detail { +class NFA_Machine; +class DFA_Machine; +class DFA_State; +class Specific_RE_Matcher; +class CCL; + extern int case_insensitive; extern CCL* curr_ccl; extern NFA_Machine* nfa; diff --git a/src/RandTest.h b/src/RandTest.h index da0ebc9838..c28c906ae5 100644 --- a/src/RandTest.h +++ b/src/RandTest.h @@ -8,9 +8,11 @@ bits than the mantissa of your "double" floating point type. */ -ZEEK_FORWARD_DECLARE_NAMESPACED(EntropyVal, zeek); +namespace zeek { -namespace zeek::detail { +class EntropyVal; + +namespace detail { class RandTest { public: @@ -32,4 +34,5 @@ private: sccu0, scclast, scct1, scct2, scct3; }; -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/Reporter.h b/src/Reporter.h index cb925bcaa1..cc6b9f926d 100644 --- a/src/Reporter.h +++ b/src/Reporter.h @@ -15,22 +15,29 @@ #include "zeek/ZeekList.h" #include "zeek/net_util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Analyzer, zeek, analyzer); -ZEEK_FORWARD_DECLARE_NAMESPACED(File, zeek, file_analysis); -ZEEK_FORWARD_DECLARE_NAMESPACED(Connection, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandlerPtr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(StringVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Location, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(IPAddr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Reporter, zeek); - namespace zeek { + +class Connection; +class EventHandlerPtr; +class RecordVal; +class StringVal; +class IPAddr; +class Reporter; + template class IntrusivePtr; using RecordValPtr = IntrusivePtr; using StringValPtr = IntrusivePtr; +namespace detail { + +class Location; +class Expr; + +} // namespace detail + +namespace analyzer { class Analyzer; } +namespace file_analysis { class File; } + // One cannot raise this exception directly, go through the // Reporter's methods instead. diff --git a/src/Rule.h b/src/Rule.h index 314420c4e5..a263951855 100644 --- a/src/Rule.h +++ b/src/Rule.h @@ -8,14 +8,14 @@ #include "zeek/List.h" #include "zeek/Obj.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(RuleCondition, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(RuleAction, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(RuleHdrTest, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(RuleMatcher, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Rule, zeek::detail); - namespace zeek::detail { +class RuleCondition; +class RuleAction; +class RuleHdrTest; +class RuleMatcher; +class Rule; + using rule_list = PList; using rule_dict = std::map; diff --git a/src/RuleAction.h b/src/RuleAction.h index 7f59ef40b9..7d021a49d6 100644 --- a/src/RuleAction.h +++ b/src/RuleAction.h @@ -5,11 +5,11 @@ #include // for u_char #include -ZEEK_FORWARD_DECLARE_NAMESPACED(Rule, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(RuleEndpointState, zeek::detail); - namespace zeek::detail { +class Rule; +class RuleEndpointState; + // Base class of all rule actions. class RuleAction { public: diff --git a/src/RuleCondition.h b/src/RuleCondition.h index 63b108fc61..b66c09c388 100644 --- a/src/RuleCondition.h +++ b/src/RuleCondition.h @@ -5,12 +5,12 @@ #include "zeek/util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(RuleEndpointState, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Rule, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(ID, zeek::detail); - namespace zeek::detail { +class RuleEndpointState; +class Rule; +class ID; + // Base class for all rule conditions except patterns and "header". class RuleCondition { public: diff --git a/src/RuleMatcher.h b/src/RuleMatcher.h index d327d89cff..e449fddfbc 100644 --- a/src/RuleMatcher.h +++ b/src/RuleMatcher.h @@ -27,18 +27,22 @@ extern FILE* rules_in; extern int rules_line_number; extern const char* current_rule_file; -namespace zeek { class File; } -ZEEK_FORWARD_DECLARE_NAMESPACED(RE_Match_State, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Specific_RE_Matcher, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(RuleMatcher, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(IP_Hdr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(IPPrefix, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Analyzer, zeek, analyzer); -ZEEK_FORWARD_DECLARE_NAMESPACED(IntSet, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(PIA, zeek, analyzer::pia); +namespace zeek { -namespace zeek::detail { +class File; +class IP_Hdr; +class IPPrefix; +class Val; + +namespace analyzer { class Analyzer; } +namespace analyzer::pia { class PIA; } + +namespace detail { + +class RE_Match_State; +class Specific_RE_Matcher; +class RuleMatcher; +class IntSet; extern RuleMatcher* rule_matcher; @@ -390,4 +394,5 @@ private: RuleEndpointState* resp_match_state; }; -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/RunState.h b/src/RunState.h index 4a894d996e..bd304d9eef 100644 --- a/src/RunState.h +++ b/src/RunState.h @@ -7,12 +7,19 @@ #include #include -ZEEK_FORWARD_DECLARE_NAMESPACED(IOSource, zeek, iosource); -ZEEK_FORWARD_DECLARE_NAMESPACED(PktSrc, zeek, iosource); -ZEEK_FORWARD_DECLARE_NAMESPACED(PktDumper, zeek, iosource); -ZEEK_FORWARD_DECLARE_NAMESPACED(Packet, zeek); +namespace zeek { -namespace zeek::run_state { +class Packet; + +namespace iosource { + +class IOSource; +class PktSrc; +class PktDumper; + +} // namespace iosource + +namespace run_state { namespace detail { extern void init_run(const std::optional& interfaces, @@ -103,4 +110,5 @@ extern const zeek::Packet* current_pkt; extern int current_dispatched; extern double current_timestamp; -} // namespace zeek::run_state +} // namespace run_state +} // namespace zeek diff --git a/src/Scope.h b/src/Scope.h index 3ed9d089a5..c5fb08d6fe 100644 --- a/src/Scope.h +++ b/src/Scope.h @@ -12,18 +12,16 @@ #include "zeek/IntrusivePtr.h" #include "zeek/TraverseTypes.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Type, zeek); - -ZEEK_FORWARD_DECLARE_NAMESPACED(ID, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Attr, zeek::detail); - namespace zeek { +class Type; template class IntrusivePtr; using TypePtr = IntrusivePtr; namespace detail { +class Attr; +class ID; using AttrPtr = IntrusivePtr; using IDPtr = IntrusivePtr; diff --git a/src/ScriptCoverageManager.h b/src/ScriptCoverageManager.h index faa168917d..a7142bc11f 100644 --- a/src/ScriptCoverageManager.h +++ b/src/ScriptCoverageManager.h @@ -6,10 +6,11 @@ #include #include "zeek/util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail); namespace zeek::detail { +class Stmt; + /** * A simple class for managing stats of Bro script coverage across Bro runs. */ diff --git a/src/SerializationFormat.h b/src/SerializationFormat.h index af36cbd4a0..d5bb4a498a 100644 --- a/src/SerializationFormat.h +++ b/src/SerializationFormat.h @@ -7,13 +7,15 @@ #include #include -ZEEK_FORWARD_DECLARE_NAMESPACED(IPAddr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(IPPrefix, zeek); - struct in_addr; struct in6_addr; -namespace zeek::detail { +namespace zeek { + +class IPAddr; +class IPPrefix; + +namespace detail { // Abstract base class. class SerializationFormat { @@ -138,3 +140,4 @@ public: }; } // namespace zeek::detail +} // namespace zeek diff --git a/src/Sessions.h b/src/Sessions.h index 0a81c11e81..127456c630 100644 --- a/src/Sessions.h +++ b/src/Sessions.h @@ -11,17 +11,17 @@ #include "zeek/NetVar.h" #include "zeek/analyzer/protocol/tcp/Stats.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(EncapsulationStack, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Packet, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Connection, zeek); class ConnCompressor; -ZEEK_FORWARD_DECLARE_NAMESPACED(SteppingStoneManager, zeek, analyzer::stepping_stone); - namespace zeek { +class EncapsulationStack; +class Packet; +class Connection; struct ConnID; +namespace analyzer::stepping_stone { class SteppingStoneManager; } + struct SessionStats { size_t num_TCP_conns; size_t max_TCP_conns; diff --git a/src/Stats.h b/src/Stats.h index 4c4165ce6a..ceee127c70 100644 --- a/src/Stats.h +++ b/src/Stats.h @@ -9,13 +9,15 @@ #include #include -namespace zeek { class File; } +namespace zeek { -ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(TableVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Location, zeek::detail); +class File; +class Func; +class TableVal; -namespace zeek::detail { +namespace detail { + +class Location; // Object called by SegmentProfiler when it is done and reports its // cumulative CPU/memory statistics. @@ -142,4 +144,5 @@ protected: uint64_t byte_cnt; }; -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/Stmt.h b/src/Stmt.h index 56f08a23e1..60d1ae35fa 100644 --- a/src/Stmt.h +++ b/src/Stmt.h @@ -10,11 +10,10 @@ #include "zeek/Dict.h" #include "zeek/ID.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(CompositeHash, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(NameExpr, zeek::detail); - namespace zeek::detail { +class CompositeHash; +class NameExpr; using NameExprPtr = IntrusivePtr; class ExprListStmt : public Stmt { diff --git a/src/StmtBase.h b/src/StmtBase.h index eb5a1e15ac..f6f64d6e21 100644 --- a/src/StmtBase.h +++ b/src/StmtBase.h @@ -12,17 +12,17 @@ #include "zeek/TraverseTypes.h" #include "zeek/util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(CompositeHash, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail); - -namespace zeek::run_state { extern double network_time; } - namespace zeek { + class Val; using ValPtr = IntrusivePtr; -} -namespace zeek::detail { +namespace run_state { extern double network_time; } + +namespace detail { + +class CompositeHash; +class Frame; class CatchReturnStmt; class ExprStmt; @@ -184,4 +184,5 @@ protected: StmtPtr original = nullptr; }; -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/Tag.h b/src/Tag.h index 4e6cbf913d..fcb154b34a 100644 --- a/src/Tag.h +++ b/src/Tag.h @@ -10,11 +10,10 @@ #include "zeek/IntrusivePtr.h" #include "zeek/util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(EnumVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(EnumType, zeek); - namespace zeek { +class EnumVal; +class EnumType; using EnumTypePtr = IntrusivePtr; using EnumValPtr = IntrusivePtr; diff --git a/src/Timer.h b/src/Timer.h index a91753c19f..ab952531f4 100644 --- a/src/Timer.h +++ b/src/Timer.h @@ -7,7 +7,7 @@ #include "zeek/PriorityQueue.h" #include "zeek/iosource/IOSource.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek); +namespace zeek { class ODesc; } namespace zeek::detail { diff --git a/src/Traverse.h b/src/Traverse.h index 9a0565b8b8..36fc04afb7 100644 --- a/src/Traverse.h +++ b/src/Traverse.h @@ -4,13 +4,16 @@ #include "zeek/TraverseTypes.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Scope, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(ID, zeek::detail); +namespace zeek { -namespace zeek::detail { +class Func; + +namespace detail { + +class Scope; +class Stmt; +class Expr; +class ID; class TraversalCallback { public: @@ -40,4 +43,5 @@ public: TraversalCode traverse_all(TraversalCallback* cb); -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/TraverseTypes.h b/src/TraverseTypes.h index 797264a32d..f4e081499b 100644 --- a/src/TraverseTypes.h +++ b/src/TraverseTypes.h @@ -4,10 +4,10 @@ #include "zeek/zeek-config.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(TraversalCallback, zeek::detail); - namespace zeek::detail { +class TraversalCallback; + enum TraversalCode { TC_CONTINUE = 0, TC_ABORTALL = 1, diff --git a/src/Trigger.h b/src/Trigger.h index abd505b08a..74828ccf13 100644 --- a/src/Trigger.h +++ b/src/Trigger.h @@ -10,15 +10,19 @@ #include "zeek/util.h" #include "zeek/IntrusivePtr.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(CallExpr, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(ID, zeek::detail); +namespace zeek { + +class ODesc; +class Val; + +namespace detail { + +class Frame; +class Stmt; +class Expr; +class CallExpr; +class ID; -namespace zeek::detail { namespace trigger { @@ -149,4 +153,5 @@ private: extern trigger::Manager* trigger_mgr; -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/TunnelEncapsulation.h b/src/TunnelEncapsulation.h index ad7bb6f31d..3a11c4f1e9 100644 --- a/src/TunnelEncapsulation.h +++ b/src/TunnelEncapsulation.h @@ -11,10 +11,10 @@ #include "zeek/ID.h" #include "zeek/UID.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Connection, zeek); - namespace zeek { +class Connection; + /** * Represents various types of tunnel "connections", that is, a pair of * endpoints whose communication encapsulates inner IP packets. This could diff --git a/src/Type.h b/src/Type.h index 88d6efdb25..d3b200c7d8 100644 --- a/src/Type.h +++ b/src/Type.h @@ -15,22 +15,23 @@ #include "zeek/ZeekList.h" #include "zeek/IntrusivePtr.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(EnumVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(TableVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(ListExpr, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Attributes, zeek::detail); - namespace zeek { +class Val; +class EnumVal; +class TableVal; using ValPtr = IntrusivePtr; using EnumValPtr = IntrusivePtr; using TableValPtr = IntrusivePtr; namespace detail { + +class Expr; +class ListExpr; +class Attributes; using ListExprPtr = IntrusivePtr; -} + +} // namespace detail // BRO types. enum TypeTag { diff --git a/src/Val.h b/src/Val.h index 0efe90f3db..3919b344d7 100644 --- a/src/Val.h +++ b/src/Val.h @@ -27,33 +27,31 @@ #define ICMP_PORT_MASK 0x30000 namespace zeek { -class String; -} -ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(IPAddr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(IPPrefix, zeek); -namespace zeek { +class String; +class Func; +class IPAddr; +class IPPrefix; +class RE_Matcher; class File; using FilePtr = zeek::IntrusivePtr; -} -namespace zeek::detail { class ScriptFunc; } +namespace detail { -ZEEK_FORWARD_DECLARE_NAMESPACED(PrefixTable, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(RE_Matcher, zeek); +class ScriptFunc; +class Frame; +class PrefixTable; +class CompositeHash; +class HashKey; -ZEEK_FORWARD_DECLARE_NAMESPACED(CompositeHash, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(HashKey, zeek::detail); +} // namespace detail -namespace zeek { namespace run_state { extern double network_time; extern double zeek_start_network_time; -} +} // namespace run_state using FuncPtr = IntrusivePtr; using FilePtr = IntrusivePtr; diff --git a/src/Var.h b/src/Var.h index d3bdef5d05..bd5ae5b020 100644 --- a/src/Var.h +++ b/src/Var.h @@ -6,17 +6,19 @@ #include "zeek/ID.h" #include "zeek/Type.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandlerPtr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(StringVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(TableVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(ListVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(FuncType, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Scope, zeek::detail); +namespace zeek { -namespace zeek::detail { +class EventHandlerPtr; +class StringVal; +class TableVal; +class ListVal; +class FuncType; +namespace detail { + +class Expr; +class Scope; +class Stmt; using StmtPtr = IntrusivePtr; enum DeclType { VAR_REGULAR, VAR_CONST, VAR_REDEF, VAR_OPTION, }; @@ -41,4 +43,5 @@ extern void end_func(StmtPtr body); // Gather all IDs referenced inside a body that aren't part of a given scope. extern IDPList gather_outer_ids(Scope* scope, Stmt* body); -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/ZeekList.h b/src/ZeekList.h index 112bc49560..7782f98b76 100644 --- a/src/ZeekList.h +++ b/src/ZeekList.h @@ -4,15 +4,18 @@ #include "zeek/List.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Expr, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(ID, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Attr, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(Timer, zeek::detail); - namespace zeek { +namespace detail { +class Expr; +class ID; +class Stmt; +class Attr; +class Timer; + +} // namespace detail + +class Val; class Type; using ValPList = PList; diff --git a/src/ZeekString.h b/src/ZeekString.h index b1722bc415..30826be288 100644 --- a/src/ZeekString.h +++ b/src/ZeekString.h @@ -10,12 +10,12 @@ #include #include +namespace zeek { + // Forward declaration, for helper functions that convert (sub)string vectors // to and from policy-level representations. // -ZEEK_FORWARD_DECLARE_NAMESPACED(VectorVal, zeek); - -namespace zeek { +class VectorVal; typedef u_char* byte_vec; diff --git a/src/analyzer/Analyzer.h b/src/analyzer/Analyzer.h index 3f35dcb0c0..ae41f9e354 100644 --- a/src/analyzer/Analyzer.h +++ b/src/analyzer/Analyzer.h @@ -16,20 +16,23 @@ #include "zeek/Timer.h" #include "zeek/IntrusivePtr.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Connection, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Rule, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(IP_Hdr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(TCP_ApplicationAnalyzer, zeek, analyzer::tcp); -ZEEK_FORWARD_DECLARE_NAMESPACED(PIA, zeek, analyzer::pia); - namespace zeek { -using RecordValPtr = zeek::IntrusivePtr; + +class Connection; +class IP_Hdr; class File; using FilePtr = zeek::IntrusivePtr; -} +using RecordValPtr = zeek::IntrusivePtr; + +namespace detail { class Rule; } + +} // namespace zeek namespace zeek::analyzer { +namespace tcp { class TCP_ApplicationAnalyzer; } +namespace pia { class PIA; } + class Analyzer; class AnalyzerTimer; class SupportAnalyzer; diff --git a/src/analyzer/Component.h b/src/analyzer/Component.h index 0ff02c5511..a48613a20d 100644 --- a/src/analyzer/Component.h +++ b/src/analyzer/Component.h @@ -10,10 +10,13 @@ #include "zeek/util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Connection, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Analyzer, zeek, analyzer); +namespace zeek { -namespace zeek::analyzer { +class Connection; + +namespace analyzer { + +class Analyzer; /** * Component description for plugins providing analyzers. @@ -107,4 +110,5 @@ private: bool enabled; // True if the analyzer is enabled. }; -} // namespace zeek::analyzer +} // namespace analyzer +} // namespace zeek diff --git a/src/analyzer/Tag.h b/src/analyzer/Tag.h index c0fb8b0bdf..462194d9c2 100644 --- a/src/analyzer/Tag.h +++ b/src/analyzer/Tag.h @@ -6,17 +6,21 @@ #include "zeek/zeek-config.h" #include "zeek/Tag.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(EnumVal, zeek); +namespace zeek { -namespace zeek::plugin { - template class TaggedComponent; - template class ComponentManager; -} +class EnumVal; -ZEEK_FORWARD_DECLARE_NAMESPACED(Manager, zeek, analyzer); -ZEEK_FORWARD_DECLARE_NAMESPACED(Component, zeek, analyzer); +namespace plugin { -namespace zeek::analyzer { +template class TaggedComponent; +template class ComponentManager; + +} // namespace plugin + +namespace analyzer { + +class Manager; +class Component; /** * Class to identify a protocol analyzer type. @@ -111,4 +115,5 @@ protected: explicit Tag(EnumValPtr val); }; -} // namespace zeek::analyzer +} // namespace analyzer +} // namespace zeek diff --git a/src/analyzer/protocol/bittorrent/BitTorrentTracker.h b/src/analyzer/protocol/bittorrent/BitTorrentTracker.h index 35acaf57d1..cdecae0a2d 100644 --- a/src/analyzer/protocol/bittorrent/BitTorrentTracker.h +++ b/src/analyzer/protocol/bittorrent/BitTorrentTracker.h @@ -6,9 +6,11 @@ #define BTTRACKER_BUF 2048 -ZEEK_FORWARD_DECLARE_NAMESPACED(StringVal, zeek); +namespace zeek { -namespace zeek::analyzer::bittorrent { +class StringVal; + +namespace analyzer::bittorrent { // If the following is defined, then the analyzer will store all of // the headers seen in tracker messages. @@ -133,4 +135,5 @@ protected: bool stop_orig, stop_resp; }; -} // namespace zeek::analyzer::bittorrent +} // namespace analyzer::bittorrent +} // namespace zeek diff --git a/src/analyzer/protocol/ftp/FTP.h b/src/analyzer/protocol/ftp/FTP.h index a353d7f453..84a5113c28 100644 --- a/src/analyzer/protocol/ftp/FTP.h +++ b/src/analyzer/protocol/ftp/FTP.h @@ -4,7 +4,7 @@ #include "zeek/analyzer/protocol/tcp/TCP.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(NVT_Analyzer, zeek, analyzer::login); +namespace zeek::analyzer::login { class NVT_Analyzer; } namespace zeek::analyzer::ftp { diff --git a/src/analyzer/protocol/icmp/ICMP.h b/src/analyzer/protocol/icmp/ICMP.h index 85c35267aa..ef9aeddf92 100644 --- a/src/analyzer/protocol/icmp/ICMP.h +++ b/src/analyzer/protocol/icmp/ICMP.h @@ -6,12 +6,12 @@ #include "zeek/analyzer/Analyzer.h" #include "zeek/net_util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(VectorVal, zeek); namespace zeek { -using VectorValPtr = IntrusivePtr; -} -namespace zeek::analyzer::icmp { +class VectorVal; +using VectorValPtr = IntrusivePtr; + +namespace analyzer::icmp { enum ICMP_EndpointState { ICMP_INACTIVE, // no packet seen @@ -95,4 +95,5 @@ private: extern int ICMP4_counterpart(int icmp_type, int icmp_code, bool& is_one_way); extern int ICMP6_counterpart(int icmp_type, int icmp_code, bool& is_one_way); -} // namespace zeek::analyzer::icmp +} // namespace analyzer::icmp +} // namespace zeek diff --git a/src/analyzer/protocol/login/NVT.h b/src/analyzer/protocol/login/NVT.h index aa997c16c0..3ebd7e27f6 100644 --- a/src/analyzer/protocol/login/NVT.h +++ b/src/analyzer/protocol/login/NVT.h @@ -11,10 +11,10 @@ #define TELNET_OPTION_ENVIRON 39 #define NUM_TELNET_OPTIONS 5 -ZEEK_FORWARD_DECLARE_NAMESPACED(NVT_Analyzer, zeek, analyzer::login); - namespace zeek::analyzer::login { +class NVT_Analyzer; + class TelnetOption { public: TelnetOption(NVT_Analyzer* endp, unsigned int code); diff --git a/src/analyzer/protocol/login/RSH.h b/src/analyzer/protocol/login/RSH.h index c0f7896c9c..f51452ae8d 100644 --- a/src/analyzer/protocol/login/RSH.h +++ b/src/analyzer/protocol/login/RSH.h @@ -5,10 +5,10 @@ #include "zeek/analyzer/protocol/login/Login.h" #include "zeek/analyzer/protocol/tcp/ContentLine.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Rsh_Analyzer, zeek, analyzer::login); - namespace zeek::analyzer::login { +class Rsh_Analyzer; + enum rsh_state { RSH_FIRST_NULL, // waiting to see first NUL RSH_CLIENT_USER_NAME, // scanning client user name up to NUL diff --git a/src/analyzer/protocol/login/Rlogin.h b/src/analyzer/protocol/login/Rlogin.h index 8f849402bf..ce78eb5afb 100644 --- a/src/analyzer/protocol/login/Rlogin.h +++ b/src/analyzer/protocol/login/Rlogin.h @@ -5,10 +5,10 @@ #include "zeek/analyzer/protocol/login/Login.h" #include "zeek/analyzer/protocol/tcp/ContentLine.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Rlogin_Analyzer, zeek, analyzer::login); - namespace zeek::analyzer::login { +class Rlogin_Analyzer; + enum rlogin_state { RLOGIN_FIRST_NULL, // waiting to see first NUL RLOGIN_CLIENT_USER_NAME, // scanning client user name up to NUL diff --git a/src/analyzer/protocol/mime/MIME.h b/src/analyzer/protocol/mime/MIME.h index 1acf6844c4..13a77f6bd0 100644 --- a/src/analyzer/protocol/mime/MIME.h +++ b/src/analyzer/protocol/mime/MIME.h @@ -10,16 +10,16 @@ #include "zeek/Reporter.h" #include "zeek/analyzer/Analyzer.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(TableVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(StringVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Base64Converter, zeek::detail); - namespace zeek { + +class TableVal; +class StringVal; using TableValPtr = IntrusivePtr; using StringValPtr = IntrusivePtr; -} -namespace zeek::analyzer::mime { +namespace detail { class Base64Converter; } + +namespace analyzer::mime { // MIME: Multipurpose Internet Mail Extensions // Follows RFC 822 & 2822 (Internet Mail), 2045-2049 (MIME) @@ -287,4 +287,5 @@ extern int MIME_get_value(int len, const char* data, String*& buf, extern int MIME_get_field_name(int len, const char* data, data_chunk_t* name); extern String* MIME_decode_quoted_pairs(data_chunk_t buf); -} // namespace zeek::analyzer::mime +} // namespace analyzer::mime +} // namespace zeek diff --git a/src/analyzer/protocol/pia/PIA.h b/src/analyzer/protocol/pia/PIA.h index d6bc38a080..c884f05241 100644 --- a/src/analyzer/protocol/pia/PIA.h +++ b/src/analyzer/protocol/pia/PIA.h @@ -6,7 +6,7 @@ #include "zeek/analyzer/protocol/tcp/TCP.h" #include "zeek/RuleMatcher.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(RuleEndpointState, zeek::detail); +namespace zeek::detail { class RuleEndpointState; } namespace zeek::analyzer::pia { diff --git a/src/analyzer/protocol/stepping-stone/SteppingStone.h b/src/analyzer/protocol/stepping-stone/SteppingStone.h index fbd711768a..9bf86c1361 100644 --- a/src/analyzer/protocol/stepping-stone/SteppingStone.h +++ b/src/analyzer/protocol/stepping-stone/SteppingStone.h @@ -5,9 +5,11 @@ #include "zeek/Queue.h" #include "zeek/analyzer/protocol/tcp/TCP.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(NetSessions, zeek); +namespace zeek { -namespace zeek::analyzer::stepping_stone { +class NetSessions; + +namespace analyzer::stepping_stone { class SteppingStoneEndpoint; class SteppingStoneManager; @@ -81,4 +83,5 @@ protected: int endp_cnt = 0; }; -} // namespace zeek::analyzer::stepping_stone +} // namespace analyzer::stepping_stone +} // namespace zeek diff --git a/src/analyzer/protocol/tcp/TCP.h b/src/analyzer/protocol/tcp/TCP.h index d9286568ad..e84db71993 100644 --- a/src/analyzer/protocol/tcp/TCP.h +++ b/src/analyzer/protocol/tcp/TCP.h @@ -14,13 +14,14 @@ // protocol running on top of TCP. // -ZEEK_FORWARD_DECLARE_NAMESPACED(PIA_TCP, zeek, analyzer::pia); -ZEEK_FORWARD_DECLARE_NAMESPACED(TCP_Endpoint, zeek, analyzer::tcp); -ZEEK_FORWARD_DECLARE_NAMESPACED(TCP_Reassembler, zeek, analyzer::tcp); -ZEEK_FORWARD_DECLARE_NAMESPACED(TCP_ApplicationAnalyzer, zeek, analyzer::tcp); +namespace zeek::analyzer::pia { class PIA_TCP; } namespace zeek::analyzer::tcp { +class TCP_Endpoint; +class TCP_Reassembler; +class TCP_ApplicationAnalyzer; + class TCP_Analyzer final : public analyzer::TransportLayerAnalyzer { public: explicit TCP_Analyzer(Connection* conn); diff --git a/src/analyzer/protocol/tcp/TCP_Endpoint.h b/src/analyzer/protocol/tcp/TCP_Endpoint.h index a66d54a648..0a2a867693 100644 --- a/src/analyzer/protocol/tcp/TCP_Endpoint.h +++ b/src/analyzer/protocol/tcp/TCP_Endpoint.h @@ -5,12 +5,15 @@ #include "zeek/IPAddr.h" #include "zeek/File.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Connection, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(IP_Hdr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(TCP_Analyzer, zeek, analyzer::tcp); -ZEEK_FORWARD_DECLARE_NAMESPACED(TCP_Reassembler, zeek, analyzer::tcp); +namespace zeek { -namespace zeek::analyzer::tcp { +class Connection; +class IP_Hdr; + +namespace analyzer::tcp { + +class TCP_Analyzer; +class TCP_Reassembler; enum EndpointState { TCP_ENDPOINT_INACTIVE, // no SYN (or other packets) seen for this side @@ -251,4 +254,5 @@ protected: #define ENDIAN_BIG 2 #define ENDIAN_CONFUSED 3 -} // namespace zeek::analyzer::tcp +} // namespace analyzer::tcp +} // namespace zeek diff --git a/src/analyzer/protocol/tcp/TCP_Reassembler.h b/src/analyzer/protocol/tcp/TCP_Reassembler.h index ffb060603c..7f955dedf8 100644 --- a/src/analyzer/protocol/tcp/TCP_Reassembler.h +++ b/src/analyzer/protocol/tcp/TCP_Reassembler.h @@ -5,11 +5,17 @@ #include "zeek/analyzer/protocol/tcp/TCP_Flags.h" #include "zeek/File.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Connection, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Analyzer, zeek, analyzer); -ZEEK_FORWARD_DECLARE_NAMESPACED(TCP_Analyzer, zeek, analyzer::tcp); +namespace zeek { -namespace zeek::analyzer::tcp { +class Connection; + +namespace analyzer { + +class Analyzer; + +namespace tcp { + +class TCP_Analyzer; class TCP_Reassembler final : public Reassembler { public: @@ -112,4 +118,6 @@ private: Type type; }; -} // namespace zeek::analyzer::tcp +} // namespace tcp +} // namespace analyzer +} // namespace zeek diff --git a/src/broker/Data.h b/src/broker/Data.h index 08215bb5af..a3db6c1514 100644 --- a/src/broker/Data.h +++ b/src/broker/Data.h @@ -5,13 +5,18 @@ #include "zeek/Frame.h" #include "zeek/Expr.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek); -namespace zeek::threading { - struct Value; - struct Field; -} +namespace zeek { -namespace zeek::Broker::detail { +class ODesc; + +namespace threading { + +struct Value; +struct Field; + +} // namespace threading + +namespace Broker::detail { extern OpaqueTypePtr opaque_of_data_type; extern OpaqueTypePtr opaque_of_set_iterator; @@ -288,4 +293,5 @@ protected: DECLARE_OPAQUE_VALUE(zeek::Broker::detail::RecordIterator) }; -} // namespace zeek::Broker +} // namespace Broker::detail +} // namespace zeek diff --git a/src/broker/Manager.h b/src/broker/Manager.h index be3606d57e..af09855c6b 100644 --- a/src/broker/Manager.h +++ b/src/broker/Manager.h @@ -22,15 +22,16 @@ #include "zeek/iosource/IOSource.h" #include "zeek/logging/WriterBackend.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(VectorType, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(TableVal, zeek); - namespace zeek { + +class Func; +class VectorType; +class TableVal; using VectorTypePtr = IntrusivePtr; using TableValPtr = IntrusivePtr; +namespace detail { class Frame; } + namespace Broker { namespace detail { diff --git a/src/file_analysis/Analyzer.h b/src/file_analysis/Analyzer.h index b3ff8fb84c..20b72bfa22 100644 --- a/src/file_analysis/Analyzer.h +++ b/src/file_analysis/Analyzer.h @@ -6,15 +6,14 @@ #include "zeek/file_analysis/Tag.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); namespace zeek { + +class RecordVal; using RecordValPtr = IntrusivePtr; -} -ZEEK_FORWARD_DECLARE_NAMESPACED(File, zeek, file_analysis); - -namespace zeek::file_analysis { +namespace file_analysis { +class File; using ID = uint32_t; /** @@ -175,4 +174,5 @@ private: static ID id_counter; }; -} // namespace zeek::file_analysis +} // namespace file_analysis +} // namespace zeek diff --git a/src/file_analysis/AnalyzerSet.h b/src/file_analysis/AnalyzerSet.h index 4e766a807d..a62beffd82 100644 --- a/src/file_analysis/AnalyzerSet.h +++ b/src/file_analysis/AnalyzerSet.h @@ -8,16 +8,19 @@ #include "zeek/Dict.h" #include "zeek/file_analysis/Tag.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(CompositeHash, zeek::detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); namespace zeek { + +class RecordVal; using RecordValPtr = IntrusivePtr; -} -ZEEK_FORWARD_DECLARE_NAMESPACED(Analyzer, zeek, file_analysis); -ZEEK_FORWARD_DECLARE_NAMESPACED(File, zeek, file_analysis); +namespace detail { class CompositeHash; } -namespace zeek::file_analysis::detail { +namespace file_analysis { + +class Analyzer; +class File; + +namespace detail { /** * A set of file analysis analyzers indexed by an \c AnalyzerArgs (script-layer @@ -237,4 +240,6 @@ private: ModQueue mod_queue; /**< A queue of analyzer additions/removals requests. */ }; -} // namespace zeek::file_analysis::detail +} // namespace detail +} // namespace file_analysis +} // namespace zeek diff --git a/src/file_analysis/Component.h b/src/file_analysis/Component.h index 0bbe167185..3875f8eb33 100644 --- a/src/file_analysis/Component.h +++ b/src/file_analysis/Component.h @@ -8,16 +8,16 @@ #include "zeek/plugin/Component.h" #include "zeek/plugin/TaggedComponent.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); namespace zeek { + +class RecordVal; using RecordValPtr = zeek::IntrusivePtr; -} -ZEEK_FORWARD_DECLARE_NAMESPACED(File, zeek, file_analysis); -ZEEK_FORWARD_DECLARE_NAMESPACED(Analyzer, zeek, file_analysis); -ZEEK_FORWARD_DECLARE_NAMESPACED(Manager, zeek, file_analysis); +namespace file_analysis { -namespace zeek::file_analysis { +class File; +class Analyzer; +class Manager; /** * Component description for plugins providing file analyzers. @@ -81,4 +81,5 @@ private: factory_function factory_func; // The analyzer's factory callback. }; -} // namespace zeek::file_analysis +} // namespace file_analysis +} // namespace zeek diff --git a/src/file_analysis/File.h b/src/file_analysis/File.h index 35ac76cbca..52507a0064 100644 --- a/src/file_analysis/File.h +++ b/src/file_analysis/File.h @@ -13,19 +13,19 @@ #include "zeek/ZeekArgs.h" #include "zeek/WeirdState.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Connection, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandlerPtr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordType, zeek); namespace zeek { + +class Connection; +class EventHandlerPtr; +class RecordVal; +class RecordType; using RecordValPtr = IntrusivePtr; using RecordTypePtr = IntrusivePtr; -} -ZEEK_FORWARD_DECLARE_NAMESPACED(FileReassembler, zeek, file_analysis); -ZEEK_FORWARD_DECLARE_NAMESPACED(Tag, zeek, file_analysis); +namespace file_analysis { -namespace zeek::file_analysis { +class FileReassembler; +class Tag; /** * Wrapper class around \c fa_file record values from script layer. @@ -367,3 +367,4 @@ protected: }; } // namespace file_analysis +} // namespace zeek diff --git a/src/file_analysis/FileReassembler.cc b/src/file_analysis/FileReassembler.cc index c36627d26a..94afddcd94 100644 --- a/src/file_analysis/FileReassembler.cc +++ b/src/file_analysis/FileReassembler.cc @@ -3,10 +3,10 @@ #include "zeek/file_analysis/FileReassembler.h" #include "zeek/file_analysis/File.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(File, zeek, file_analysis); - namespace zeek::file_analysis { +class File; + FileReassembler::FileReassembler(File *f, uint64_t starting_offset) : Reassembler(starting_offset, REASSEM_FILE), the_file(f), flushing(false) { diff --git a/src/file_analysis/FileReassembler.h b/src/file_analysis/FileReassembler.h index c121c145d9..b2d367ae83 100644 --- a/src/file_analysis/FileReassembler.h +++ b/src/file_analysis/FileReassembler.h @@ -4,12 +4,14 @@ #include "zeek/Reassem.h" -namespace zeek { class File; } +namespace zeek { -ZEEK_FORWARD_DECLARE_NAMESPACED(Connection, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(File, zeek, file_analysis); +class Connection; +class File; -namespace zeek::file_analysis { +namespace file_analysis { + +class File; class FileReassembler final : public Reassembler { public: @@ -57,4 +59,5 @@ protected: bool flushing = false; }; -} // namespace zeek::file_analysis +} // namespace file_analysis +} // namespace zeek diff --git a/src/file_analysis/Manager.h b/src/file_analysis/Manager.h index 9460a25a24..c6cf1f8b24 100644 --- a/src/file_analysis/Manager.h +++ b/src/file_analysis/Manager.h @@ -14,16 +14,23 @@ #include "zeek/analyzer/Tag.h" #include "zeek/file_analysis/FileTimer.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(TableVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(VectorVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Analyzer, zeek, analyzer); -ZEEK_FORWARD_DECLARE_NAMESPACED(Tag, zeek, analyzer); -ZEEK_FORWARD_DECLARE_NAMESPACED(File, zeek, file_analysis); -ZEEK_FORWARD_DECLARE_NAMESPACED(Tag, zeek, file_analysis); - namespace zeek { + +class TableVal; +class VectorVal; + +namespace analyzer { + +class Analyzer; +class Tag; + +} // namespace analyzer + namespace file_analysis { +class File; +class Tag; + /** * Main entry point for interacting with file analysis. */ diff --git a/src/file_analysis/Tag.h b/src/file_analysis/Tag.h index 15d624113a..3fad8c10e1 100644 --- a/src/file_analysis/Tag.h +++ b/src/file_analysis/Tag.h @@ -5,16 +5,18 @@ #include "zeek/zeek-config.h" #include "zeek/Tag.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(EnumVal, zeek); - namespace zeek::plugin { template class TaggedComponent; template class ComponentManager; } -ZEEK_FORWARD_DECLARE_NAMESPACED(Component, zeek, file_analysis); +namespace zeek { -namespace zeek::file_analysis { +class EnumVal; + +namespace file_analysis { + +class Component; /** * Class to identify a file analyzer type. @@ -108,4 +110,5 @@ protected: explicit Tag(EnumValPtr val); }; -} // namespace zeek::file_analysis +} // namespace file_analysis +} // namespace zeek diff --git a/src/file_analysis/analyzer/x509/OCSP.h b/src/file_analysis/analyzer/x509/OCSP.h index 161968d054..f0bfdc6c16 100644 --- a/src/file_analysis/analyzer/x509/OCSP.h +++ b/src/file_analysis/analyzer/x509/OCSP.h @@ -7,9 +7,11 @@ #include "zeek/file_analysis/analyzer/x509/X509Common.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(File, zeek, file_analysis); +namespace zeek::file_analysis { -namespace zeek::file_analysis::detail { +class File; + +namespace detail { class OCSP : public file_analysis::detail::X509Common { public: @@ -34,4 +36,5 @@ private: bool request = false; // true if ocsp request, false if reply }; -} // namespace zeek::file_analysis::detail +} // namespace detail +} // namespace zeek::file_analysis diff --git a/src/file_analysis/analyzer/x509/X509Common.h b/src/file_analysis/analyzer/x509/X509Common.h index 4998cdc44d..b341d5cfc7 100644 --- a/src/file_analysis/analyzer/x509/X509Common.h +++ b/src/file_analysis/analyzer/x509/X509Common.h @@ -10,18 +10,20 @@ #include "zeek/file_analysis/Analyzer.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandlerPtr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Reporter, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(StringVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(File, zeek, file_analysis); -ZEEK_FORWARD_DECLARE_NAMESPACED(Tag, zeek, file_analysis); - namespace zeek { + +class EventHandlerPtr; +class Reporter; +class StringVal; template class IntrusivePtr; using StringValPtr = IntrusivePtr; -} -namespace zeek::file_analysis::detail { +namespace file_analysis { + +class File; +class Tag; + +namespace detail { class X509Common : public file_analysis::Analyzer { public: @@ -53,4 +55,6 @@ protected: virtual void ParseExtensionsSpecific(X509_EXTENSION* ex, bool, ASN1_OBJECT*, const char*) = 0; }; -} // namespace zeek::file_analysis +} // namespace detail +} // namespace file_analysis +} // namespace zeek diff --git a/src/input.h b/src/input.h index 0e9ea35eef..34497ac55f 100644 --- a/src/input.h +++ b/src/input.h @@ -34,10 +34,10 @@ extern void do_doc_token_stop(); extern int line_number; extern const char* filename; -ZEEK_FORWARD_DECLARE_NAMESPACED(Stmt, zeek::detail); - namespace zeek::detail { +class Stmt; + extern int zeek_argc; extern char** zeek_argv; extern const char* prog; diff --git a/src/input/Component.h b/src/input/Component.h index 8f5939e58a..ef8cc5b5cb 100644 --- a/src/input/Component.h +++ b/src/input/Component.h @@ -6,11 +6,11 @@ #include "zeek/plugin/TaggedComponent.h" #include "zeek/input/Tag.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(ReaderFrontend, zeek, input); -ZEEK_FORWARD_DECLARE_NAMESPACED(ReaderBackend, zeek, input); - namespace zeek::input { +class ReaderFrontend; +class ReaderBackend; + /** * Component description for plugins providing log readers. */ diff --git a/src/input/Manager.h b/src/input/Manager.h index da0522b654..7084019f89 100644 --- a/src/input/Manager.h +++ b/src/input/Manager.h @@ -12,13 +12,15 @@ #include "zeek/threading/SerialTypes.h" #include "zeek/input/Tag.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(ReaderFrontend, zeek, input); -ZEEK_FORWARD_DECLARE_NAMESPACED(ReaderBackend, zeek, input); - namespace zeek { + +class RecordVal; + namespace input { +class ReaderFrontend; +class ReaderBackend; + /** * Singleton class for managing input streams. */ diff --git a/src/input/ReaderBackend.h b/src/input/ReaderBackend.h index abb6800492..1486d225a0 100644 --- a/src/input/ReaderBackend.h +++ b/src/input/ReaderBackend.h @@ -9,10 +9,10 @@ #include "zeek/input/Component.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(ReaderFrontend, zeek::input); - namespace zeek::input { +class ReaderFrontend; + /** * The modes a reader can be in. */ diff --git a/src/input/ReaderFrontend.h b/src/input/ReaderFrontend.h index c4ca39d3ba..43f01da7bc 100644 --- a/src/input/ReaderFrontend.h +++ b/src/input/ReaderFrontend.h @@ -5,10 +5,13 @@ #include "zeek/input/ReaderBackend.h" #include "zeek/threading/SerialTypes.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(EnumVal, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Manager, zeek, input); +namespace zeek { -namespace zeek::input { +class EnumVal; + +namespace input { + +class Manager; /** * Bridge class between the input::Manager and backend input threads. The @@ -130,4 +133,5 @@ private: const char* name; // Descriptive name. }; -} // namespace zeek::input +} // namespace input +} // namespace zeek diff --git a/src/input/Tag.h b/src/input/Tag.h index b2f0c7ec8e..ae8e45f2f4 100644 --- a/src/input/Tag.h +++ b/src/input/Tag.h @@ -5,17 +5,21 @@ #include "zeek/zeek-config.h" #include "zeek/Tag.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(EnumVal, zeek); +namespace zeek { -namespace zeek::plugin { - template class TaggedComponent; - template class ComponentManager; -} +class EnumVal; -ZEEK_FORWARD_DECLARE_NAMESPACED(Manager, zeek, input); -ZEEK_FORWARD_DECLARE_NAMESPACED(Component, zeek, input); +namespace plugin { -namespace zeek::input { +template class TaggedComponent; +template class ComponentManager; + +} // namespace plugin + +namespace input { + +class Manager; +class Component; /** * Class to identify a reader type. @@ -109,4 +113,5 @@ protected: explicit Tag(EnumValPtr val); }; -} // namespace zeek::input +} // namespace input +} // namespace zeek diff --git a/src/iosource/Component.h b/src/iosource/Component.h index e8a1e7d9cb..feb7d5074c 100644 --- a/src/iosource/Component.h +++ b/src/iosource/Component.h @@ -7,12 +7,12 @@ #include "zeek/plugin/Component.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(IOSource, zeek, iosource); -ZEEK_FORWARD_DECLARE_NAMESPACED(PktSrc, zeek, iosource); -ZEEK_FORWARD_DECLARE_NAMESPACED(PktDumper, zeek, iosource); - namespace zeek::iosource { +class IOSource; +class PktSrc; +class PktDumper; + /** * Component description for plugins providing IOSources. */ diff --git a/src/iosource/Manager.h b/src/iosource/Manager.h index 2bee5bfa27..82fbf57526 100644 --- a/src/iosource/Manager.h +++ b/src/iosource/Manager.h @@ -14,12 +14,12 @@ struct timespec; struct kevent; -ZEEK_FORWARD_DECLARE_NAMESPACED(PktSrc, zeek, iosource); -ZEEK_FORWARD_DECLARE_NAMESPACED(PktDumper, zeek, iosource); - namespace zeek { namespace iosource { +class PktSrc; +class PktDumper; + /** * Manager class for IO sources. This handles all of the polling of sources * in the main loop. diff --git a/src/iosource/Packet.h b/src/iosource/Packet.h index 047b91f11d..20469b3105 100644 --- a/src/iosource/Packet.h +++ b/src/iosource/Packet.h @@ -19,12 +19,12 @@ typedef struct timeval pkt_timeval; #include "zeek/TunnelEncapsulation.h" #include "zeek/IP.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); - namespace zeek { +class ODesc; +class Val; +class RecordVal; + template class IntrusivePtr; using ValPtr = IntrusivePtr; using RecordValPtr = IntrusivePtr; diff --git a/src/iosource/PktDumper.h b/src/iosource/PktDumper.h index 3eeff775b1..9d116d62ae 100644 --- a/src/iosource/PktDumper.h +++ b/src/iosource/PktDumper.h @@ -5,9 +5,11 @@ #include "zeek/zeek-config.h" #include -ZEEK_FORWARD_DECLARE_NAMESPACED(Packet, zeek); +namespace zeek { -namespace zeek::iosource { +class Packet; + +namespace iosource { /** * Base class for packet dumpers. @@ -133,4 +135,5 @@ private: std::string errmsg; }; -} // namespace zeek::iosource +} // namespace iosource +} // namespace zeek diff --git a/src/iosource/PktSrc.h b/src/iosource/PktSrc.h index 6da818cb30..0afc2897df 100644 --- a/src/iosource/PktSrc.h +++ b/src/iosource/PktSrc.h @@ -9,10 +9,11 @@ #include "zeek/iosource/Packet.h" struct pcap_pkthdr; -ZEEK_FORWARD_DECLARE_NAMESPACED(BPF_Program, zeek::iosource::detail); namespace zeek::iosource { +namespace detail { class BPF_Program; } + /** * Base class for packet sources. */ diff --git a/src/logging/Component.h b/src/logging/Component.h index 1afc5847bb..9df76b3a00 100644 --- a/src/logging/Component.h +++ b/src/logging/Component.h @@ -6,11 +6,11 @@ #include "zeek/plugin/Component.h" #include "zeek/plugin/TaggedComponent.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(WriterFrontend, zeek, logging); -ZEEK_FORWARD_DECLARE_NAMESPACED(WriterBackend, zeek, logging); - namespace zeek::logging { +class WriterFrontend; +class WriterBackend; + /** * Component description for plugins providing log writers. */ diff --git a/src/logging/Manager.h b/src/logging/Manager.h index b67179aaed..83740acc44 100644 --- a/src/logging/Manager.h +++ b/src/logging/Manager.h @@ -15,14 +15,15 @@ #include "zeek/logging/WriterBackend.h" namespace broker { struct endpoint_info; } -ZEEK_FORWARD_DECLARE_NAMESPACED(SerializationFormat, zeek::detail); - -ZEEK_FORWARD_DECLARE_NAMESPACED(WriterFrontend, zeek, logging); -ZEEK_FORWARD_DECLARE_NAMESPACED(RotationFinishedMessage, zeek, logging); namespace zeek { + +namespace detail { class SerializationFormat; } + namespace logging { +class WriterFrontend; +class RotationFinishedMessage; class RotationTimer; /** diff --git a/src/logging/Tag.h b/src/logging/Tag.h index 46ba599cf8..2642afe6e2 100644 --- a/src/logging/Tag.h +++ b/src/logging/Tag.h @@ -5,17 +5,21 @@ #include "zeek/zeek-config.h" #include "zeek/Tag.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(EnumVal, zeek); +namespace zeek { -namespace zeek::plugin { - template class TaggedComponent; - template class ComponentManager; -} +class EnumVal; -ZEEK_FORWARD_DECLARE_NAMESPACED(Manager, zeek, logging); -ZEEK_FORWARD_DECLARE_NAMESPACED(Component, zeek, logging); +namespace plugin { -namespace zeek::logging { +template class TaggedComponent; +template class ComponentManager; + +} // namespace plugin + +namespace logging { + +class Manager; +class Component; /** * Class to identify a writer type. @@ -114,4 +118,5 @@ protected: explicit Tag(EnumValPtr val); }; -} // namespace zeek::logging +} // namespace logging +} // namespace zeek diff --git a/src/logging/WriterBackend.h b/src/logging/WriterBackend.h index 6888c77312..da232f86e9 100644 --- a/src/logging/WriterBackend.h +++ b/src/logging/WriterBackend.h @@ -9,10 +9,10 @@ namespace broker { class data; } -ZEEK_FORWARD_DECLARE_NAMESPACED(WriterFrontend, zeek, logging); - namespace zeek::logging { +class WriterFrontend; + /** * Base class for writer implementation. When the logging::Manager creates a * new logging filter, it instantiates a WriterFrontend. That then in turn diff --git a/src/logging/WriterFrontend.h b/src/logging/WriterFrontend.h index eda71c1f61..830ea9e463 100644 --- a/src/logging/WriterFrontend.h +++ b/src/logging/WriterFrontend.h @@ -4,10 +4,10 @@ #include "zeek/logging/WriterBackend.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Manager, zeek, logging); - namespace zeek::logging { +class Manager; + /** * Bridge class between the logging::Manager and backend writer threads. The * Manager instantiates one \a WriterFrontend for each open logging filter. diff --git a/src/net_util.h b/src/net_util.h index fb7e410d3a..deed0c6d77 100644 --- a/src/net_util.h +++ b/src/net_util.h @@ -116,11 +116,11 @@ struct ip6_rthdr { #define TCPOPT_TIMESTAMP TCPOPT_TSTAMP #endif -ZEEK_FORWARD_DECLARE_NAMESPACED(IPAddr, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(IP_Hdr, zeek); - namespace zeek { +class IPAddr; +class IP_Hdr; + namespace detail { struct checksum_block { diff --git a/src/packet_analysis/Manager.h b/src/packet_analysis/Manager.h index 218583b663..35eaacbee7 100644 --- a/src/packet_analysis/Manager.h +++ b/src/packet_analysis/Manager.h @@ -8,9 +8,10 @@ #include "zeek/iosource/Packet.h" #include "zeek/packet_analysis/Dispatcher.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(PacketProfiler, zeek::detail); - namespace zeek { + +namespace detail { class PacketProfiler; } + namespace packet_analysis { class Analyzer; diff --git a/src/packet_analysis/protocol/ip/IP.h b/src/packet_analysis/protocol/ip/IP.h index bf7bd1461d..e24f842283 100644 --- a/src/packet_analysis/protocol/ip/IP.h +++ b/src/packet_analysis/protocol/ip/IP.h @@ -6,7 +6,7 @@ #include "zeek/packet_analysis/Component.h" #include "zeek/Frag.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(Discarder, zeek::detail); +namespace zeek::detail { class Discarder; } namespace zeek::packet_analysis::IP { diff --git a/src/plugin/Component.h b/src/plugin/Component.h index 709565b6d1..41502b1f83 100644 --- a/src/plugin/Component.h +++ b/src/plugin/Component.h @@ -5,9 +5,11 @@ #include "zeek/zeek-config.h" #include -ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek); +namespace zeek { -namespace zeek::plugin { +class ODesc; + +namespace plugin { namespace component { /** @@ -105,4 +107,5 @@ private: std::string canon_name; }; -} // namespace zeek::plugin +} // namespace plugin +} // namespace zeek diff --git a/src/plugin/Plugin.h b/src/plugin/Plugin.h index 49f7622427..9dca11e6a8 100644 --- a/src/plugin/Plugin.h +++ b/src/plugin/Plugin.h @@ -17,22 +17,22 @@ #define BRO_PLUGIN_BRO_VERSION BRO_VERSION_FUNCTION -ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Event, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail); - -namespace zeek::threading { - struct Field; -} +namespace zeek::threading { struct Field; } namespace zeek { + +class ODesc; +class Event; +class Func; +class Obj; + template class IntrusivePtr; using ValPtr = IntrusivePtr; -class Obj; -} -namespace zeek::plugin { +namespace threading { struct Field; } +namespace detail { class Frame; } + +namespace plugin { class Manager; class Component; @@ -886,4 +886,5 @@ private: bif_item_list bif_items; // BiF items the plugin provides. }; -} // namespace zeek::plugin +} // namespace plugin +} // namespace zeek diff --git a/src/probabilistic/BloomFilter.h b/src/probabilistic/BloomFilter.h index 75dfbdaf34..4c9d1a758c 100644 --- a/src/probabilistic/BloomFilter.h +++ b/src/probabilistic/BloomFilter.h @@ -15,9 +15,8 @@ namespace broker { class data; } -ZEEK_FORWARD_DECLARE_NAMESPACED(CounterVector, zeek, probabilistic, detail); - namespace zeek::probabilistic { +namespace detail { class CounterVector; } /** Types of derived BloomFilter classes. */ enum BloomFilterType { Basic, Counting }; diff --git a/src/probabilistic/CounterVector.h b/src/probabilistic/CounterVector.h index 430cfd83b7..7abd15975f 100644 --- a/src/probabilistic/CounterVector.h +++ b/src/probabilistic/CounterVector.h @@ -12,10 +12,10 @@ namespace broker { class data; } -ZEEK_FORWARD_DECLARE_NAMESPACED(BitVector, zeek, probabilistic, detail); - namespace zeek::probabilistic::detail { +class BitVector; + /** * A vector of counters, each of which has a fixed number of bits. */ diff --git a/src/probabilistic/Topk.h b/src/probabilistic/Topk.h index 4e67b389c3..d38c3e6c7f 100644 --- a/src/probabilistic/Topk.h +++ b/src/probabilistic/Topk.h @@ -9,7 +9,7 @@ // This class implements the top-k algorithm. Or - to be more precise - an // interpretation of it. -ZEEK_FORWARD_DECLARE_NAMESPACED(CompositeHash, zeek::detail); +namespace zeek::detail { class CompositeHash; } namespace zeek::probabilistic::detail { diff --git a/src/threading/BasicThread.h b/src/threading/BasicThread.h index e068d1fa0a..e442a9d8f6 100644 --- a/src/threading/BasicThread.h +++ b/src/threading/BasicThread.h @@ -8,10 +8,10 @@ #include #include -ZEEK_FORWARD_DECLARE_NAMESPACED(Manager, zeek, threading); - namespace zeek::threading { +class Manager; + /** * Base class for all threads. * diff --git a/src/threading/Formatter.h b/src/threading/Formatter.h index 79ef1f73ba..cca8ea8ba8 100644 --- a/src/threading/Formatter.h +++ b/src/threading/Formatter.h @@ -7,10 +7,10 @@ #include "zeek/Type.h" #include "zeek/threading/SerialTypes.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(MsgThread, zeek, threading); - namespace zeek::threading { +class MsgThread; + /** * A thread-safe class for converting values into some textual format. This * is a base class that implements the interface for common diff --git a/src/threading/SerialTypes.h b/src/threading/SerialTypes.h index 51845e6ec6..216376410c 100644 --- a/src/threading/SerialTypes.h +++ b/src/threading/SerialTypes.h @@ -9,7 +9,7 @@ #include "zeek/Type.h" #include "zeek/net_util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(SerializationFormat, zeek::detail); +namespace zeek::detail { class SerializationFormat; } namespace zeek::threading { diff --git a/src/util.h b/src/util.h index 92ecf4eb9a..d59c3ba450 100644 --- a/src/util.h +++ b/src/util.h @@ -69,9 +69,6 @@ extern "C" using bro_int_t = int64_t; using bro_uint_t = uint64_t; -ZEEK_FORWARD_DECLARE_NAMESPACED(ODesc, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek); - #ifndef HAVE_STRCASESTR extern char* strcasestr(const char* s, const char* find); #endif @@ -79,7 +76,12 @@ extern char* strcasestr(const char* s, const char* find); // This is used by the patricia code and so it remains outside of hte namespace. extern "C" void out_of_memory(const char* where); -namespace zeek::util { +namespace zeek { + +class ODesc; +class RecordVal; + +namespace util { namespace detail { std::string extract_ip(const std::string& i); @@ -537,4 +539,5 @@ char* zeekenv(const char* name); */ std::string json_escape_utf8(const std::string& val); -} // namespace zeek::util +} // namespace util +} // namespace zeek diff --git a/src/zeekygen/IdentifierInfo.h b/src/zeekygen/IdentifierInfo.h index f23bc03018..76a0bd33f5 100644 --- a/src/zeekygen/IdentifierInfo.h +++ b/src/zeekygen/IdentifierInfo.h @@ -13,9 +13,11 @@ #include "zeek/ID.h" #include "zeek/util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(TypeDecl, zeek); +namespace zeek { -namespace zeek::zeekygen::detail { +class TypeDecl; + +namespace zeekygen::detail { class ScriptInfo; @@ -201,4 +203,5 @@ private: bool from_redef = false; }; -} // namespace zeek::zeekygen::detail +} // namespace zeekygen::detail +} // namespace zeek diff --git a/src/zeekygen/Manager.h b/src/zeekygen/Manager.h index c4c9609116..76f9b79041 100644 --- a/src/zeekygen/Manager.h +++ b/src/zeekygen/Manager.h @@ -14,11 +14,14 @@ #include "zeek/ID.h" #include "zeek/util.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(TypeDecl, zeek); -ZEEK_FORWARD_DECLARE_NAMESPACED(PackageInfo, zeek, zeekygen, detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(ScriptInfoInfo, zeek, zeekygen, detail); +namespace zeek { -namespace zeek::zeekygen::detail { +class TypeDecl; + +namespace zeekygen::detail { + +class PackageInfo; +class ScriptInfoInfo; /** * Map of info objects. Just a wrapper around std::map to improve code @@ -263,10 +266,11 @@ bool Manager::IsUpToDate(const std::string& target_file, return true; } -} // namespace zeek::zeekygen::detail +} // namespace zeekygen::detail -namespace zeek::detail { +namespace detail { extern zeekygen::detail::Manager* zeekygen_mgr; -} // namespace zeek::detail +} // namespace detail +} // namespace zeek diff --git a/src/zeekygen/ScriptInfo.h b/src/zeekygen/ScriptInfo.h index bf005c5924..25fe0b1e9e 100644 --- a/src/zeekygen/ScriptInfo.h +++ b/src/zeekygen/ScriptInfo.h @@ -13,10 +13,10 @@ #include "zeek/zeekygen/Info.h" -ZEEK_FORWARD_DECLARE_NAMESPACED(IdentifierInfo, zeek, zeekygen, detail); - namespace zeek::zeekygen::detail { +class IdentifierInfo; + struct IdInfoComp { bool operator() (const IdentifierInfo* lhs, const IdentifierInfo* rhs) const; diff --git a/src/zeekygen/Target.h b/src/zeekygen/Target.h index 754d117b87..92fe354ebf 100644 --- a/src/zeekygen/Target.h +++ b/src/zeekygen/Target.h @@ -9,13 +9,13 @@ #include #include -ZEEK_FORWARD_DECLARE_NAMESPACED(Info, zeek, zeekygen, detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(PackageInfo, zeek, zeekygen, detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(ScriptInfo, zeek, zeekygen, detail); -ZEEK_FORWARD_DECLARE_NAMESPACED(IdentifierInfo, zeek, zeekygen, detail); - namespace zeek::zeekygen::detail { +class Info; +class PackageInfo; +class ScriptInfo; +class IdentifierInfo; + /** * Helper class to create files in arbitrary file paths and automatically * close it on destruction. diff --git a/src/zeekygen/utils.h b/src/zeekygen/utils.h index 0d59472270..8b50bb8b12 100644 --- a/src/zeekygen/utils.h +++ b/src/zeekygen/utils.h @@ -7,7 +7,7 @@ #include // for time_t #include -ZEEK_FORWARD_DECLARE_NAMESPACED(ID, zeek::detail); +namespace zeek::detail { class ID; } namespace zeek::zeekygen::detail { diff --git a/zeek-config.h.in b/zeek-config.h.in index 4986b054fd..5f5497f8a5 100644 --- a/zeek-config.h.in +++ b/zeek-config.h.in @@ -274,17 +274,3 @@ extern const char* BRO_VERSION_FUNCTION(); #define ZEEK_LSAN_DISABLE(x) #define ZEEK_LSAN_DISABLE_SCOPE(x) #endif - -// Note: macros for internal use only during deprecation/namespacing process. -// This uses funny VA_ARGS tricks so that we can overload the name and have multiple macros for -// varying namespace lengths. -#define GET_MACRO(_0, _1, _2, _3, _4, NAME, ...) NAME -#define ZEEK_FORWARD_DECLARE_NAMESPACED( ... ) GET_MACRO(_0, ##__VA_ARGS__, ZEEK_FDN_4, ZEEK_FDN_3, ZEEK_FDN_2, ZEEK_FDN_1, ZEEK_FDN_0)(__VA_ARGS__) -#define ZEEK_FDN_0() -#define ZEEK_FDN_1(cls) -#define ZEEK_FDN_2(cls, ns) \ - namespace ns { class cls; } -#define ZEEK_FDN_3(cls, ns1, ns2) \ - namespace ns1::ns2 { class cls; } -#define ZEEK_FDN_4(cls, ns1, ns2, ns3) \ - namespace ns1::ns2::ns3 { class cls; }