mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 23:28:20 +00:00
Make default packet analyzer definition explicit.
This commit is contained in:
parent
8f951574d7
commit
efa262a229
15 changed files with 64 additions and 31 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "Analyzer.h"
|
||||
|
||||
#include "Dict.h"
|
||||
#include "DebugLogger.h"
|
||||
|
||||
namespace zeek::packet_analysis {
|
||||
|
@ -26,6 +27,26 @@ void Analyzer::Init(const Tag& _tag)
|
|||
tag = _tag;
|
||||
}
|
||||
|
||||
void Analyzer::Initialize()
|
||||
{
|
||||
std::string ns = util::fmt("PacketAnalyzer::%s::", GetAnalyzerName());
|
||||
|
||||
default_analyzer = LoadAnalyzer(ns +"default_analyzer");
|
||||
}
|
||||
|
||||
zeek::packet_analysis::AnalyzerPtr Analyzer::LoadAnalyzer(const std::string &name)
|
||||
{
|
||||
auto& analyzer = zeek::id::find(name);
|
||||
if ( ! analyzer )
|
||||
return nullptr;
|
||||
|
||||
auto& analyzer_val = analyzer->GetVal();
|
||||
if ( ! analyzer_val )
|
||||
return nullptr;
|
||||
|
||||
return packet_mgr->GetAnalyzer(analyzer_val->AsEnumVal());
|
||||
}
|
||||
|
||||
const Tag Analyzer::GetAnalyzerTag() const
|
||||
{
|
||||
assert(tag);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue