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

@ -7,42 +7,37 @@
#include <Func.h>
#include <threading/Formatter.h>
namespace btest::plugin::Reporter_Hook
{
namespace btest::plugin::Reporter_Hook {
Plugin plugin;
}
}
using namespace btest::plugin::Reporter_Hook;
zeek::plugin::Configuration Plugin::Configure()
{
EnableHook(zeek::plugin::HOOK_REPORTER);
zeek::plugin::Configuration Plugin::Configure() {
EnableHook(zeek::plugin::HOOK_REPORTER);
zeek::plugin::Configuration config;
config.name = "Reporter::Hook";
config.description = "Exercise Reporter Hook";
config.version.major = 1;
config.version.minor = 0;
config.version.patch = 0;
return config;
}
zeek::plugin::Configuration config;
config.name = "Reporter::Hook";
config.description = "Exercise Reporter Hook";
config.version.major = 1;
config.version.minor = 0;
config.version.patch = 0;
return config;
}
bool Plugin::HookReporter(const std::string& prefix, const zeek::EventHandlerPtr event,
const zeek::Connection* conn, const zeek::ValPList* addl, bool location,
const zeek::detail::Location* location1,
const zeek::detail::Location* location2, bool time,
const std::string& message)
{
zeek::ODesc d;
if ( location1 )
location1->Describe(&d);
if ( location2 )
location2->Describe(&d);
bool Plugin::HookReporter(const std::string& prefix, const zeek::EventHandlerPtr event, const zeek::Connection* conn,
const zeek::ValPList* addl, bool location, const zeek::detail::Location* location1,
const zeek::detail::Location* location2, bool time, const std::string& message) {
zeek::ODesc d;
if ( location1 )
location1->Describe(&d);
if ( location2 )
location2->Describe(&d);
fprintf(stderr, " | Hook %s %s %s\n", prefix.c_str(), message.c_str(), d.Description());
fprintf(stderr, " | Hook %s %s %s\n", prefix.c_str(), message.c_str(), d.Description());
if ( message == "An Error that does not show up in the log" )
return false;
if ( message == "An Error that does not show up in the log" )
return false;
return true;
}
return true;
}

View file

@ -3,22 +3,18 @@
#include <plugin/Plugin.h>
namespace btest::plugin::Reporter_Hook
{
namespace btest::plugin::Reporter_Hook {
class Plugin : public zeek::plugin::Plugin
{
class Plugin : public zeek::plugin::Plugin {
protected:
bool HookReporter(const std::string& prefix, const zeek::EventHandlerPtr event,
const zeek::Connection* conn, const zeek::ValPList* addl, bool location,
const zeek::detail::Location* location1,
const zeek::detail::Location* location2, bool time,
const std::string& buffer) override;
bool HookReporter(const std::string& prefix, const zeek::EventHandlerPtr event, const zeek::Connection* conn,
const zeek::ValPList* addl, bool location, const zeek::detail::Location* location1,
const zeek::detail::Location* location2, bool time, const std::string& buffer) override;
// Overridden from plugin::Plugin.
zeek::plugin::Configuration Configure() override;
};
// Overridden from plugin::Plugin.
zeek::plugin::Configuration Configure() override;
};
extern Plugin plugin;
}
} // namespace btest::plugin::Reporter_Hook