mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 23:28:20 +00:00
Further simplified the packet analysis API.
This is still WIP and includes the following changes: * Dispatchers are now part of analyzers (moving dispatching logic from the manager to the analyzers) * All available analyzers are instantiated on start up * Removal of configuration class
This commit is contained in:
parent
9feda100b9
commit
d4ff5a236c
12 changed files with 104 additions and 340 deletions
|
@ -1,6 +1,5 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#include <algorithm>
|
||||
#include "Analyzer.h"
|
||||
|
||||
namespace zeek::packet_analysis {
|
||||
|
@ -20,7 +19,6 @@ Analyzer::Analyzer(const Tag& tag)
|
|||
Init(tag);
|
||||
}
|
||||
|
||||
/* PRIVATE */
|
||||
void Analyzer::Init(const Tag& _tag)
|
||||
{
|
||||
tag = _tag;
|
||||
|
@ -41,13 +39,18 @@ const char* Analyzer::GetAnalyzerName() const
|
|||
bool Analyzer::IsAnalyzer(const char* name)
|
||||
{
|
||||
assert(tag);
|
||||
return packet_mgr->GetComponentName(tag).compare(name) == 0;
|
||||
return packet_mgr->GetComponentName(tag) == name;
|
||||
}
|
||||
|
||||
bool Analyzer::RegisterAnalyzerMapping(uint32_t identifier, AnalyzerPtr analyzer)
|
||||
{
|
||||
return dispatcher.Register(identifier, std::move(analyzer));
|
||||
}
|
||||
|
||||
AnalyzerResult Analyzer::AnalyzeInnerPacket(Packet* packet,
|
||||
const uint8_t*& data, uint32_t identifier) const
|
||||
{
|
||||
auto inner_analyzer = packet_mgr->Dispatch(identifier);
|
||||
auto inner_analyzer = dispatcher.Lookup(identifier);
|
||||
|
||||
if ( inner_analyzer == nullptr )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue