125
-- discovered can't catch exceptions thrown from Lua to C++; need to
build liblua differently
+-- changed most static const char* s to #define s or static const char*
+ const s
124
-- valgrind cleanup
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "react";
+#define s_name "react"
-static const char* s_help =
- "send response to client and terminate session";
+#define s_help \
+ "send response to client and terminate session"
static THREAD_LOCAL ProfileStats reactPerfStats;
-static const char* MSG_KEY = "<>";
-static const char* MSG_PERCENT = "%";
-
-static const char* DEFAULT_HTTP =
- "HTTP/1.1 403 Forbidden\r\n"
- "Connection: close\r\n"
- "Content-Type: text/html; charset=utf-8\r\n"
- "Content-Length: %d\r\n"
- "\r\n";
-
-static const char* DEFAULT_HTML =
- "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\r\n"
- " \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\r\n"
- "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\r\n"
- "<head>\r\n"
- "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\r\n"
- "<title>Access Denied</title>\r\n"
- "</head>\r\n"
- "<body>\r\n"
- "<h1>Access Denied</h1>\r\n"
- "<p>%s</p>\r\n"
- "</body>\r\n"
- "</html>\r\n";
-
-static const char* DEFAULT_MSG =
- "You are attempting to access a forbidden site.<br />"
- "Consult your system administrator for details.";
+#define MSG_KEY "<>"
+#define MSG_PERCENT "%"
+
+#define DEFAULT_HTTP \
+ "HTTP/1.1 403 Forbidden\r\n" \
+ "Connection: close\r\n" \
+ "Content-Type: text/html; charset=utf-8\r\n" \
+ "Content-Length: %d\r\n" \
+ "\r\n"
+
+#define DEFAULT_HTML \
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\r\n" \
+ " \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\r\n" \
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\r\n" \
+ "<head>\r\n" \
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\r\n" \
+ "<title>Access Denied</title>\r\n" \
+ "</head>\r\n" \
+ "<body>\r\n" \
+ "<h1>Access Denied</h1>\r\n" \
+ "<p>%s</p>\r\n" \
+ "</body>\r\n" \
+ "</html>\r\n"
+
+#define DEFAULT_MSG \
+ "You are attempting to access a forbidden site.<br />" \
+ "Consult your system administrator for details."
struct ReactData
{
#define REJ_RST_BOTH (REJ_RST_SRC|REJ_RST_DST)
#define REJ_UNR_ALL (REJ_UNR_NET|REJ_UNR_HOST|REJ_UNR_PORT)
-static const char* s_name = "reject";
+#define s_name "reject"
-static const char* s_help =
- "terminate session with TCP reset or ICMP unreachable";
+#define s_help \
+ "terminate session with TCP reset or ICMP unreachable"
static THREAD_LOCAL ProfileStats rejPerfStats;
#include "snort_debug.h"
#include "snort.h"
-static const char* s_name = "rewrite";
+#define s_name "rewrite"
-static const char* s_help =
- "overwrite packet contents";
+#define s_help \
+ "overwrite packet contents"
// FIXIT-L ips_replace.cc should part of this lib
// FIXIT-L enforce that a rule with a replace option has a replace action
return 1;
}
-static const char* rule_type[RULE_TYPE__MAX] =
+static const char* const rule_type[RULE_TYPE__MAX] =
{
"none", "alert", "drop",
"log", "pass", "sdrop"
{ 0, nullptr }
};
-static const char* pppoe_help =
- "support for point-to-point protocol over ethernet";
+#define pppoe_help \
+ "support for point-to-point protocol over ethernet"
class PPPoEModule : public DecodeModule
{
}
#ifdef DEBUG_OPTION_TREE
-static const char *option_type_str[] =
+static const char* const option_type_str[] =
{
"RULE_OPTION_TYPE_LEAF_NODE",
"RULE_OPTION_TYPE_CONTENT",
static void PrintFastPatternInfo(OptTreeNode *otn, PatternMatchData *pmd,
const char *pattern, int pattern_length);
-static const char *pm_type_strings[PM_TYPE__MAX] =
+static const char* const pm_type_strings[PM_TYPE__MAX] =
{
"Normal Content",
"HTTP Uri content",
FileContext *context = (FileContext*)SnortAlloc(sizeof (*context));
- static const char *file_type = "MSEXE";
-
printf("Check string:");
for (i = 0; i < strlen((char*)str); i++)
printf("File type is: %s (%d)\n",file_info_from_ID(conf, type_id), type_id);
free(context);
- return ((char *)file_type);
+ return ((char *)"MSEXE");
#else
UNUSED(conf);
return NULL;
return true;
}
+#define delim " \t\n"
+
static unsigned split(const string& txt, vector<string>& strs)
{
- static const char* delim = " \t\n";
size_t last = txt.find_first_not_of(delim);
size_t pos = txt.find_first_of(delim, last);
strs.clear();
return false;
}
-static const char* pt2str[Parameter::PT_MAX] =
+static const char* const pt2str[Parameter::PT_MAX] =
{
"table", "list",
"bool", "int", "real", "port",
using namespace std;
-static const char* opt_init = "init";
+#define opt_init "init"
//-------------------------------------------------------------------------
// lua stuff
void Markup::enable(bool e)
{ enabled = e; }
+#define hn "========== "
+
const char* Markup::head(unsigned level)
{
- static const char* hn = "========== ";
unsigned max = strlen(hn);
if ( level >= max )
#define SIGNAL_SNORT_READ_ATTR_TBL SIGURG
#endif
-const char* pig_sig_names[PIG_SIG_MAX] =
+static const char* const pig_sig_names[PIG_SIG_MAX] =
{
"none", "quit", "term", "int",
"reload-config", "reload-attributes",
#include "framework/range.h"
#include "protocols/tcp.h"
-static const char* s_name = "ack";
+#define s_name "ack"
-static const char* s_help =
- "rule option to match on TCP ack numbers";
+#define s_help \
+ "rule option to match on TCP ack numbers"
static THREAD_LOCAL ProfileStats tcpAckPerfStats;
static THREAD_LOCAL ProfileStats asn1PerfStats;
-static const char* s_name = "asn1";
+#define s_name "asn1"
-static const char* s_help =
- "rule option for asn1 detection";
+#define s_help \
+ "rule option for asn1 detection"
class Asn1Option : public IpsOption
{
static THREAD_LOCAL ProfileStats base64PerfStats;
-static const char* s_name = "base64_decode";
+#define s_name "base64_decode"
-static const char* s_help =
- "rule option to decode base64 data - must be used with base64_data option";
+#define s_help \
+ "rule option to decode base64 data - must be used with base64_data option"
//-------------------------------------------------------------------------
// base64_decode
// base64_data
//-------------------------------------------------------------------------
-static const char* s_data_name = "base64_data";
-static const char* s_data_help = "set detection cursor to decoded Base64 data";
+#define s_data_name "base64_data"
+#define s_data_help "set detection cursor to decoded Base64 data"
class Base64DataOption : public IpsOption
{
#include "framework/cursor.h"
#include "framework/module.h"
-static const char* s_name = "bufferlen";
+#define s_name "bufferlen"
-static const char* s_help =
- "rule option to check length of current buffer";
+#define s_help \
+ "rule option to check length of current buffer"
static THREAD_LOCAL ProfileStats lenCheckPerfStats;
static THREAD_LOCAL ProfileStats byteExtractPerfStats;
-static const char* s_name = "byte_extract";
+#define s_name "byte_extract"
-static const char* s_help =
- "rule option to convert data to an integer variable";
+#define s_help \
+ "rule option to convert data to an integer variable"
#define MAX_BYTES_TO_GRAB 4
static THREAD_LOCAL ProfileStats byteJumpPerfStats;
-static const char* s_name = "byte_jump";
+#define s_name "byte_jump"
using namespace std;
typedef struct _ByteJumpData
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to move the detection cursor";
+#define s_help \
+ "rule option to move the detection cursor"
class ByteJumpModule : public Module
{
static THREAD_LOCAL ProfileStats byteTestPerfStats;
-static const char* s_name = "byte_test";
+#define s_name "byte_test"
#define CHECK_EQ 0
#define CHECK_NEQ 1
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to convert data to integer and compare";
+#define s_help \
+ "rule option to convert data to integer and compare"
class ByteTestModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "classtype";
+#define s_name "classtype"
//-------------------------------------------------------------------------
// module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "general rule option for rule classification";
+#define s_help \
+ "general rule option for rule classification"
class ClassTypeModule : public Module
{
#define MAX_PATTERN_SIZE 2048
-static const char* s_name = "content";
+#define s_name "content"
static THREAD_LOCAL ProfileStats contentPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "payload rule option for basic pattern matching";
+#define s_help \
+ "payload rule option for basic pattern matching"
class ContentModule : public Module
{
static THREAD_LOCAL ProfileStats cvsPerfStats;
-static const char* s_name = "cvs";
+#define s_name "cvs"
#define CVS_CONFIG_DELIMITERS " \t\n"
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "payload rule option for detecting specific attacks";
+#define s_help \
+ "payload rule option for detecting specific attacks"
class CvsModule : public Module
{
#include "filters/detection_filter.h"
#include "filters/sfthd.h"
-static const char* s_name = "detection_filter";
+#define s_name "detection_filter"
//-------------------------------------------------------------------------
// module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to require multiple hits before a rule generates an event";
+#define s_help \
+ "rule option to require multiple hits before a rule generates an event"
class DetectionFilterModule : public Module
{
#include "framework/module.h"
#include "framework/range.h"
-static const char* s_name = "dsize";
+#define s_name "dsize"
static THREAD_LOCAL ProfileStats dsizePerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to test payload size";
+#define s_help \
+ "rule option to test payload size"
class DsizeModule : public Module
{
#include "framework/ips_option.h"
#include "framework/module.h"
-static const char* s_name = "file_data";
+#define s_name "file_data"
static THREAD_LOCAL ProfileStats fileDataPerfStats;
// module
//-------------------------------------------------------------------------
-static const char* s_help =
- "rule option to set detection cursor to file data";
+#define s_help \
+ "rule option to set detection cursor to file data"
class FileDataModule : public Module
{
#define R_ECE 0x40 /* ECN echo, RFC 3168 */
#define R_CWR 0x80 /* Congestion Window Reduced, RFC 3168 */
-static const char* s_name = "flags";
+#define s_name "flags"
static THREAD_LOCAL ProfileStats tcpFlagsPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to test TCP control flags";
+#define s_help \
+ "rule option to test TCP control flags"
class FlagsModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "flow";
+#define s_name "flow"
static THREAD_LOCAL ProfileStats flowCheckPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check session properties";
+#define s_help \
+ "rule option to check session properties"
class FlowModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "flowbits";
+#define s_name "flowbits"
static THREAD_LOCAL ProfileStats flowBitsPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to set and test arbitrary boolean flags";
+#define s_help \
+ "rule option to set and test arbitrary boolean flags"
class FlowbitsModule : public Module
{
#define FB_DF 0x4000
#define FB_MF 0x2000
-static const char* s_name = "fragbits";
+#define s_name "fragbits"
static THREAD_LOCAL ProfileStats fragBitsPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to test IP frag flags";
+#define s_help \
+ "rule option to test IP frag flags"
class FragBitsModule : public Module
{
#include "framework/module.h"
#include "framework/range.h"
-static const char* s_name = "fragoffset";
+#define s_name "fragoffset"
static THREAD_LOCAL ProfileStats fragOffsetPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to test IP frag offset";
+#define s_help \
+ "rule option to test IP frag offset"
class FragOffsetModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "gid";
+#define s_name "gid"
//-------------------------------------------------------------------------
// module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option specifying rule generator";
+#define s_help \
+ "rule option specifying rule generator"
class GidModule : public Module
{
#undef IPS_OPT
#define IPS_OPT "http_uri"
-static const char* uri_help =
- "rule option to set the detection cursor to the normalized URI buffer";
+#define uri_help \
+ "rule option to set the detection cursor to the normalized URI buffer"
static THREAD_LOCAL ProfileStats uri_ps;
#undef IPS_OPT
#define IPS_OPT "http_client_body"
-static const char* cb_help =
- "rule option to set the detection cursor to the request body";
+#define cb_help \
+ "rule option to set the detection cursor to the request body"
static THREAD_LOCAL ProfileStats cb_ps;
#undef IPS_OPT
#define IPS_OPT "http_method"
-static const char* meth_help =
- "rule option to set the detection cursor to the HTTP request method";
+#define meth_help \
+ "rule option to set the detection cursor to the HTTP request method"
static THREAD_LOCAL ProfileStats meth_ps;
#undef IPS_OPT
#define IPS_OPT "http_cookie"
-static const char* cookie_help =
- "rule option to set the detection cursor to the HTTP cookie";
+#define cookie_help \
+ "rule option to set the detection cursor to the HTTP cookie"
static THREAD_LOCAL ProfileStats cookie_ps;
#undef IPS_OPT
#define IPS_OPT "http_stat_code"
-static const char* stat_code_help =
- "rule option to set the detection cursor to the HTTP status code";
+#define stat_code_help \
+ "rule option to set the detection cursor to the HTTP status code"
static THREAD_LOCAL ProfileStats stat_code_ps;
#undef IPS_OPT
#define IPS_OPT "http_stat_msg"
-static const char* stat_msg_help =
- "rule option to set the detection cursor to the HTTP status message";
+#define stat_msg_help \
+ "rule option to set the detection cursor to the HTTP status message"
static THREAD_LOCAL ProfileStats stat_msg_ps;
#undef IPS_OPT
#define IPS_OPT "http_raw_uri"
-static const char* raw_uri_help =
- "rule option to set the detection cursor to the unnormalized URI";
+#define raw_uri_help \
+ "rule option to set the detection cursor to the unnormalized URI"
static THREAD_LOCAL ProfileStats raw_uri_ps;
#undef IPS_OPT
#define IPS_OPT "http_raw_header"
-static const char* raw_header_help =
- "rule option to set the detection cursor to the unnormalized headers";
+#define raw_header_help \
+ "rule option to set the detection cursor to the unnormalized headers"
static THREAD_LOCAL ProfileStats raw_header_ps;
#undef IPS_OPT
#define IPS_OPT "http_raw_cookie"
-static const char* raw_cookie_help =
- "rule option to set the detection cursor to the unnormalized cookie";
+#define raw_cookie_help \
+ "rule option to set the detection cursor to the unnormalized cookie"
static THREAD_LOCAL ProfileStats raw_cookie_ps;
#include "framework/inspector.h"
#include "framework/module.h"
-static const char* s_name = "http_header";
+#define s_name "http_header"
static THREAD_LOCAL ProfileStats httpHeaderPerfStats;
// module
//-------------------------------------------------------------------------
-static const char* s_help =
- "rule option to set the detection cursor to the normalized header(s)";
+#define s_help \
+ "rule option to set the detection cursor to the normalized header(s)"
class HttpHeaderModule : public Module
{
#include "protocols/icmp4.h"
#include "protocols/icmp6.h"
-static const char* s_name = "icmp_id";
+#define s_name "icmp_id"
static THREAD_LOCAL ProfileStats icmpIdPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check ICMP ID";
+#define s_help \
+ "rule option to check ICMP ID"
class IcmpIdModule : public Module
{
#include "protocols/icmp4.h"
#include "protocols/icmp6.h"
-static const char* s_name = "icmp_seq";
+#define s_name "icmp_seq"
static THREAD_LOCAL ProfileStats icmpSeqPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check ICMP sequence number";
+#define s_help \
+ "rule option to check ICMP sequence number"
class IcmpSeqModule : public Module
{
#include "framework/range.h"
#include "protocols/icmp4.h"
-static const char* s_name = "icode";
+#define s_name "icode"
static THREAD_LOCAL ProfileStats icmpCodePerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check ICMP code";
+#define s_help \
+ "rule option to check ICMP code"
class IcodeModule : public Module
{
#include "framework/module.h"
#include "framework/range.h"
-static const char* s_name = "id";
+#define s_name "id"
static THREAD_LOCAL ProfileStats ipIdPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check the IP ID field";
+#define s_help \
+ "rule option to check the IP ID field"
class IpIdModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "ip_proto";
+#define s_name "ip_proto"
static THREAD_LOCAL ProfileStats ipProtoPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check the IP protocol number";
+#define s_help \
+ "rule option to check the IP protocol number"
class IpProtoModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "ipopts";
+#define s_name "ipopts"
static THREAD_LOCAL ProfileStats ipOptionPerfStats;
// module
//-------------------------------------------------------------------------
-static const char* s_opts =
- "rr|eol|nop|ts|sec|esec|lsrr|lsrre|ssrr|satid|any";
+#define s_opts \
+ "rr|eol|nop|ts|sec|esec|lsrr|lsrre|ssrr|satid|any"
static const Parameter s_params[] =
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check for IP options";
+#define s_help \
+ "rule option to check for IP options"
class IpOptModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "isdataat";
+#define s_name "isdataat"
static THREAD_LOCAL ProfileStats isDataAtPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check for the presence of payload data";
+#define s_help \
+ "rule option to check for the presence of payload data"
class IsDataAtModule : public Module
{
#include "framework/range.h"
#include "protocols/icmp4.h"
-static const char* s_name = "itype";
+#define s_name "itype"
static THREAD_LOCAL ProfileStats icmpTypePerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check ICMP type";
+#define s_help \
+ "rule option to check ICMP type"
class ItypeModule : public Module
{
static THREAD_LOCAL ProfileStats luaIpsPerfStats;
-static const char* opt_eval = "eval";
+#define opt_eval "eval"
//-------------------------------------------------------------------------
// ffi stuff
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option for detecting with Lua scripts";
+#define s_help \
+ "rule option for detecting with Lua scripts"
class LuaJitModule : public Module
{
#include "framework/module.h"
#include "parser/parse_conf.h"
-static const char* s_name = "metadata";
+#define s_name "metadata"
//-------------------------------------------------------------------------
// module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option for conveying arbitrary name, value data within the rule text";
+#define s_help \
+ "rule option for conveying arbitrary name, value data within the rule text"
class MetadataModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "msg";
+#define s_name "msg"
//-------------------------------------------------------------------------
// module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option summarizing rule purpose output with events";
+#define s_help \
+ "rule option summarizing rule purpose output with events"
class MsgModule : public Module
{
#define SNORT_PCRE_ANCHORED 0x00040
#define SNORT_OVERRIDE_MATCH_LIMIT 0x00080 // Override default limits on match & match recursion
-static const char* s_name = "pcre";
+#define s_name "pcre"
/*
* we need to specify the vector length for our pcre_exec call. we only care
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option for matching payload data with regex";
+#define s_help \
+ "rule option for matching payload data with regex"
class PcreModule : public Module
{
#include "framework/module.h"
#include "detection/detection_defines.h"
-static const char* s_name = "pkt_data";
+#define s_name "pkt_data"
static THREAD_LOCAL ProfileStats pktDataPerfStats;
// module
//-------------------------------------------------------------------------
-static const char* s_help =
- "rule option to set the detection cursor to the normalized packet data";
+#define s_help \
+ "rule option to set the detection cursor to the normalized packet data"
class PktDataModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "priority";
+#define s_name "priority"
//-------------------------------------------------------------------------
// module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option for prioritizing events";
+#define s_help \
+ "rule option for prioritizing events"
class PriorityModule : public Module
{
#include "framework/ips_option.h"
#include "framework/module.h"
-static const char* s_name = "raw_data";
+#define s_name "raw_data"
static THREAD_LOCAL ProfileStats rawDataPerfStats;
// module
//-------------------------------------------------------------------------
-static const char* s_help =
- "rule option to set the detection cursor to the raw packet data";
+#define s_help \
+ "rule option to set the detection cursor to the raw packet data"
class RawDataModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "reference";
+#define s_name "reference"
//-------------------------------------------------------------------------
// module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to indicate relevant attack indentification system";
+#define s_help \
+ "rule option to indicate relevant attack indentification system"
class ReferenceModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "rem";
+#define s_name "rem"
//-------------------------------------------------------------------------
// module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to convey an arbitrary comment in the rule body";
+#define s_help \
+ "rule option to convey an arbitrary comment in the rule body"
class RemModule : public Module
{
// replace rule option
//-------------------------------------------------------------------------
-static const char* s_name = "replace";
+#define s_name "replace"
static THREAD_LOCAL ProfileStats replacePerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to overwrite payload data; use with rewrite action";
+#define s_help \
+ "rule option to overwrite payload data; use with rewrite action"
class ReplModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "rev";
+#define s_name "rev"
//-------------------------------------------------------------------------
// module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to indicate current revision of signature";
+#define s_help \
+ "rule option to indicate current revision of signature"
class RevModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "rpc";
+#define s_name "rpc"
static THREAD_LOCAL ProfileStats rpcCheckPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check SUNRPC CALL parameters";
+#define s_help \
+ "rule option to check SUNRPC CALL parameters"
class RpcModule : public Module
{
#include "framework/range.h"
#include "protocols/tcp.h"
-static const char* s_name = "seq";
+#define s_name "seq"
static THREAD_LOCAL ProfileStats tcpSeqPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check TCP sequence number";
+#define s_help \
+ "rule option to check TCP sequence number"
class SeqModule : public Module
{
#include "framework/module.h"
#include "sfip/sf_ip.h"
-static const char* s_name = "session";
+#define s_name "session"
static THREAD_LOCAL ProfileStats sessionPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check user data from TCP sessions";
+#define s_help \
+ "rule option to check user data from TCP sessions"
class SsnModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "sid";
+#define s_name "sid"
//-------------------------------------------------------------------------
// module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to indicate signature number";
+#define s_help \
+ "rule option to indicate signature number"
class SidModule : public Module
{
#include "parser/parser.h"
#include "time/profiler.h"
-static const char* s_name = "so";
+#define s_name "so"
static THREAD_LOCAL ProfileStats soPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to call custom eval function";
+#define s_help \
+ "rule option to call custom eval function"
class SoModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "soid";
+#define s_name "soid"
//-------------------------------------------------------------------------
// module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to specify a shared object rule ID";
+#define s_help \
+ "rule option to specify a shared object rule ID"
class SoidModule : public Module
{
#include "framework/parameter.h"
#include "framework/module.h"
-static const char* s_name = "tag";
+#define s_name "tag"
//-------------------------------------------------------------------------
// module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to log additional packets";
+#define s_help \
+ "rule option to log additional packets"
class TagModule : public Module
{
#include "framework/module.h"
#include "framework/range.h"
-static const char* s_name = "tos";
+#define s_name "tos"
static THREAD_LOCAL ProfileStats ipTosPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check type of service field";
+#define s_help \
+ "rule option to check type of service field"
class TosModule : public Module
{
#include "framework/module.h"
#include "framework/range.h"
-static const char* s_name = "ttl";
+#define s_name "ttl"
static THREAD_LOCAL ProfileStats ttlCheckPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check time to live field";
+#define s_help \
+ "rule option to check time to live field"
class TtlModule : public Module
{
#include "framework/range.h"
#include "protocols/tcp.h"
-static const char* s_name = "window";
+#define s_name "window"
static THREAD_LOCAL ProfileStats tcpWinPerfStats;
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "rule option to check TCP window field";
+#define s_help \
+ "rule option to check TCP window field"
class WindowModule : public Module
{
#define BYTES_PER_FRAME 16
/* middle of packet:"41 02 43 04 45 06 47 08 49 0A 4B 0C 4D 0E 4F 0F A.C.E.G.I.K.M.O."*/
/* at end of packet:"41 02 43 04 45 06 47 08 A.C.E.G."*/
-static const char* pad3 = " ";
+#define pad3 " "
void LogNetData (TextLog* log, const uint8_t* data, const int len, Packet *p)
{
// module stuff
//-------------------------------------------------------------------------
-static const char* csv_range =
- "timestamp | gid | sid | rev | msg | proto | "
- "src_addr | dst_addr | src_port | dst_port | "
- "eth_src | eth_dst | eth_type | eth_len | "
- "ttl | tos | id | ip_len | dgm_len | "
- "icmp_type | icmp_code | icmp_id | icmp_seq"
- "tcp_flags | tcp_seq | tcp_ack | tcp_len | tcp_win | "
- "udp_len";
-
-static const char* csv_deflt =
- "timestamp gid sid rev src_addr src_port dst_addr dst_port";
+#define csv_range \
+ "timestamp | gid | sid | rev | msg | proto | " \
+ "src_addr | dst_addr | src_port | dst_port | " \
+ "eth_src | eth_dst | eth_type | eth_len | " \
+ "ttl | tos | id | ip_len | dgm_len | " \
+ "icmp_type | icmp_code | icmp_id | icmp_seq" \
+ "tcp_flags | tcp_seq | tcp_ack | tcp_len | tcp_win | " \
+ "udp_len"
+
+#define csv_deflt \
+ "timestamp gid sid rev src_addr src_port dst_addr dst_port"
static const Parameter s_params[] =
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "output event in csv format";
+#define s_help \
+ "output event in csv format"
class CsvModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "output event with brief text format";
+#define s_help \
+ "output event with brief text format"
class FastModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "output event with full packet dump";
+#define s_help \
+ "output event with full packet dump"
class FullModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "output event from custom Lua script";
+#define s_help \
+ "output event from custom Lua script"
class LuaLogModule : public Module
{
using namespace std;
typedef vector<RuleId> RuleVector;
-static const char* s_name = "alert_sfsocket";
+#define s_name "alert_sfsocket"
//-------------------------------------------------------------------------
// alert_sfsocket module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "output event over socket";
+#define s_help \
+ "output event over socket"
class SfSocketModule : public Module
{
using namespace std;
-static const char* s_name = "alert_syslog";
+#define s_name "alert_syslog"
//-------------------------------------------------------------------------
// translation stuff
//-------------------------------------------------------------------------
-static const char* syslog_facilities =
- "auth | authpriv | daemon | user | "
- "local0 | local1 | local2 | local3 | "
- "local4 | local5 | local6 | local7";
+#define syslog_facilities \
+ "auth | authpriv | daemon | user | " \
+ "local0 | local1 | local2 | local3 | " \
+ "local4 | local5 | local6 | local7"
static int get_facility(unsigned fac)
{
return 0;
}
-static const char* syslog_levels =
- "emerg | alert | crit | err | warning | notice | info | debug";
+#define syslog_levels \
+ "emerg | alert | crit | err | warning | notice | info | debug"
static int get_level(unsigned lvl)
{
return 0;
}
-static const char* syslog_options =
- "cons | ndelay | perror | pid";
+#define syslog_options \
+ "cons | ndelay | perror | pid"
static int get_options(const char* s)
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "output event to syslog";
+#define s_help \
+ "output event to syslog"
class SyslogModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "output event in custom tsv format";
+#define s_help \
+ "output event in custom tsv format"
class TestModule : public Module
{
static THREAD_LOCAL UnixSock us;
-static const char* s_name = "alert_unixsock";
+#define s_name "alert_unixsock"
//-------------------------------------------------------------------------
// alert_unixsock module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "output event over unix socket";
+#define s_help \
+ "output event over unix socket"
class UnixSockModule : public Module
{
#include "framework/module.h"
#include "snort.h"
-static const char* s_name = "log_null";
-static const char* s_help = "support for null encapsulation";
+#define s_name "log_null"
+#define s_help "support for null encapsulation"
//-------------------------------------------------------------------------
// log_null module
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "log packet in pcap format";
+#define s_help \
+ "log packet in pcap format"
class TcpdumpModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* s_help =
- "ouput event and packet in unified2 format file";
+#define s_help \
+ "ouput event and packet in unified2 format file"
class U2Module : public Module
{
#include "framework/module.h"
#include "framework/parameter.h"
-static const char* snort_help =
-"\n"
-"Snort has several options to get more help:\n"
-"\n"
-"-? list command line options (same as --help)\n"
-"--help this overview of help\n"
-"--help-commands [<module prefix>] output matching commands\n"
-"--help-config [<module prefix>] output matching config options\n"
-"--help-module <module> output description of given module\n"
-"--help-modules list all available modules with brief help\n"
-"--help-plugins list all available plugins with brief help\n"
-"--help-options [<option prefix>] output matching command line options\n"
-"--help-signals dump available control signals\n"
-"--list-buffers output available inspection buffers\n"
-"--list-builtin [<module prefix>] output matching builtin rules\n"
-"--list-gids [<module prefix>] output matching generators\n"
-"--list-modules [<module type>] list all known modules\n"
-"--list-plugins list all known modules\n"
-"--show-plugins list module and plugin versions\n"
-"\n"
-"--help* and --list* options preempt other processing so should be last on the\n"
-"command line since any following options are ignored. To ensure options like\n"
-"--markup and --plugin-path take effect, place them ahead of the help or list\n"
-"options.\n"
-"\n"
-"Options that filter output based on a matching prefix, such as --help-config\n"
-"won't output anything if there is no match. If no prefix is given, everything\n"
-"matches.\n"
-"\n"
-"Parameters are given with this format:\n"
-"\n"
-" type name = default: help { range }\n"
-"\n"
-"++ For Lua configuration (not IPS rules), if the name ends with [] it is a\n"
-" list item and can be repeated.\n"
-"++ For IPS rules only, names starting with ~ indicate positional parameters.\n"
-" The name does not appear in the rule.\n"
-"++ IPS rules may also have a wild card parameter, which is indicated by a *.\n"
-" Only used for metadata that Snort ignores.\n"
-"++ The snort module has command line options starting with a -.\n"
-"\n"
+#define snort_help \
+"\n" \
+"Snort has several options to get more help:\n" \
+"\n" \
+"-? list command line options (same as --help)\n" \
+"--help this overview of help\n" \
+"--help-commands [<module prefix>] output matching commands\n" \
+"--help-config [<module prefix>] output matching config options\n" \
+"--help-module <module> output description of given module\n" \
+"--help-modules list all available modules with brief help\n" \
+"--help-plugins list all available plugins with brief help\n" \
+"--help-options [<option prefix>] output matching command line options\n" \
+"--help-signals dump available control signals\n" \
+"--list-buffers output available inspection buffers\n" \
+"--list-builtin [<module prefix>] output matching builtin rules\n" \
+"--list-gids [<module prefix>] output matching generators\n" \
+"--list-modules [<module type>] list all known modules\n" \
+"--list-plugins list all known modules\n" \
+"--show-plugins list module and plugin versions\n" \
+"\n" \
+"--help* and --list* options preempt other processing so should be last on the\n" \
+"command line since any following options are ignored. To ensure options like\n" \
+"--markup and --plugin-path take effect, place them ahead of the help or list\n" \
+"options.\n" \
+"\n" \
+"Options that filter output based on a matching prefix, such as --help-config\n" \
+"won't output anything if there is no match. If no prefix is given, everything\n" \
+"matches.\n" \
+"\n" \
+"Parameters are given with this format:\n" \
+"\n" \
+" type name = default: help { range }\n" \
+"\n" \
+"++ For Lua configuration (not IPS rules), if the name ends with [] it is a\n" \
+" list item and can be repeated.\n" \
+"++ For IPS rules only, names starting with ~ indicate positional parameters.\n" \
+" The name does not appear in the rule.\n" \
+"++ IPS rules may also have a wild card parameter, which is indicated by a *.\n" \
+" Only used for metadata that Snort ignores.\n" \
+"++ The snort module has command line options starting with a -.\n" \
+"\n" \
"Report bugs to bugs@snort.org.\n"
-;
+
//-------------------------------------------------------------------------
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* detection_help =
- "configure general IPS rule processing parameters";
+#define detection_help \
+ "configure general IPS rule processing parameters"
class DetectionModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* event_queue_help =
- "configure event queue parameters";
+#define event_queue_help \
+ "configure event queue parameters"
class EventQueueModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* search_engine_help =
- "configure fast pattern matcher";
+#define search_engine_help \
+ "configure fast pattern matcher"
class SearchEngineModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* profile_help =
- "configure profiling of rules and/or modules (requires --enable-perf-profiling)";
+#define profile_help \
+ "configure profiling of rules and/or modules (requires --enable-perf-profiling)"
class ProfileModule : public Module
{
// FIXIT-L signature.{h,cc} has type and name confused
// the keys here make more sense
-static const char* classifications_help =
- "define rule categories with priority";
+#define classifications_help \
+ "define rule categories with priority"
static const Parameter classification_params[] =
{
// reference module
//-------------------------------------------------------------------------
-static const char* reference_help =
- "define reference systems used in rules";
+#define reference_help \
+ "define reference systems used in rules"
static const Parameter reference_params[] =
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* alerts_help =
- "configure alerts";
+#define alerts_help \
+ "configure alerts"
class AlertsModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* output_help =
- "configure general output parameters";
+#define output_help \
+ "configure general output parameters"
class OutputModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* active_help =
- "configure responses";
+#define active_help \
+ "configure responses"
class ActiveModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* packets_help =
- "configure basic packet handling";
+#define packets_help \
+ "configure basic packet handling"
class PacketsModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* daq_help =
- "configure packet acquisition interface";
+#define daq_help \
+ "configure packet acquisition interface"
class DaqModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* network_help =
- "configure basic network parameters";
+#define network_help \
+ "configure basic network parameters"
class NetworkModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* ips_help =
- "configure IPS rule processing";
+#define ips_help \
+ "configure IPS rule processing"
class IpsModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* process_help =
- "configure basic process setup";
+#define process_help \
+ "configure basic process setup"
class ProcessModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* file_id_help =
- "configure file identification";
+#define file_id_help \
+ "configure file identification"
class FileIdModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* suppress_help =
- "configure event suppressions";
+#define suppress_help \
+ "configure event suppressions"
class SuppressModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* event_filter_help =
- "configure thresholding of events";
+#define event_filter_help \
+ "configure thresholding of events"
class EventFilterModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* rate_filter_help =
- "configure rate filters (which change rule actions)";
+#define rate_filter_help \
+ "configure rate filters (which change rule actions)"
class RateFilterModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* rule_state_help =
- "enable/disable specific IPS rules";
+#define rule_state_help \
+ "enable/disable specific IPS rules"
class RuleStateModule : public Module
{
// FIXIT-L these are cloned from ip_module.cc and tcp_module.cc
-static const char* ip_policies =
- "first | linux | bsd | bsd_right |last | windows | solaris";
+#define ip_policies \
+ "first | linux | bsd | bsd_right |last | windows | solaris"
-static const char* tcp_policies =
- "first | last | bsd | linux | old-linux | windows | win-2003 | vista "
- "solaris | hpux | hpux10 | irix | macos";
+#define tcp_policies \
+ "first | last | bsd | linux | old-linux | windows | win-2003 | vista " \
+ "solaris | hpux | hpux10 | irix | macos"
static const Parameter service_params[] =
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* hosts_help =
- "configure hosts";
+#define hosts_help \
+ "configure hosts"
class HostsModule : public Module
{
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
-static const char* xxx_help =
- "configure ";
+#define xxx_help \
+ "configure "
class XXXModule : public Module
{
using namespace std;
-static const char* required = "require('snort_config'); ";
+#define required "require('snort_config'); "
//-------------------------------------------------------------------------
// helper functions
static inline const char* getProtocolName (int protocol)
{
- static const char *protocolName[] = {"TCP", "UDP", "ICMP"};
+ static const char* const protocolName[] = {"TCP", "UDP", "ICMP"};
switch (protocol)
{
case IPPROTO_TCP:
// module
//-------------------------------------------------------------------------
-static const char* s_name = "snort";
+#define s_name "snort"
-static const char* s_help =
- "command line configuration and shell commands";
+#define s_help \
+ "command line configuration and shell commands"
class SnortModule : public Module
{
using namespace std;
// FIXIT-L should be using IT_* instead or at least define once
-static const char* bind_id = "binder";
-static const char* wiz_id = "wizard";
+#define bind_id "binder"
+#define wiz_id "wizard"
//-------------------------------------------------------------------------
// list stuff
#include "parser/parser.h"
#if defined(LINUX)
-static const char* lib_ext = ".so";
+#define lib_ext ".so"
#else
-static const char* lib_ext = ".dylib";
+#define lib_ext ".dylib"
#endif
struct Symbol
// keep just one copy of rule option + args
using namespace std;
-static const char* script_ext = ".lua";
+#define script_ext ".lua"
//-------------------------------------------------------------------------
// lua api stuff
PC_MAX
} PegCounts;
-static const char* pegName[PC_MAX] = {
+static const char* const pegName[PC_MAX] = {
"ip4.trim",
"ip4.tos",
"ip4.df",
fflush(fh);
}
-static const char* iNames[PERF_COUNT_MAX] = {
+static const char* const iNames[PERF_COUNT_MAX] = {
"ip4::trim",
"ip4::tos",
"ip4::df",
//-------------------------------------------------------------------------
// order of protos and scans must match PS_* flags
-static const char* protos =
- "tcp | udp | icmp | ip | all";
+#define protos \
+ "tcp | udp | icmp | ip | all"
-static const char* scans =
- "portscan | portsweep | decoy_portscan | distributed_portscan | all";
+#define scans \
+ "portscan | portsweep | decoy_portscan | distributed_portscan | all"
static const Parameter ps_params[] =
{
};
#if 0
-static const char* toks[TT_MAX] =
+static const char* const toks[TT_MAX] =
{
"none", "punct", "string", "list", "literal"
};
#define BO_BUF_SIZE 8
#define BO_BUF_ATTACK_SIZE 1024
-static const char* s_name = "back_orifice";
+#define s_name "back_orifice"
-static const char* s_help =
- "back orifice detection";
+#define s_help \
+ "back orifice detection"
/* global keyvalue for the BoRand() function */
static THREAD_LOCAL long holdrand = 1L;
int16_t ftp_data_app_id = SFTARGET_UNKNOWN_PROTOCOL;
-static const char* client_key = "ftp_client";
-static const char* server_key = "ftp_server";
+#define client_key "ftp_client"
+#define server_key "ftp_server"
-static const char* client_help = "FTP inspector client module";
-static const char* server_help = "FTP inspector server module";
+#define client_help "FTP inspector client module"
+#define server_help "FTP inspector server module"
THREAD_LOCAL ProfileStats ftpPerfStats;
THREAD_LOCAL SimpleStats ftstats;
#include "detection/detection_util.h"
#include "protocols/tcp.h"
-static const char* s_name = "ftp_data";
+#define s_name "ftp_data"
-static const char* s_help =
- "FTP data channel handler";
+#define s_help \
+ "FTP data channel handler"
static THREAD_LOCAL ProfileStats ftpdataPerfStats;
static THREAD_LOCAL SimpleStats fdstats;
#define FTP_CLIENT "ftp_client"
#define FTP_SERVER "ftp_server"
-static const char* ftp_client_help =
- "FTP client configuration module for use with ftp_server";
+#define ftp_client_help \
+ "FTP client configuration module for use with ftp_server"
-static const char* ftp_server_help =
- "main FTP module; ftp_client should also be configured";
+#define ftp_server_help \
+ "main FTP module; ftp_client should also be configured"
//-------------------------------------------------------------------------
// client stuff
{ 0, nullptr }
};
-static const char* hi_global_help =
- "http inspector global configuration and client rules for use with http_server";
+#define hi_global_help \
+ "http inspector global configuration and client rules for use with http_server"
HttpInspectModule::HttpInspectModule() :
Module(GLOBAL_KEYWORD, hi_global_help, hi_global_params)
// http_server module
//-------------------------------------------------------------------------
-static const char* profiles = "none | all | apache | iis | iis_40 | iis_50";
+#define profiles "none | all | apache | iis | iis_40 | iis_50"
-static const char* default_methods =
- "GET POST PUT SEARCH MKCOL COPY MOVE LOCK UNLOCK NOTIFY POLL BCOPY "
- "BDELETE BMOVE LINK UNLINK OPTIONS HEAD DELETE TRACE TRACK CONNECT "
- "SOURCE SUBSCRIBE UNSUBSCRIBE PROPFIND PROPPATCH BPROPFIND BPROPPATCH "
- "RPC_CONNECT PROXY_SUCCESS BITS_POST CCM_POST SMS_POST RPC_IN_DATA "
- "RPC_OUT_DATA RPC_ECHO_DATA";
+#define default_methods \
+ "GET POST PUT SEARCH MKCOL COPY MOVE LOCK UNLOCK NOTIFY POLL BCOPY " \
+ "BDELETE BMOVE LINK UNLINK OPTIONS HEAD DELETE TRACE TRACK CONNECT " \
+ "SOURCE SUBSCRIBE UNSUBSCRIBE PROPFIND PROPPATCH BPROPFIND BPROPPATCH " \
+ "RPC_CONNECT PROXY_SUCCESS BITS_POST CCM_POST SMS_POST RPC_IN_DATA " \
+ "RPC_OUT_DATA RPC_ECHO_DATA"
// FIXIT-L refactor params to create a profile table so that user can define
// different profiles (like above) and use those. rename existing profile
{ 0, nullptr }
};
-static const char* hi_server_help =
- "http inspection and server rules; also configure http_inpsect";
+#define hi_server_help \
+ "http inspection and server rules; also configure http_inpsect"
HttpServerModule::HttpServerModule() :
Module(SERVER_KEYWORD, hi_server_help, hi_server_params)
}
-// update the defaul unicode map here
+// update the default unicode map here
// page 1252 is us english
// map is just a single string of tokens of the form
// xxxx:xx (xxxx = unicode, xx = ascii char)
-static const unsigned default_unicode_page = 1252;
-static const char* default_unicode_map =
-"0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0179:5a 017b:5a 017c:7a 0180:62 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01c0:7c 01c3:21 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 02b9:27 02ba:22 02bc:27 02c4:5e 02c8:27 02cb:60 02cd:5f 0300:60 0302:5e 0303:7e 030e:22 0331:5f 0332:5f 037e:3b 0393:47 0398:54 03a3:53 03a6:46 03a9:4f 03b1:61 03b4:64 03b5:65 03c0:70 03c3:73 03c4:74 03c6:66 04bb:68 0589:3a 066a:25 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2017:3d 2032:27 2035:60 2044:2f 2074:34 2075:35 2076:36 2077:37 2078:38 207f:6e 2080:30 2081:31 2082:32 2083:33 2084:34 2085:35 2086:36 2087:37 2088:38 2089:39 20a7:50 2102:43 2107:45 210a:67 210b:48 210c:48 210d:48 210e:68 2110:49 2111:49 2112:4c 2113:6c 2115:4e 2118:50 2119:50 211a:51 211b:52 211c:52 211d:52 2124:5a 2128:5a 212a:4b 212c:42 212d:43 212e:65 212f:65 2130:45 2131:46 2133:4d 2134:6f 2212:2d 2215:2f 2216:5c 2217:2a 221a:76 221e:38 2223:7c 2229:6e 2236:3a 223c:7e 2261:3d 2264:3d 2265:3d 2303:5e 2320:28 2321:29 2329:3c 232a:3e 2500:2d 250c:2b 2510:2b 2514:2b 2518:2b 251c:2b 252c:2d 2534:2d 253c:2b 2550:2d 2552:2b 2553:2b 2554:2b 2555:2b 2556:2b 2557:2b 2558:2b 2559:2b 255a:2b 255b:2b 255c:2b 255d:2b 2564:2d 2565:2d 2566:2d 2567:2d 2568:2d 2569:2d 256a:2b 256b:2b 256c:2b 2584:5f 2758:7c 3000:20 3008:3c 3009:3e 301a:5b 301b:5d ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e";
+#define default_unicode_page 1252
+#define default_unicode_map \
+"0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63 010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0111:64 0112:45 0113:65 0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67 011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68 0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69 0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c 0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f 014e:4f 014f:6f 0150:4f 0151:6f 0154:52 0155:72 0156:52 0157:72 0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75 016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77 0176:59 0177:79 0179:5a 017b:5a 017c:7a 0180:62 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55 01b0:75 01b6:7a 01c0:7c 01c3:21 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75 01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61 01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f 01f0:6a 0261:67 02b9:27 02ba:22 02bc:27 02c4:5e 02c8:27 02cb:60 02cd:5f 0300:60 0302:5e 0303:7e 030e:22 0331:5f 0332:5f 037e:3b 0393:47 0398:54 03a3:53 03a6:46 03a9:4f 03b1:61 03b4:64 03b5:65 03c0:70 03c3:73 03c4:74 03c6:66 04bb:68 0589:3a 066a:25 2000:20 2001:20 2002:20 2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2017:3d 2032:27 2035:60 2044:2f 2074:34 2075:35 2076:36 2077:37 2078:38 207f:6e 2080:30 2081:31 2082:32 2083:33 2084:34 2085:35 2086:36 2087:37 2088:38 2089:39 20a7:50 2102:43 2107:45 210a:67 210b:48 210c:48 210d:48 210e:68 2110:49 2111:49 2112:4c 2113:6c 2115:4e 2118:50 2119:50 211a:51 211b:52 211c:52 211d:52 2124:5a 2128:5a 212a:4b 212c:42 212d:43 212e:65 212f:65 2130:45 2131:46 2133:4d 2134:6f 2212:2d 2215:2f 2216:5c 2217:2a 221a:76 221e:38 2223:7c 2229:6e 2236:3a 223c:7e 2261:3d 2264:3d 2265:3d 2303:5e 2320:28 2321:29 2329:3c 232a:3e 2500:2d 250c:2b 2510:2b 2514:2b 2518:2b 251c:2b 252c:2d 2534:2d 253c:2b 2550:2d 2552:2b 2553:2b 2554:2b 2555:2b 2556:2b 2557:2b 2558:2b 2559:2b 255a:2b 255b:2b 255c:2b 255d:2b 2564:2d 2565:2d 2566:2d 2567:2d 2568:2d 2569:2d 256a:2b 256b:2b 256c:2b 2584:5f 2758:7c 3000:20 3008:3c 3009:3e 301a:5b 301b:5d ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29 ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33 ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48 ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52 ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66 ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70 ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a ff5b:7b ff5c:7c ff5d:7d ff5e:7e"
bool get_default_unicode_map(uint8_t*& map, int& page)
{
static THREAD_LOCAL const uint32_t rpc_memcap = 1048510;
static THREAD_LOCAL uint32_t rpc_memory = 0;
-static const char* mod_name = "rpc_decode";
-static const char* mod_help = "RPC inspector";
+#define mod_name "rpc_decode"
+#define mod_help "RPC inspector"
THREAD_LOCAL ProfileStats rpcdecodePerfStats;
THREAD_LOCAL SimpleStats rdstats;
// rpc module
//-------------------------------------------------------------------------
-static const char* s_name = "rpc_decode";
-static const char* s_help = "RPC inspector";
+#define s_name "rpc_decode"
+#define s_help "RPC inspector"
RpcDecodeModule::RpcDecodeModule() : Module(s_name, s_help, s_params)
{ }
static BaseStats g_stats;
static THREAD_LOCAL BaseStats t_stats;
-static const char* base_pegs[] =
+static const char* const base_pegs[] =
{
"tcp flows",
"udp flows",
};
-static const char* peg_names[] =
+static const char* const peg_names[] =
{
"fragments",
"reassembled",
static THREAD_LOCAL Packet** defrag_pkts; // An array of Packet pointers
/* enum for policy names */
-static const char *frag_policy_names[] =
+static const char* const frag_policy_names[] =
{
"no policy",
"FIRST",
// stream_ip module
//-------------------------------------------------------------------------
-static const char* policies =
- "first | linux | bsd | bsd_right | last | windows | solaris";
+#define policies \
+ "first | linux | bsd | bsd_right | last | windows | solaris"
static const RuleMap stream_ip_rules[] =
{
// stream_reassemble
//-------------------------------------------------------------------------
-static const char* s_name = "stream_reassemble";
-static const char* s_help =
- "detection option for stream reassembly control";
+#define s_name "stream_reassemble"
+#define s_help \
+ "detection option for stream reassembly control"
static THREAD_LOCAL ProfileStats streamReassembleRuleOptionPerfStats;
// stream_size
//-------------------------------------------------------------------------
-static const char* s_name = "stream_size";
-static const char* s_help =
- "detection option for stream size checking";
+#define s_name "stream_size"
+#define s_help \
+ "detection option for stream size checking"
static THREAD_LOCAL ProfileStats streamSizePerfStats;
#define STREAM_TCP_NO_3WHS_STR \
"TCP session without 3-way handshake"
-static const char* policies =
- "first | last | bsd | linux | old-linux | windows | win-2003 | vista | "
- "solaris | hpux | hpux10 | irix | macos";
+#define policies \
+ "first | last | bsd | linux | old-linux | windows | win-2003 | vista | " \
+ "solaris | hpux | hpux10 | irix | macos"
static const Parameter stream_tcp_small_params[] =
{
/* G L O B A L S **************************************************/
/* enum for policy names */
-static const char *reassembly_policy_names[] = {
+static const char* const reassembly_policy_names[] = {
"no policy",
"FIRST",
"LINUX",
};
#ifdef DEBUG_STREAM5
-static const char *state_names[] = {
+static const char* const state_names[] = {
"NONE",
"LISTEN",
"SYN_RCVD",
"CLOSED"
};
-static const char* flush_policy_names[] =
+static const char* const flush_policy_names[] =
{
"ignore",
"on-ack",
static PegCount gnormStats[PC_MAX];
static THREAD_LOCAL PegCount normStats[PC_MAX];
-static const char* pegName[PC_MAX] = {
+static const char* const pegName[PC_MAX] = {
"tcp::trim",
"tcp::ecn_ssn",
"tcp::ts_nop",
);
}
-static const char* statext[] = {
+static const char* const statext[] = {
"NON", "LST", "SYR", "SYS", "EST", "CLW",
"LAK", "FW1", "CLG", "FW2", "TWT", "CLD"
};
-static const char* flushxt[] = {
+static const char* const flushxt[] = {
"NON", "FPR", "LOG", "RSP", "SLW",
#if 0
"CON",
static int s_debug = 0;
-static const char* codes[] = {
+static const char* const codes[] = {
"success",
"failure",
"lesser",
#ifdef PPM_MGR
-static const char* s_name = "ppm";
-static const char* s_help =
- "packet and rule latency monitoring and control (requires --enable-ppm)";
+#define s_name "ppm"
+#define s_help \
+ "packet and rule latency monitoring and control (requires --enable-ppm)"
static const Parameter s_params[] =
{
//-------------------------------------------------------------------------
-static const char* simple_names[] =
+static const char* const simple_names[] =
{
"packets"
};
-static const char* daq_names[] =
+static const char* const daq_names[] =
{
"received",
"analyzed",
#endif
};
-const char* verdict_names[] =
+const char* const verdict_names[] =
{
"allow",
"block",
"internal whitelist"
};
-static const char* pc_names[] =
+static const char* const pc_names[] =
{
"analyzed",
"fail open",
"idle"
};
-static const char* proc_names[] =
+static const char* const proc_names[] =
{
"local commands",
"remote commands",
}
void show_stats(
- PegCount* pegs, const char* names[], unsigned n, const char* module_name)
+ PegCount* pegs, const char* const names[], unsigned n, const char* module_name)
{
bool head = false;
}
void show_percent_stats(
- PegCount* pegs, const char* names[], unsigned n, const char* module_name)
+ PegCount* pegs, const char* const names[], unsigned n, const char* module_name)
{
bool head = false;
void LogStat(const char*, double);
void sum_stats(PegCount* sums, PegCount* counts, unsigned n);
-void show_stats(PegCount*, const char* names[], unsigned n,
+void show_stats(PegCount*, const char* const names[], unsigned n,
const char* module_name = nullptr);
-void show_percent_stats(PegCount*, const char* names[], unsigned n,
+void show_percent_stats(PegCount*, const char* const names[], unsigned n,
const char* module_name = nullptr);
void sum_stats(SimpleStats* sums, SimpleStats* counts);