mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 13: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
|
@ -6,99 +6,92 @@
|
|||
#include "zeek/analyzer/protocol/tcp/ContentLine.h"
|
||||
#include "zeek/analyzer/protocol/tcp/TCP.h"
|
||||
|
||||
namespace zeek::analyzer
|
||||
{
|
||||
namespace zeek::analyzer {
|
||||
|
||||
namespace irc
|
||||
{
|
||||
namespace irc {
|
||||
|
||||
/**
|
||||
* \brief Main class for analyzing IRC traffic.
|
||||
*/
|
||||
class IRC_Analyzer final : public analyzer::tcp::TCP_ApplicationAnalyzer
|
||||
{
|
||||
enum
|
||||
{
|
||||
WAIT_FOR_REGISTRATION,
|
||||
REGISTERED,
|
||||
};
|
||||
enum
|
||||
{
|
||||
NO_ZIP,
|
||||
ACCEPT_ZIP,
|
||||
ZIP_LOADED,
|
||||
};
|
||||
class IRC_Analyzer final : public analyzer::tcp::TCP_ApplicationAnalyzer {
|
||||
enum {
|
||||
WAIT_FOR_REGISTRATION,
|
||||
REGISTERED,
|
||||
};
|
||||
enum {
|
||||
NO_ZIP,
|
||||
ACCEPT_ZIP,
|
||||
ZIP_LOADED,
|
||||
};
|
||||
|
||||
public:
|
||||
/**
|
||||
* \brief Constructor, builds a new analyzer object.
|
||||
*/
|
||||
explicit IRC_Analyzer(Connection* conn);
|
||||
/**
|
||||
* \brief Constructor, builds a new analyzer object.
|
||||
*/
|
||||
explicit IRC_Analyzer(Connection* conn);
|
||||
|
||||
/**
|
||||
* \brief Called when connection is closed.
|
||||
*/
|
||||
void Done() override;
|
||||
/**
|
||||
* \brief Called when connection is closed.
|
||||
*/
|
||||
void Done() override;
|
||||
|
||||
/**
|
||||
* \brief New input line in network stream.
|
||||
*
|
||||
* \param len the line length
|
||||
* \param data pointer to line start
|
||||
* \param orig was this data sent from connection originator?
|
||||
*/
|
||||
void DeliverStream(int len, const u_char* data, bool orig) override;
|
||||
/**
|
||||
* \brief New input line in network stream.
|
||||
*
|
||||
* \param len the line length
|
||||
* \param data pointer to line start
|
||||
* \param orig was this data sent from connection originator?
|
||||
*/
|
||||
void DeliverStream(int len, const u_char* data, bool orig) override;
|
||||
|
||||
static analyzer::Analyzer* Instantiate(Connection* conn) { return new IRC_Analyzer(conn); }
|
||||
static analyzer::Analyzer* Instantiate(Connection* conn) { return new IRC_Analyzer(conn); }
|
||||
|
||||
protected:
|
||||
int orig_status;
|
||||
int orig_zip_status;
|
||||
int resp_status;
|
||||
int resp_zip_status;
|
||||
int orig_status;
|
||||
int orig_zip_status;
|
||||
int resp_status;
|
||||
int resp_zip_status;
|
||||
|
||||
private:
|
||||
void StartTLS();
|
||||
void StartTLS();
|
||||
|
||||
inline void SkipLeadingWhitespace(std::string& str);
|
||||
inline void SkipLeadingWhitespace(std::string& str);
|
||||
|
||||
/** \brief counts number of invalid IRC messages */
|
||||
int invalid_msg_count;
|
||||
/** \brief counts number of invalid IRC messages */
|
||||
int invalid_msg_count;
|
||||
|
||||
/** \brief maximum count of invalid IRC messages */
|
||||
int invalid_msg_max_count;
|
||||
/** \brief maximum count of invalid IRC messages */
|
||||
int invalid_msg_max_count;
|
||||
|
||||
/**
|
||||
* \brief Splits a string into its words which are separated by
|
||||
* the split character.
|
||||
*
|
||||
* \param input string which will be split
|
||||
* \param split character which separates the words
|
||||
* \return vector containing words
|
||||
*/
|
||||
std::vector<std::string> SplitWords(const std::string& input, char split);
|
||||
/**
|
||||
* \brief Splits a string into its words which are separated by
|
||||
* the split character.
|
||||
*
|
||||
* \param input string which will be split
|
||||
* \param split character which separates the words
|
||||
* \return vector containing words
|
||||
*/
|
||||
std::vector<std::string> SplitWords(const std::string& input, char split);
|
||||
|
||||
analyzer::tcp::ContentLine_Analyzer* cl_orig;
|
||||
analyzer::tcp::ContentLine_Analyzer* cl_resp;
|
||||
bool starttls; // if true, connection has been upgraded to tls
|
||||
};
|
||||
analyzer::tcp::ContentLine_Analyzer* cl_orig;
|
||||
analyzer::tcp::ContentLine_Analyzer* cl_resp;
|
||||
bool starttls; // if true, connection has been upgraded to tls
|
||||
};
|
||||
|
||||
} // namespace irc
|
||||
} // namespace irc
|
||||
|
||||
namespace file
|
||||
{
|
||||
namespace file {
|
||||
|
||||
class IRC_Data : public analyzer::file::File_Analyzer
|
||||
{
|
||||
class IRC_Data : public analyzer::file::File_Analyzer {
|
||||
public:
|
||||
explicit IRC_Data(Connection* conn) : analyzer::file::File_Analyzer("IRC_Data", conn) { }
|
||||
explicit IRC_Data(Connection* conn) : analyzer::file::File_Analyzer("IRC_Data", conn) {}
|
||||
|
||||
void DeliverStream(int len, const u_char* data, bool orig) override;
|
||||
void DeliverStream(int len, const u_char* data, bool orig) override;
|
||||
|
||||
void Undelivered(uint64_t seq, int len, bool orig) override;
|
||||
void Undelivered(uint64_t seq, int len, bool orig) override;
|
||||
|
||||
static Analyzer* Instantiate(Connection* conn) { return new IRC_Data(conn); }
|
||||
};
|
||||
}
|
||||
static Analyzer* Instantiate(Connection* conn) { return new IRC_Data(conn); }
|
||||
};
|
||||
} // namespace file
|
||||
|
||||
} // namespace zeek::analyzer
|
||||
} // namespace zeek::analyzer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue