Remove uses of deprecated Tag types

This commit is contained in:
Tim Wojtulewicz 2021-09-29 10:11:17 -07:00
parent 331161138a
commit 8b544d648d
35 changed files with 172 additions and 178 deletions

View file

@ -1,9 +1,9 @@
// See the file "COPYING" in the main distribution directory for copyright.
#pragma once
#include "zeek/Tag.h"
#include "zeek/iosource/Packet.h"
#include "zeek/packet_analysis/Manager.h"
#include "zeek/packet_analysis/Tag.h"
namespace zeek::packet_analysis
{
@ -31,7 +31,7 @@ public:
* @param tag The tag for the type of analyzer. The tag must map to
* the name the corresponding Component registers.
*/
explicit Analyzer(const Tag& tag);
explicit Analyzer(const zeek::Tag& tag);
/**
* Destructor.
@ -50,7 +50,7 @@ public:
/**
* Returns the tag associated with the analyzer's type.
*/
const Tag GetAnalyzerTag() const;
const zeek::Tag GetAnalyzerTag() const;
/**
* Returns a textual description of the analyzer's type. This is
@ -165,7 +165,7 @@ protected:
void Weird(const char* name, Packet* packet = nullptr, const char* addl = "") const;
private:
Tag tag;
zeek::Tag tag;
Dispatcher dispatcher;
AnalyzerPtr default_analyzer = nullptr;
@ -174,7 +174,7 @@ private:
*/
bool report_unknown_protocols = true;
void Init(const Tag& tag);
void Init(const zeek::Tag& tag);
};
using AnalyzerPtr = std::shared_ptr<Analyzer>;

View file

