mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 21:48:21 +00:00
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:
parent
7b8e7ed72c
commit
f5a76c1aed
786 changed files with 131714 additions and 153609 deletions
|
@ -3,32 +3,26 @@
|
|||
|
||||
using namespace btest::logging::writer;
|
||||
|
||||
Foo::~Foo()
|
||||
{
|
||||
delete formatter;
|
||||
}
|
||||
Foo::~Foo() { delete formatter; }
|
||||
|
||||
bool Foo::DoInit(const zeek::logging::WriterBackend::WriterInfo& info, int num_fields,
|
||||
const zeek::threading::Field* const* fields)
|
||||
{
|
||||
desc.EnableEscaping();
|
||||
desc.AddEscapeSequence("|");
|
||||
zeek::threading::formatter::Ascii::SeparatorInfo sep_info("|", ",", "-", "");
|
||||
formatter = new zeek::threading::formatter::Ascii(this, sep_info);
|
||||
path = info.path;
|
||||
const zeek::threading::Field* const* fields) {
|
||||
desc.EnableEscaping();
|
||||
desc.AddEscapeSequence("|");
|
||||
zeek::threading::formatter::Ascii::SeparatorInfo sep_info("|", ",", "-", "");
|
||||
formatter = new zeek::threading::formatter::Ascii(this, sep_info);
|
||||
path = info.path;
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Foo::DoWrite(int num_fields, const zeek::threading::Field* const* fields,
|
||||
zeek::threading::Value** vals)
|
||||
{
|
||||
desc.Clear();
|
||||
bool Foo::DoWrite(int num_fields, const zeek::threading::Field* const* fields, zeek::threading::Value** vals) {
|
||||
desc.Clear();
|
||||
|
||||
if ( ! formatter->Describe(&desc, num_fields, fields, vals) )
|
||||
return false;
|
||||
if ( ! formatter->Describe(&desc, num_fields, fields, vals) )
|
||||
return false;
|
||||
|
||||
printf("[%s] %s\n", path.c_str(), desc.Description());
|
||||
printf("[%s] %s\n", path.c_str(), desc.Description());
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -5,39 +5,32 @@
|
|||
#include "logging/WriterBackend.h"
|
||||
#include "threading/formatters/Ascii.h"
|
||||
|
||||
namespace btest::logging::writer
|
||||
{
|
||||
namespace btest::logging::writer {
|
||||
|
||||
class Foo : public zeek::logging::WriterBackend
|
||||
{
|
||||
class Foo : public zeek::logging::WriterBackend {
|
||||
public:
|
||||
Foo(zeek::logging::WriterFrontend* frontend) : zeek::logging::WriterBackend(frontend) { }
|
||||
~Foo();
|
||||
Foo(zeek::logging::WriterFrontend* frontend) : zeek::logging::WriterBackend(frontend) {}
|
||||
~Foo();
|
||||
|
||||
static zeek::logging::WriterBackend* Instantiate(zeek::logging::WriterFrontend* frontend)
|
||||
{
|
||||
return new Foo(frontend);
|
||||
}
|
||||
static zeek::logging::WriterBackend* Instantiate(zeek::logging::WriterFrontend* frontend) {
|
||||
return new Foo(frontend);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool DoInit(const zeek::logging::WriterBackend::WriterInfo& info, int num_fields,
|
||||
const zeek::threading::Field* const* fields);
|
||||
virtual bool DoInit(const zeek::logging::WriterBackend::WriterInfo& info, int num_fields,
|
||||
const zeek::threading::Field* const* fields);
|
||||
|
||||
virtual bool DoWrite(int num_fields, const zeek::threading::Field* const* fields,
|
||||
zeek::threading::Value** vals);
|
||||
virtual bool DoSetBuf(bool enabled) { return true; }
|
||||
virtual bool DoRotate(const char* rotated_path, double open, double close, bool terminating)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
virtual bool DoFlush(double network_time) { return true; }
|
||||
virtual bool DoFinish(double network_time) { return true; }
|
||||
virtual bool DoHeartbeat(double network_time, double current_time) { return true; }
|
||||
virtual bool DoWrite(int num_fields, const zeek::threading::Field* const* fields, zeek::threading::Value** vals);
|
||||
virtual bool DoSetBuf(bool enabled) { return true; }
|
||||
virtual bool DoRotate(const char* rotated_path, double open, double close, bool terminating) { return true; }
|
||||
virtual bool DoFlush(double network_time) { return true; }
|
||||
virtual bool DoFinish(double network_time) { return true; }
|
||||
virtual bool DoHeartbeat(double network_time, double current_time) { return true; }
|
||||
|
||||
private:
|
||||
std::string path;
|
||||
zeek::ODesc desc;
|
||||
zeek::threading::Formatter* formatter;
|
||||
};
|
||||
std::string path;
|
||||
zeek::ODesc desc;
|
||||
zeek::threading::Formatter* formatter;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace btest::logging::writer
|
||||
|
|
|
@ -2,22 +2,20 @@
|
|||
|
||||
#include "Foo.h"
|
||||
|
||||
namespace btest::plugin::Demo_Foo
|
||||
{
|
||||
namespace btest::plugin::Demo_Foo {
|
||||
Plugin plugin;
|
||||
}
|
||||
}
|
||||
|
||||
using namespace btest::plugin::Demo_Foo;
|
||||
|
||||
zeek::plugin::Configuration Plugin::Configure()
|
||||
{
|
||||
AddComponent(new zeek::logging::Component("Foo", btest::logging::writer::Foo::Instantiate));
|
||||
zeek::plugin::Configuration Plugin::Configure() {
|
||||
AddComponent(new zeek::logging::Component("Foo", btest::logging::writer::Foo::Instantiate));
|
||||
|
||||
zeek::plugin::Configuration config;
|
||||
config.name = "Demo::Foo";
|
||||
config.description = "A Foo test logging writer";
|
||||
config.version.major = 1;
|
||||
config.version.minor = 0;
|
||||
config.version.patch = 0;
|
||||
return config;
|
||||
}
|
||||
zeek::plugin::Configuration config;
|
||||
config.name = "Demo::Foo";
|
||||
config.description = "A Foo test logging writer";
|
||||
config.version.major = 1;
|
||||
config.version.minor = 0;
|
||||
config.version.patch = 0;
|
||||
return config;
|
||||
}
|
||||
|
|
|
@ -3,16 +3,14 @@
|
|||
|
||||
#include <plugin/Plugin.h>
|
||||
|
||||
namespace btest::plugin::Demo_Foo
|
||||
{
|
||||
namespace btest::plugin::Demo_Foo {
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
{
|
||||
class Plugin : public zeek::plugin::Plugin {
|
||||
protected:
|
||||
// Overridden from plugin::Plugin.
|
||||
virtual zeek::plugin::Configuration Configure();
|
||||
};
|
||||
// Overridden from plugin::Plugin.
|
||||
virtual zeek::plugin::Configuration Configure();
|
||||
};
|
||||
|
||||
extern Plugin plugin;
|
||||
|
||||
}
|
||||
} // namespace btest::plugin::Demo_Foo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue