zeek/src/packet_analysis/Component.cc
Tim Wojtulewicz 7d66f4252f Unify plugin::Component and plugin::TaggedComponent into a single class
These two are almost always used in conjunction with each other, and
TaggedComponent is never used by itself. Combining them together into
a single class will help simplify some of the code around managing
the mapping between Tags and Components.
2021-11-23 19:36:49 -07:00

31 lines
738 B
C++

// See the file "COPYING" in the main distribution directory for copyright.
#include "zeek/packet_analysis/Component.h"
#include "zeek/Desc.h"
#include "zeek/packet_analysis/Manager.h"
using namespace zeek::packet_analysis;
Component::Component(const std::string& name, factory_callback arg_factory,
Tag::subtype_t arg_subtype)
: plugin::Component(plugin::component::PACKET_ANALYZER, name, arg_subtype,
packet_mgr->GetTagType())
{
factory = arg_factory;
}
void Component::Initialize()
{
InitializeTag();
packet_mgr->RegisterComponent(this, "ANALYZER_");
}
void Component::DoDescribe(ODesc* d) const
{
if ( factory )
{
d->Add("ANALYZER_");
d->Add(CanonicalName());
}
}