@ -6,7 +6,7 @@
#include <functional>
#include "zeek/packet_analysis/Tag.h"
#include "zeek/Tag.h"
#include "zeek/plugin/Component.h"
#include "zeek/plugin/TaggedComponent.h"
#include "zeek/util.h"
@ -22,7 +22,7 @@ class Component : public plugin::Component, public plugin::TaggedComponent
public:
using factory_callback = std::function<AnalyzerPtr()>;
Component(const std::string& name, factory_callback factory, Tag::subtype_t subtype = 0);
Component(const std::string& name, factory_callback factory, zeek::Tag::subtype_t subtype = 0);
~Component() override = default;
/**

View file

@ -4,10 +4,10 @@
#include "zeek/Func.h"
#include "zeek/PacketFilter.h"
#include "zeek/Tag.h"
#include "zeek/iosource/Packet.h"
#include "zeek/packet_analysis/Component.h"
#include "zeek/packet_analysis/Dispatcher.h"
#include "zeek/packet_analysis/Tag.h"
#include "zeek/plugin/ComponentManager.h"
namespace zeek
@ -151,7 +151,7 @@ private:
* @return The new analyzer instance. Returns null if tag is invalid, the
* requested analyzer is disabled, or the analyzer can't be instantiated.
*/
AnalyzerPtr InstantiateAnalyzer(const Tag& tag);
AnalyzerPtr InstantiateAnalyzer(const zeek::Tag& tag);
/**
* Instantiates a new analyzer.

View file

@ -16,7 +16,7 @@ enum ICMP_EndpointState
void ICMPSessionAdapter::AddExtraAnalyzers(Connection* conn)
{
static analyzer::Tag analyzer_connsize = analyzer_mgr->GetComponentTag("CONNSIZE");
static zeek::Tag analyzer_connsize = analyzer_mgr->GetComponentTag("CONNSIZE");
if ( analyzer_mgr->IsEnabled(analyzer_connsize) )
// Add ConnSize analyzer. Needs to see packets, not stream.

View file

@ -196,7 +196,7 @@ void IPBasedAnalyzer::BuildSessionAnalyzerTree(Connection* conn)
if ( ! analyzers_by_port.empty() && ! zeek::detail::dpd_ignore_ports )
{
int resp_port = ntohs(conn->RespPort());
std::set<analyzer::Tag>* ports = LookupPort(resp_port, false);
std::set<zeek::Tag>* ports = LookupPort(resp_port, false);
if ( ports )
{
@ -227,7 +227,7 @@ void IPBasedAnalyzer::BuildSessionAnalyzerTree(Connection* conn)
PLUGIN_HOOK_VOID(HOOK_SETUP_ANALYZER_TREE, HookSetupAnalyzerTree(conn));
}
bool IPBasedAnalyzer::RegisterAnalyzerForPort(const analyzer::Tag& tag, uint32_t port)
bool IPBasedAnalyzer::RegisterAnalyzerForPort(const zeek::Tag& tag, uint32_t port)
{
tag_set* l = LookupPort(port, true);
@ -243,7 +243,7 @@ bool IPBasedAnalyzer::RegisterAnalyzerForPort(const analyzer::Tag& tag, uint32_t
return true;
}
bool IPBasedAnalyzer::UnregisterAnalyzerForPort(const analyzer::Tag& tag, uint32_t port)
bool IPBasedAnalyzer::UnregisterAnalyzerForPort(const zeek::Tag& tag, uint32_t port)
{
tag_set* l = LookupPort(port, true);

View file

@ -6,7 +6,7 @@
#include <set>
#include "zeek/ID.h"
#include "zeek/analyzer/Tag.h"
#include "zeek/Tag.h"
#include "zeek/packet_analysis/Analyzer.h"
namespace zeek::analyzer::pia
@ -49,7 +49,7 @@ public:
* @param port The port's number.
* @return True if successful.
*/
bool RegisterAnalyzerForPort(const analyzer::Tag& tag, uint32_t port);
bool RegisterAnalyzerForPort(const zeek::Tag& tag, uint32_t port);
/**
* Unregisters a well-known port for an analyzer.
@ -57,9 +57,9 @@ public:
* @param tag The analyzer's tag.
* @param port The port's number.
* @param tag The analyzer's tag as an enum of script type \c
* Analyzer::Tag.
* Tag.
*/
bool UnregisterAnalyzerForPort(const analyzer::Tag& tag, uint32_t port);
bool UnregisterAnalyzerForPort(const zeek::Tag& tag, uint32_t port);
/**
* Dumps information about the registered session analyzers per port.
@ -180,7 +180,7 @@ private:
// While this is storing session analyzer tags, we store it here since packet analyzers
// are persitent objects. We can't do this in the adapters because those get created
// and destroyed for each connection.
using tag_set = std::set<analyzer::Tag>;
using tag_set = std::set<zeek::Tag>;
using analyzer_map_by_port = std::map<uint32_t, tag_set*>;
analyzer_map_by_port analyzers_by_port;

View file

@ -724,7 +724,7 @@ analyzer::Analyzer* TCPSessionAdapter::FindChild(analyzer::ID arg_id)
return nullptr;
}
analyzer::Analyzer* TCPSessionAdapter::FindChild(analyzer::Tag arg_tag)
analyzer::Analyzer* TCPSessionAdapter::FindChild(zeek::Tag arg_tag)
{
analyzer::Analyzer* child = packet_analysis::IP::SessionAdapter::FindChild(arg_tag);
@ -1599,8 +1599,8 @@ bool TCPSessionAdapter::IsReuse(double t, const u_char* pkt)
void TCPSessionAdapter::AddExtraAnalyzers(Connection* conn)
{
static analyzer::Tag analyzer_connsize = analyzer_mgr->GetComponentTag("CONNSIZE");
static analyzer::Tag analyzer_tcpstats = analyzer_mgr->GetComponentTag("TCPSTATS");
static zeek::Tag analyzer_connsize = analyzer_mgr->GetComponentTag("CONNSIZE");
static zeek::Tag analyzer_tcpstats = analyzer_mgr->GetComponentTag("TCPSTATS");
// We have to decide whether to reassamble the stream.
// We turn it on right away if we already have an app-layer

View file

@ -2,6 +2,7 @@
#pragma once
#include "zeek/Tag.h"
#include "zeek/analyzer/protocol/tcp/TCP_Endpoint.h"
#include "zeek/analyzer/protocol/tcp/TCP_Flags.h"
#include "zeek/packet_analysis/Analyzer.h"
@ -42,7 +43,7 @@ public:
void AddChildPacketAnalyzer(analyzer::Analyzer* a);
Analyzer* FindChild(analyzer::ID id) override;
Analyzer* FindChild(analyzer::Tag tag) override;
Analyzer* FindChild(zeek::Tag tag) override;
bool RemoveChildAnalyzer(analyzer::ID id) override;
// True if the connection has closed in some sense, false otherwise.

View file

@ -17,7 +17,7 @@ enum UDP_EndpointState
void UDPSessionAdapter::AddExtraAnalyzers(Connection* conn)
{
static analyzer::Tag analyzer_connsize = analyzer_mgr->GetComponentTag("CONNSIZE");
static zeek::Tag analyzer_connsize = analyzer_mgr->GetComponentTag("CONNSIZE");
if ( analyzer_mgr->IsEnabled(analyzer_connsize) )
// Add ConnSize analyzer. Needs to see packets, not stream.