mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Run clang-format on all of our plugin test c++ files
This commit is contained in:
parent
b59bfe5558
commit
dc65b6248c
29 changed files with 400 additions and 336 deletions
|
@ -1,15 +1,14 @@
|
|||
#include "LLCDemo.h"
|
||||
|
||||
#include "zeek/Event.h"
|
||||
#include "zeek/Val.h"
|
||||
#include "zeek/session/Manager.h"
|
||||
|
||||
#include "events.bif.h"
|
||||
|
||||
using namespace zeek::packet_analysis::PacketDemo;
|
||||
|
||||
LLCDemo::LLCDemo()
|
||||
: zeek::packet_analysis::Analyzer("LLC_Demo")
|
||||
{
|
||||
}
|
||||
LLCDemo::LLCDemo() : zeek::packet_analysis::Analyzer("LLC_Demo") { }
|
||||
|
||||
bool LLCDemo::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet)
|
||||
{
|
||||
|
@ -24,10 +23,8 @@ bool LLCDemo::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet)
|
|||
auto ssap = data[15];
|
||||
auto control = data[16];
|
||||
|
||||
event_mgr.Enqueue(llc_demo_message,
|
||||
val_mgr->Count(dsap),
|
||||
val_mgr->Count(ssap),
|
||||
val_mgr->Count(control));
|
||||
event_mgr.Enqueue(llc_demo_message, val_mgr->Count(dsap), val_mgr->Count(ssap),
|
||||
val_mgr->Count(control));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
#include "Plugin.h"
|
||||
|
||||
#include "LLCDemo.h"
|
||||
#include "RawLayer.h"
|
||||
#include "packet_analysis/Component.h"
|
||||
|
||||
#include "RawLayer.h"
|
||||
#include "LLCDemo.h"
|
||||
namespace zeek::plugin::PacketDemo_Bar
|
||||
{
|
||||
|
||||
namespace zeek::plugin::PacketDemo_Bar {
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin {
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
{
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
{
|
||||
AddComponent(new zeek::packet_analysis::Component("Raw_Layer",
|
||||
zeek::packet_analysis::PacketDemo::RawLayer::Instantiate));
|
||||
AddComponent(new zeek::packet_analysis::Component("LLC_Demo",
|
||||
zeek::packet_analysis::PacketDemo::LLCDemo::Instantiate));
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"Raw_Layer", zeek::packet_analysis::PacketDemo::RawLayer::Instantiate));
|
||||
AddComponent(new zeek::packet_analysis::Component(
|
||||
"LLC_Demo", zeek::packet_analysis::PacketDemo::LLCDemo::Instantiate));
|
||||
|
||||
zeek::plugin::Configuration config;
|
||||
config.name = "PacketDemo::Bar";
|
||||
|
@ -24,6 +26,6 @@ public:
|
|||
return config;
|
||||
}
|
||||
|
||||
} plugin;
|
||||
} plugin;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "RawLayer.h"
|
||||
|
||||
#include "zeek/Event.h"
|
||||
#include "zeek/Val.h"
|
||||
#include "zeek/session/Manager.h"
|
||||
|
@ -7,10 +8,7 @@
|
|||
|
||||
using namespace zeek::packet_analysis::PacketDemo;
|
||||
|
||||
RawLayer::RawLayer()
|
||||
: zeek::packet_analysis::Analyzer("Raw_Layer")
|
||||
{
|
||||
}
|
||||
RawLayer::RawLayer() : zeek::packet_analysis::Analyzer("Raw_Layer") { }
|
||||
|
||||
bool RawLayer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet)
|
||||
{
|
||||
|
@ -21,11 +19,11 @@ bool RawLayer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet)
|
|||
return false;
|
||||
}
|
||||
|
||||
uint16_t protocol = ntohs(*((const uint16_t*)(data + layer_size -2)));
|
||||
uint16_t protocol = ntohs(*((const uint16_t*)(data + layer_size - 2)));
|
||||
|
||||
event_mgr.Enqueue(raw_layer_message,
|
||||
make_intrusive<StringVal>(layer_size, reinterpret_cast<const char*>(data)),
|
||||
val_mgr->Count(protocol));
|
||||
make_intrusive<StringVal>(layer_size, reinterpret_cast<const char*>(data)),
|
||||
val_mgr->Count(protocol));
|
||||
|
||||
return ForwardPacket(len - layer_size, data + layer_size, packet, protocol);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue