mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14: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
103
src/RuleAction.h
103
src/RuleAction.h
|
@ -5,102 +5,87 @@
|
|||
|
||||
#include "zeek/Tag.h"
|
||||
|
||||
namespace zeek::detail
|
||||
{
|
||||
namespace zeek::detail {
|
||||
|
||||
class Rule;
|
||||
class RuleEndpointState;
|
||||
|
||||
// Base class of all rule actions.
|
||||
class RuleAction
|
||||
{
|
||||
class RuleAction {
|
||||
public:
|
||||
RuleAction() { }
|
||||
virtual ~RuleAction() { }
|
||||
RuleAction() {}
|
||||
virtual ~RuleAction() {}
|
||||
|
||||
virtual void DoAction(const Rule* parent, RuleEndpointState* state, const u_char* data,
|
||||
int len) = 0;
|
||||
virtual void PrintDebug() = 0;
|
||||
};
|
||||
virtual void DoAction(const Rule* parent, RuleEndpointState* state, const u_char* data, int len) = 0;
|
||||
virtual void PrintDebug() = 0;
|
||||
};
|
||||
|
||||
// Implements the "event" keyword.
|
||||
class RuleActionEvent : public RuleAction
|
||||
{
|
||||
class RuleActionEvent : public RuleAction {
|
||||
public:
|
||||
explicit RuleActionEvent(const char* arg_msg);
|
||||
~RuleActionEvent() override { delete[] msg; }
|
||||
explicit RuleActionEvent(const char* arg_msg);
|
||||
~RuleActionEvent() override { delete[] msg; }
|
||||
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state, const u_char* data,
|
||||
int len) override;
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state, const u_char* data, int len) override;
|
||||
|
||||
void PrintDebug() override;
|
||||
void PrintDebug() override;
|
||||
|
||||
private:
|
||||
const char* msg;
|
||||
};
|
||||
const char* msg;
|
||||
};
|
||||
|
||||
class RuleActionMIME : public RuleAction
|
||||
{
|
||||
class RuleActionMIME : public RuleAction {
|
||||
public:
|
||||
explicit RuleActionMIME(const char* arg_mime, int arg_strength = 0);
|
||||
explicit RuleActionMIME(const char* arg_mime, int arg_strength = 0);
|
||||
|
||||
~RuleActionMIME() override { delete[] mime; }
|
||||
~RuleActionMIME() override { delete[] mime; }
|
||||
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state, const u_char* data,
|
||||
int len) override
|
||||
{
|
||||
}
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state, const u_char* data, int len) override {}
|
||||
|
||||
void PrintDebug() override;
|
||||
void PrintDebug() override;
|
||||
|
||||
std::string GetMIME() const { return mime; }
|
||||
std::string GetMIME() const { return mime; }
|
||||
|
||||
int GetStrength() const { return strength; }
|
||||
int GetStrength() const { return strength; }
|
||||
|
||||
private:
|
||||
const char* mime;
|
||||
int strength;
|
||||
};
|
||||
const char* mime;
|
||||
int strength;
|
||||
};
|
||||
|
||||
// Base class for enable/disable actions.
|
||||
class RuleActionAnalyzer : public RuleAction
|
||||
{
|
||||
class RuleActionAnalyzer : public RuleAction {
|
||||
public:
|
||||
explicit RuleActionAnalyzer(const char* analyzer);
|
||||
explicit RuleActionAnalyzer(const char* analyzer);
|
||||
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state, const u_char* data,
|
||||
int len) override = 0;
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state, const u_char* data, int len) override = 0;
|
||||
|
||||
void PrintDebug() override;
|
||||
void PrintDebug() override;
|
||||
|
||||
zeek::Tag Analyzer() const { return analyzer; }
|
||||
zeek::Tag ChildAnalyzer() const { return child_analyzer; }
|
||||
zeek::Tag Analyzer() const { return analyzer; }
|
||||
zeek::Tag ChildAnalyzer() const { return child_analyzer; }
|
||||
|
||||
private:
|
||||
zeek::Tag analyzer;
|
||||
zeek::Tag child_analyzer;
|
||||
};
|
||||
zeek::Tag analyzer;
|
||||
zeek::Tag child_analyzer;
|
||||
};
|
||||
|
||||
class RuleActionEnable : public RuleActionAnalyzer
|
||||
{
|
||||
class RuleActionEnable : public RuleActionAnalyzer {
|
||||
public:
|
||||
explicit RuleActionEnable(const char* analyzer) : RuleActionAnalyzer(analyzer) { }
|
||||
explicit RuleActionEnable(const char* analyzer) : RuleActionAnalyzer(analyzer) {}
|
||||
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state, const u_char* data,
|
||||
int len) override;
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state, const u_char* data, int len) override;
|
||||
|
||||
void PrintDebug() override;
|
||||
};
|
||||
void PrintDebug() override;
|
||||
};
|
||||
|
||||
class RuleActionDisable : public RuleActionAnalyzer
|
||||
{
|
||||
class RuleActionDisable : public RuleActionAnalyzer {
|
||||
public:
|
||||
explicit RuleActionDisable(const char* analyzer) : RuleActionAnalyzer(analyzer) { }
|
||||
explicit RuleActionDisable(const char* analyzer) : RuleActionAnalyzer(analyzer) {}
|
||||
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state, const u_char* data,
|
||||
int len) override;
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state, const u_char* data, int len) override;
|
||||
|
||||
void PrintDebug() override;
|
||||
};
|
||||
void PrintDebug() override;
|
||||
};
|
||||
|
||||
} // namespace zeek::detail
|
||||
} // namespace zeek::detail
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue