mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +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
|
@ -8,57 +8,46 @@
|
|||
using namespace btest::analyzer::FOO;
|
||||
using namespace zeek::analyzer;
|
||||
|
||||
FOO_Analyzer::FOO_Analyzer(zeek::Connection* c) : tcp::TCP_ApplicationAnalyzer("FOO", c)
|
||||
{
|
||||
interp = new binpac::FOO::FOO_Conn(this);
|
||||
had_gap = false;
|
||||
}
|
||||
FOO_Analyzer::FOO_Analyzer(zeek::Connection* c) : tcp::TCP_ApplicationAnalyzer("FOO", c) {
|
||||
interp = new binpac::FOO::FOO_Conn(this);
|
||||
had_gap = false;
|
||||
}
|
||||
|
||||
FOO_Analyzer::~FOO_Analyzer()
|
||||
{
|
||||
delete interp;
|
||||
}
|
||||
FOO_Analyzer::~FOO_Analyzer() { delete interp; }
|
||||
|
||||
void FOO_Analyzer::Done()
|
||||
{
|
||||
tcp::TCP_ApplicationAnalyzer::Done();
|
||||
void FOO_Analyzer::Done() {
|
||||
tcp::TCP_ApplicationAnalyzer::Done();
|
||||
|
||||
interp->FlowEOF(true);
|
||||
interp->FlowEOF(false);
|
||||
}
|
||||
interp->FlowEOF(true);
|
||||
interp->FlowEOF(false);
|
||||
}
|
||||
|
||||
void FOO_Analyzer::EndpointEOF(bool is_orig)
|
||||
{
|
||||
tcp::TCP_ApplicationAnalyzer::EndpointEOF(is_orig);
|
||||
interp->FlowEOF(is_orig);
|
||||
}
|
||||
void FOO_Analyzer::EndpointEOF(bool is_orig) {
|
||||
tcp::TCP_ApplicationAnalyzer::EndpointEOF(is_orig);
|
||||
interp->FlowEOF(is_orig);
|
||||
}
|
||||
|
||||
void FOO_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
|
||||
{
|
||||
tcp::TCP_ApplicationAnalyzer::DeliverStream(len, data, orig);
|
||||
void FOO_Analyzer::DeliverStream(int len, const u_char* data, bool orig) {
|
||||
tcp::TCP_ApplicationAnalyzer::DeliverStream(len, data, orig);
|
||||
|
||||
if ( TCP() && TCP()->IsPartial() )
|
||||
return;
|
||||
if ( TCP() && TCP()->IsPartial() )
|
||||
return;
|
||||
|
||||
if ( had_gap )
|
||||
// If only one side had a content gap, we could still try to
|
||||
// deliver data to the other side if the script layer can handle this.
|
||||
return;
|
||||
if ( had_gap )
|
||||
// If only one side had a content gap, we could still try to
|
||||
// deliver data to the other side if the script layer can handle this.
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
interp->NewData(orig, data, data + len);
|
||||
}
|
||||
catch ( const binpac::Exception& e )
|
||||
{
|
||||
printf("Exception: %s\n", e.c_msg());
|
||||
AnalyzerViolation(zeek::util::fmt("Binpac exception: %s", e.c_msg()));
|
||||
}
|
||||
}
|
||||
try {
|
||||
interp->NewData(orig, data, data + len);
|
||||
} catch ( const binpac::Exception& e ) {
|
||||
printf("Exception: %s\n", e.c_msg());
|
||||
AnalyzerViolation(zeek::util::fmt("Binpac exception: %s", e.c_msg()));
|
||||
}
|
||||
}
|
||||
|
||||
void FOO_Analyzer::Undelivered(uint64_t seq, int len, bool orig)
|
||||
{
|
||||
tcp::TCP_ApplicationAnalyzer::Undelivered(seq, len, orig);
|
||||
had_gap = true;
|
||||
interp->NewGap(orig, len);
|
||||
}
|
||||
void FOO_Analyzer::Undelivered(uint64_t seq, int len, bool orig) {
|
||||
tcp::TCP_ApplicationAnalyzer::Undelivered(seq, len, orig);
|
||||
had_gap = true;
|
||||
interp->NewGap(orig, len);
|
||||
}
|
||||
|
|
|
@ -6,34 +6,29 @@
|
|||
#include "foo.bif.h"
|
||||
#include "foo_pac.h"
|
||||
|
||||
namespace btest::analyzer::FOO
|
||||
{
|
||||
namespace btest::analyzer::FOO {
|
||||
|
||||
class FOO_Analyzer : public zeek::analyzer::tcp::TCP_ApplicationAnalyzer
|
||||
{
|
||||
class FOO_Analyzer : public zeek::analyzer::tcp::TCP_ApplicationAnalyzer {
|
||||
public:
|
||||
FOO_Analyzer(zeek::Connection* conn);
|
||||
virtual ~FOO_Analyzer();
|
||||
FOO_Analyzer(zeek::Connection* conn);
|
||||
virtual ~FOO_Analyzer();
|
||||
|
||||
// Overridden from Analyzer.
|
||||
virtual void Done();
|
||||
// Overridden from Analyzer.
|
||||
virtual void Done();
|
||||
|
||||
virtual void DeliverStream(int len, const u_char* data, bool orig);
|
||||
virtual void Undelivered(uint64_t seq, int len, bool orig);
|
||||
virtual void DeliverStream(int len, const u_char* data, bool orig);
|
||||
virtual void Undelivered(uint64_t seq, int len, bool orig);
|
||||
|
||||
// Overridden from tcp::TCP_ApplicationAnalyzer.
|
||||
virtual void EndpointEOF(bool is_orig);
|
||||
// Overridden from tcp::TCP_ApplicationAnalyzer.
|
||||
virtual void EndpointEOF(bool is_orig);
|
||||
|
||||
static zeek::analyzer::Analyzer* InstantiateAnalyzer(zeek::Connection* conn)
|
||||
{
|
||||
return new FOO_Analyzer(conn);
|
||||
}
|
||||
static zeek::analyzer::Analyzer* InstantiateAnalyzer(zeek::Connection* conn) { return new FOO_Analyzer(conn); }
|
||||
|
||||
protected:
|
||||
binpac::FOO::FOO_Conn* interp;
|
||||
bool had_gap;
|
||||
};
|
||||
binpac::FOO::FOO_Conn* interp;
|
||||
bool had_gap;
|
||||
};
|
||||
|
||||
} // namespace btest::analyzer::FOO
|
||||
} // namespace btest::analyzer::FOO
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,24 +3,20 @@
|
|||
#include "FOO.h"
|
||||
#include "analyzer/Component.h"
|
||||
|
||||
namespace btest::plugin::Foo_FOO
|
||||
{
|
||||
namespace btest::plugin::Foo_FOO {
|
||||
|
||||
class Plugin : public zeek::plugin::Plugin
|
||||
{
|
||||
class Plugin : public zeek::plugin::Plugin {
|
||||
public:
|
||||
zeek::plugin::Configuration Configure()
|
||||
{
|
||||
AddComponent(new zeek::analyzer::Component(
|
||||
"FOO", btest::analyzer::FOO::FOO_Analyzer::InstantiateAnalyzer));
|
||||
zeek::plugin::Configuration Configure() {
|
||||
AddComponent(new zeek::analyzer::Component("FOO", btest::analyzer::FOO::FOO_Analyzer::InstantiateAnalyzer));
|
||||
|
||||
zeek::plugin::Configuration config;
|
||||
config.name = "FOO::Foo";
|
||||
config.description = "Foo Analyzer analyzer";
|
||||
config.version.major = 1;
|
||||
config.version.minor = 0;
|
||||
return config;
|
||||
}
|
||||
} plugin;
|
||||
zeek::plugin::Configuration config;
|
||||
config.name = "FOO::Foo";
|
||||
config.description = "Foo Analyzer analyzer";
|
||||
config.version.major = 1;
|
||||
config.version.minor = 0;
|
||||
return config;
|
||||
}
|
||||
} plugin;
|
||||
|
||||
}
|
||||
} // namespace btest::plugin::Foo_FOO
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue