mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28: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
|
@ -1,69 +1,60 @@
|
|||
|
||||
#include "Plugin.h"
|
||||
|
||||
namespace zeek::run_state
|
||||
{
|
||||
namespace zeek::run_state {
|
||||
extern double processing_start_time;
|
||||
}
|
||||
}
|
||||
|
||||
namespace btest::plugin::Demo_Iosource
|
||||
{
|
||||
namespace btest::plugin::Demo_Iosource {
|
||||
Plugin plugin;
|
||||
}
|
||||
}
|
||||
|
||||
using namespace btest::plugin::Demo_Iosource;
|
||||
|
||||
zeek::plugin::Configuration Plugin::Configure()
|
||||
{
|
||||
EnableHook(zeek::plugin::HOOK_DRAIN_EVENTS, 0);
|
||||
zeek::plugin::Configuration Plugin::Configure() {
|
||||
EnableHook(zeek::plugin::HOOK_DRAIN_EVENTS, 0);
|
||||
|
||||
zeek::plugin::Configuration config;
|
||||
config.name = "Demo::Iosource";
|
||||
config.description = "This is a iosource";
|
||||
config.version.major = 1;
|
||||
config.version.minor = 0;
|
||||
config.version.patch = 0;
|
||||
return config;
|
||||
}
|
||||
zeek::plugin::Configuration config;
|
||||
config.name = "Demo::Iosource";
|
||||
config.description = "This is a iosource";
|
||||
config.version.major = 1;
|
||||
config.version.minor = 0;
|
||||
config.version.patch = 0;
|
||||
return config;
|
||||
}
|
||||
|
||||
void Plugin::InitPostScript()
|
||||
{
|
||||
std::fprintf(stdout, "%.6f InitPostScript\n", zeek::run_state::network_time);
|
||||
ts1 = new TimeoutSource("timeout-source-1");
|
||||
ts2 = new TimeoutSource("timeout-source-2");
|
||||
fd1 = new FdSource("fd-source-1");
|
||||
fd2 = new FdSource("fd-source-2");
|
||||
}
|
||||
void Plugin::InitPostScript() {
|
||||
std::fprintf(stdout, "%.6f InitPostScript\n", zeek::run_state::network_time);
|
||||
ts1 = new TimeoutSource("timeout-source-1");
|
||||
ts2 = new TimeoutSource("timeout-source-2");
|
||||
fd1 = new FdSource("fd-source-1");
|
||||
fd2 = new FdSource("fd-source-2");
|
||||
}
|
||||
|
||||
void Plugin::HookDrainEvents()
|
||||
{
|
||||
++round;
|
||||
if ( zeek::run_state::processing_start_time != 0.0 ) // ignore drains from dispatch_packet
|
||||
return;
|
||||
//
|
||||
std::fprintf(stdout, "%.6f HookDrainEvents %d\n", zeek::run_state::network_time, round);
|
||||
void Plugin::HookDrainEvents() {
|
||||
++round;
|
||||
if ( zeek::run_state::processing_start_time != 0.0 ) // ignore drains from dispatch_packet
|
||||
return;
|
||||
//
|
||||
std::fprintf(stdout, "%.6f HookDrainEvents %d\n", zeek::run_state::network_time, round);
|
||||
|
||||
if ( (round % 9) == 0 )
|
||||
{
|
||||
std::fprintf(stdout, "%.6f Firing %s\n", zeek::run_state::network_time, ts1->Tag());
|
||||
ts1->Fire();
|
||||
}
|
||||
if ( (round % 9) == 0 ) {
|
||||
std::fprintf(stdout, "%.6f Firing %s\n", zeek::run_state::network_time, ts1->Tag());
|
||||
ts1->Fire();
|
||||
}
|
||||
|
||||
if ( (round % 19) == 0 )
|
||||
{
|
||||
std::fprintf(stdout, "%.6f Firing %s\n", zeek::run_state::network_time, ts2->Tag());
|
||||
ts2->Fire();
|
||||
}
|
||||
if ( (round % 19) == 0 ) {
|
||||
std::fprintf(stdout, "%.6f Firing %s\n", zeek::run_state::network_time, ts2->Tag());
|
||||
ts2->Fire();
|
||||
}
|
||||
|
||||
if ( (round % 19) == 0 )
|
||||
{
|
||||
std::fprintf(stdout, "%.6f Firing %s\n", zeek::run_state::network_time, fd1->Tag());
|
||||
fd1->Fire();
|
||||
}
|
||||
if ( (round % 19) == 0 ) {
|
||||
std::fprintf(stdout, "%.6f Firing %s\n", zeek::run_state::network_time, fd1->Tag());
|
||||
fd1->Fire();
|
||||
}
|
||||
|
||||
if ( (round % 23) == 0 )
|
||||
{
|
||||
std::fprintf(stdout, "%.6f Firing %s\n", zeek::run_state::network_time, fd2->Tag());
|
||||
fd2->Fire();
|
||||
}
|
||||
}
|
||||
if ( (round % 23) == 0 ) {
|
||||
std::fprintf(stdout, "%.6f Firing %s\n", zeek::run_state::network_time, fd2->Tag());
|
||||
fd2->Fire();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue