Reformat Zeek in Spicy style

This largely copies over Spicy's `.clang-format` configuration file. The
one place where we deviate is header include order since Zeek depends on
headers being included in a certain order.
This commit is contained in:
Benjamin Bannier 2023-10-10 21:13:34 +02:00
parent 7b8e7ed72c
commit f5a76c1aed
786 changed files with 131714 additions and 153609 deletions

View file

@ -8,37 +8,30 @@
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;
}
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::Initialize() {
InitializeTag();
packet_mgr->RegisterComponent(this, "ANALYZER_");
}
void Component::SetEnabled(bool arg_enabled)
{
enabled = arg_enabled;
void Component::SetEnabled(bool arg_enabled) {
enabled = arg_enabled;
// If we already have instantiated an analyzer, update its state.
if ( auto analyzer = packet_mgr->GetAnalyzer(Tag().AsVal().get()) )
analyzer->SetEnabled(enabled);
}
// If we already have instantiated an analyzer, update its state.
if ( auto analyzer = packet_mgr->GetAnalyzer(Tag().AsVal().get()) )
analyzer->SetEnabled(enabled);
}
void Component::DoDescribe(ODesc* d) const
{
if ( factory )
{
d->Add("ANALYZER_");
d->Add(CanonicalName());
d->Add(", ");
}
void Component::DoDescribe(ODesc* d) const {
if ( factory ) {
d->Add("ANALYZER_");
d->Add(CanonicalName());
d->Add(", ");
}
d->Add(enabled ? "enabled" : "disabled");
}
d->Add(enabled ? "enabled" : "disabled");
}