From: Russ Combs Date: Sun, 12 Oct 2014 00:00:33 +0000 (-0400) Subject: cleanup static const char* X-Git-Tag: 3.0.0-233~1384^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1950cbb09a3e0fa717ff621ad8067a033272f161;p=thirdparty%2Fsnort3.git cleanup static const char* --- diff --git a/ChangeLog b/ChangeLog index c1d43f6d2..b8cfe0afd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 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 diff --git a/src/actions/act_react.cc b/src/actions/act_react.cc index 399e78bc3..9f9d2d338 100644 --- a/src/actions/act_react.cc +++ b/src/actions/act_react.cc @@ -63,40 +63,40 @@ #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 = - "\r\n" - "\r\n" - "\r\n" - "\r\n" - "Access Denied\r\n" - "\r\n" - "\r\n" - "

Access Denied

\r\n" - "

%s

\r\n" - "\r\n" - "\r\n"; - -static const char* DEFAULT_MSG = - "You are attempting to access a forbidden site.
" - "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 \ + "\r\n" \ + "\r\n" \ + "\r\n" \ + "\r\n" \ + "Access Denied\r\n" \ + "\r\n" \ + "\r\n" \ + "

Access Denied

\r\n" \ + "

%s

\r\n" \ + "\r\n" \ + "\r\n" + +#define DEFAULT_MSG \ + "You are attempting to access a forbidden site.
" \ + "Consult your system administrator for details." struct ReactData { diff --git a/src/actions/act_reject.cc b/src/actions/act_reject.cc index 92fbb740a..785df279b 100644 --- a/src/actions/act_reject.cc +++ b/src/actions/act_reject.cc @@ -70,10 +70,10 @@ #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; diff --git a/src/actions/act_replace.cc b/src/actions/act_replace.cc index dd73471c4..ca495535a 100644 --- a/src/actions/act_replace.cc +++ b/src/actions/act_replace.cc @@ -32,10 +32,10 @@ #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 diff --git a/src/actions/actions.cc b/src/actions/actions.cc index 580a00609..3ec150488 100644 --- a/src/actions/actions.cc +++ b/src/actions/actions.cc @@ -120,7 +120,7 @@ static int LogAction(Packet* p, const OptTreeNode* otn) 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" diff --git a/src/codecs/link/cd_pppoe.cc b/src/codecs/link/cd_pppoe.cc index 6f796a6b6..b05f961c5 100644 --- a/src/codecs/link/cd_pppoe.cc +++ b/src/codecs/link/cd_pppoe.cc @@ -64,8 +64,8 @@ static const RuleMap pppoe_rules[] = { 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 { diff --git a/src/detection/detection_options.cc b/src/detection/detection_options.cc index e26de90cb..8b60aa7ee 100644 --- a/src/detection/detection_options.cc +++ b/src/detection/detection_options.cc @@ -315,7 +315,7 @@ SFXHASH * DetectionTreeHashTableNew(void) } #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", diff --git a/src/detection/fpcreate.cc b/src/detection/fpcreate.cc index 0c8f6e763..f191b8989 100644 --- a/src/detection/fpcreate.cc +++ b/src/detection/fpcreate.cc @@ -92,7 +92,7 @@ static int fpAddPortGroupPrmx(PORT_GROUP *pg, OptTreeNode *otn, int cflag); 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", diff --git a/src/file_api/libs/file_identifier.cc b/src/file_api/libs/file_identifier.cc index 5fede3280..d543a00ec 100644 --- a/src/file_api/libs/file_identifier.cc +++ b/src/file_api/libs/file_identifier.cc @@ -543,8 +543,6 @@ char *test_find_file_type(void *conf) FileContext *context = (FileContext*)SnortAlloc(sizeof (*context)); - static const char *file_type = "MSEXE"; - printf("Check string:"); for (i = 0; i < strlen((char*)str); i++) @@ -564,7 +562,7 @@ char *test_find_file_type(void *conf) 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; diff --git a/src/framework/parameter.cc b/src/framework/parameter.cc index 13e40e2ef..9c924602a 100644 --- a/src/framework/parameter.cc +++ b/src/framework/parameter.cc @@ -175,9 +175,10 @@ static bool valid_enum(Value& v, const char* r) return true; } +#define delim " \t\n" + static unsigned split(const string& txt, vector& 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(); @@ -369,7 +370,7 @@ bool Parameter::validate(Value& v) const return false; } -static const char* pt2str[Parameter::PT_MAX] = +static const char* const pt2str[Parameter::PT_MAX] = { "table", "list", "bool", "int", "real", "port", diff --git a/src/helpers/chunk.cc b/src/helpers/chunk.cc index 1350cb325..b7254d713 100644 --- a/src/helpers/chunk.cc +++ b/src/helpers/chunk.cc @@ -30,7 +30,7 @@ using namespace std; -static const char* opt_init = "init"; +#define opt_init "init" //------------------------------------------------------------------------- // lua stuff diff --git a/src/helpers/markup.cc b/src/helpers/markup.cc index 72b553579..3fe9d0508 100644 --- a/src/helpers/markup.cc +++ b/src/helpers/markup.cc @@ -28,9 +28,10 @@ bool Markup::enabled = false; 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 ) diff --git a/src/helpers/process.cc b/src/helpers/process.cc index e887c7622..1a0ad8938 100644 --- a/src/helpers/process.cc +++ b/src/helpers/process.cc @@ -57,7 +57,7 @@ using namespace std; #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", diff --git a/src/ips_options/ips_ack.cc b/src/ips_options/ips_ack.cc index dcdac7644..b5c3d71cc 100644 --- a/src/ips_options/ips_ack.cc +++ b/src/ips_options/ips_ack.cc @@ -43,10 +43,10 @@ #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; diff --git a/src/ips_options/ips_asn1.cc b/src/ips_options/ips_asn1.cc index 42bf6b802..e85be622d 100644 --- a/src/ips_options/ips_asn1.cc +++ b/src/ips_options/ips_asn1.cc @@ -92,10 +92,10 @@ 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 { diff --git a/src/ips_options/ips_base64.cc b/src/ips_options/ips_base64.cc index 0f0752561..16a636d8c 100644 --- a/src/ips_options/ips_base64.cc +++ b/src/ips_options/ips_base64.cc @@ -55,10 +55,10 @@ static THREAD_LOCAL uint32_t base64_decode_size; 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 @@ -290,8 +290,8 @@ static const IpsApi base64_decode_api = // 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 { diff --git a/src/ips_options/ips_bufferlen.cc b/src/ips_options/ips_bufferlen.cc index 895a5e80d..2d2296cf9 100644 --- a/src/ips_options/ips_bufferlen.cc +++ b/src/ips_options/ips_bufferlen.cc @@ -39,10 +39,10 @@ #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; diff --git a/src/ips_options/ips_byte_extract.cc b/src/ips_options/ips_byte_extract.cc index 84e01efa8..268cc22e3 100644 --- a/src/ips_options/ips_byte_extract.cc +++ b/src/ips_options/ips_byte_extract.cc @@ -41,10 +41,10 @@ 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 diff --git a/src/ips_options/ips_byte_jump.cc b/src/ips_options/ips_byte_jump.cc index 968bd9cc5..51f941136 100644 --- a/src/ips_options/ips_byte_jump.cc +++ b/src/ips_options/ips_byte_jump.cc @@ -98,7 +98,7 @@ static THREAD_LOCAL ProfileStats byteJumpPerfStats; -static const char* s_name = "byte_jump"; +#define s_name "byte_jump" using namespace std; typedef struct _ByteJumpData @@ -351,8 +351,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_byte_test.cc b/src/ips_options/ips_byte_test.cc index 081fe6813..f0fdf7205 100644 --- a/src/ips_options/ips_byte_test.cc +++ b/src/ips_options/ips_byte_test.cc @@ -122,7 +122,7 @@ using namespace std; 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 @@ -482,8 +482,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_classtype.cc b/src/ips_options/ips_classtype.cc index c90866059..af16bd3e5 100644 --- a/src/ips_options/ips_classtype.cc +++ b/src/ips_options/ips_classtype.cc @@ -36,7 +36,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "classtype"; +#define s_name "classtype" //------------------------------------------------------------------------- // module @@ -50,8 +50,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_content.cc b/src/ips_options/ips_content.cc index 22cbf0f81..f3cf590e6 100644 --- a/src/ips_options/ips_content.cc +++ b/src/ips_options/ips_content.cc @@ -54,7 +54,7 @@ #define MAX_PATTERN_SIZE 2048 -static const char* s_name = "content"; +#define s_name "content" static THREAD_LOCAL ProfileStats contentPerfStats; @@ -711,8 +711,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_cvs.cc b/src/ips_options/ips_cvs.cc index 432f28135..621f13fba 100644 --- a/src/ips_options/ips_cvs.cc +++ b/src/ips_options/ips_cvs.cc @@ -65,7 +65,7 @@ static THREAD_LOCAL ProfileStats cvsPerfStats; -static const char* s_name = "cvs"; +#define s_name "cvs" #define CVS_CONFIG_DELIMITERS " \t\n" @@ -437,8 +437,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_detection_filter.cc b/src/ips_options/ips_detection_filter.cc index 9a3b3779f..17b05a89e 100644 --- a/src/ips_options/ips_detection_filter.cc +++ b/src/ips_options/ips_detection_filter.cc @@ -41,7 +41,7 @@ #include "filters/detection_filter.h" #include "filters/sfthd.h" -static const char* s_name = "detection_filter"; +#define s_name "detection_filter" //------------------------------------------------------------------------- // module @@ -61,8 +61,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_dsize.cc b/src/ips_options/ips_dsize.cc index a1d18993a..14c28e8b9 100644 --- a/src/ips_options/ips_dsize.cc +++ b/src/ips_options/ips_dsize.cc @@ -43,7 +43,7 @@ #include "framework/module.h" #include "framework/range.h" -static const char* s_name = "dsize"; +#define s_name "dsize" static THREAD_LOCAL ProfileStats dsizePerfStats; @@ -130,8 +130,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_file_data.cc b/src/ips_options/ips_file_data.cc index 86252d31f..b2d7bd0f7 100644 --- a/src/ips_options/ips_file_data.cc +++ b/src/ips_options/ips_file_data.cc @@ -37,7 +37,7 @@ #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; @@ -86,8 +86,8 @@ int FileDataOption::eval(Cursor& c, Packet*) // 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 { diff --git a/src/ips_options/ips_flags.cc b/src/ips_options/ips_flags.cc index 5400b49b4..7bb938395 100644 --- a/src/ips_options/ips_flags.cc +++ b/src/ips_options/ips_flags.cc @@ -58,7 +58,7 @@ #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; @@ -410,8 +410,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_flow.cc b/src/ips_options/ips_flow.cc index 9282eb7f5..9e09844a9 100644 --- a/src/ips_options/ips_flow.cc +++ b/src/ips_options/ips_flow.cc @@ -46,7 +46,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "flow"; +#define s_name "flow" static THREAD_LOCAL ProfileStats flowCheckPerfStats; @@ -369,8 +369,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_flowbits.cc b/src/ips_options/ips_flowbits.cc index 589bb9cfc..935275dd6 100644 --- a/src/ips_options/ips_flowbits.cc +++ b/src/ips_options/ips_flowbits.cc @@ -74,7 +74,7 @@ using namespace std; #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "flowbits"; +#define s_name "flowbits" static THREAD_LOCAL ProfileStats flowBitsPerfStats; @@ -1152,8 +1152,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_fragbits.cc b/src/ips_options/ips_fragbits.cc index 1d3a220ea..07068ba32 100644 --- a/src/ips_options/ips_fragbits.cc +++ b/src/ips_options/ips_fragbits.cc @@ -79,7 +79,7 @@ #define FB_DF 0x4000 #define FB_MF 0x2000 -static const char* s_name = "fragbits"; +#define s_name "fragbits" static THREAD_LOCAL ProfileStats fragBitsPerfStats; @@ -308,8 +308,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_fragoffset.cc b/src/ips_options/ips_fragoffset.cc index 2cc9a2955..018d9c864 100644 --- a/src/ips_options/ips_fragoffset.cc +++ b/src/ips_options/ips_fragoffset.cc @@ -39,7 +39,7 @@ #include "framework/module.h" #include "framework/range.h" -static const char* s_name = "fragoffset"; +#define s_name "fragoffset" static THREAD_LOCAL ProfileStats fragOffsetPerfStats; @@ -120,8 +120,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_gid.cc b/src/ips_options/ips_gid.cc index 9e3347965..4289d9367 100644 --- a/src/ips_options/ips_gid.cc +++ b/src/ips_options/ips_gid.cc @@ -33,7 +33,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "gid"; +#define s_name "gid" //------------------------------------------------------------------------- // module @@ -47,8 +47,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_http.cc b/src/ips_options/ips_http.cc index 4de79efb3..9bd756222 100644 --- a/src/ips_options/ips_http.cc +++ b/src/ips_options/ips_http.cc @@ -114,8 +114,8 @@ int HttpIpsOption::eval(Cursor& c, Packet* p) #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; @@ -158,8 +158,8 @@ static const IpsApi uri_api = #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; @@ -202,8 +202,8 @@ static const IpsApi client_body_api = #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; @@ -246,8 +246,8 @@ static const IpsApi method_api = #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; @@ -290,8 +290,8 @@ static const IpsApi cookie_api = #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; @@ -334,8 +334,8 @@ static const IpsApi stat_code_api = #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; @@ -378,8 +378,8 @@ static const IpsApi stat_msg_api = #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; @@ -422,8 +422,8 @@ static const IpsApi raw_uri_api = #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; @@ -466,8 +466,8 @@ static const IpsApi raw_header_api = #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; diff --git a/src/ips_options/ips_http_header.cc b/src/ips_options/ips_http_header.cc index f25400f31..1fc81c818 100644 --- a/src/ips_options/ips_http_header.cc +++ b/src/ips_options/ips_http_header.cc @@ -37,7 +37,7 @@ using namespace std; #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; @@ -53,8 +53,8 @@ static const Parameter s_params[] = // 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 { diff --git a/src/ips_options/ips_icmp_id.cc b/src/ips_options/ips_icmp_id.cc index 155ea75f6..dac1c1692 100644 --- a/src/ips_options/ips_icmp_id.cc +++ b/src/ips_options/ips_icmp_id.cc @@ -61,7 +61,7 @@ #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; @@ -144,8 +144,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_icmp_seq.cc b/src/ips_options/ips_icmp_seq.cc index 4c86b773b..113bc5d53 100644 --- a/src/ips_options/ips_icmp_seq.cc +++ b/src/ips_options/ips_icmp_seq.cc @@ -61,7 +61,7 @@ #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; @@ -146,8 +146,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_icode.cc b/src/ips_options/ips_icode.cc index ca82959f5..05372aa97 100644 --- a/src/ips_options/ips_icode.cc +++ b/src/ips_options/ips_icode.cc @@ -40,7 +40,7 @@ #include "framework/range.h" #include "protocols/icmp4.h" -static const char* s_name = "icode"; +#define s_name "icode" static THREAD_LOCAL ProfileStats icmpCodePerfStats; @@ -117,8 +117,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_id.cc b/src/ips_options/ips_id.cc index 8a804e37c..39d4804c4 100644 --- a/src/ips_options/ips_id.cc +++ b/src/ips_options/ips_id.cc @@ -36,7 +36,7 @@ #include "framework/module.h" #include "framework/range.h" -static const char* s_name = "id"; +#define s_name "id" static THREAD_LOCAL ProfileStats ipIdPerfStats; @@ -112,8 +112,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_ip_proto.cc b/src/ips_options/ips_ip_proto.cc index e947e1c03..6881811b9 100644 --- a/src/ips_options/ips_ip_proto.cc +++ b/src/ips_options/ips_ip_proto.cc @@ -46,7 +46,7 @@ #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; @@ -294,8 +294,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_ipopts.cc b/src/ips_options/ips_ipopts.cc index a38ae1c3e..0f83e5be6 100644 --- a/src/ips_options/ips_ipopts.cc +++ b/src/ips_options/ips_ipopts.cc @@ -45,7 +45,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "ipopts"; +#define s_name "ipopts" static THREAD_LOCAL ProfileStats ipOptionPerfStats; @@ -213,8 +213,8 @@ static void ipopts_parse(const char* data, IpOptionData* ds_ptr) // 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[] = { @@ -224,8 +224,8 @@ 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 { diff --git a/src/ips_options/ips_isdataat.cc b/src/ips_options/ips_isdataat.cc index e0728e2a7..9437c0b9c 100644 --- a/src/ips_options/ips_isdataat.cc +++ b/src/ips_options/ips_isdataat.cc @@ -63,7 +63,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "isdataat"; +#define s_name "isdataat" static THREAD_LOCAL ProfileStats isDataAtPerfStats; @@ -254,8 +254,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_itype.cc b/src/ips_options/ips_itype.cc index 94fd99433..8151d85b9 100644 --- a/src/ips_options/ips_itype.cc +++ b/src/ips_options/ips_itype.cc @@ -36,7 +36,7 @@ #include "framework/range.h" #include "protocols/icmp4.h" -static const char* s_name = "itype"; +#define s_name "itype" static THREAD_LOCAL ProfileStats icmpTypePerfStats; @@ -114,8 +114,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_luajit.cc b/src/ips_options/ips_luajit.cc index 9150e290d..f1981ea70 100644 --- a/src/ips_options/ips_luajit.cc +++ b/src/ips_options/ips_luajit.cc @@ -35,7 +35,7 @@ static THREAD_LOCAL ProfileStats luaIpsPerfStats; -static const char* opt_eval = "eval"; +#define opt_eval "eval" //------------------------------------------------------------------------- // ffi stuff @@ -77,8 +77,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_metadata.cc b/src/ips_options/ips_metadata.cc index 9840f6e03..f53324961 100644 --- a/src/ips_options/ips_metadata.cc +++ b/src/ips_options/ips_metadata.cc @@ -35,7 +35,7 @@ using namespace std; #include "framework/module.h" #include "parser/parse_conf.h" -static const char* s_name = "metadata"; +#define s_name "metadata" //------------------------------------------------------------------------- // module @@ -52,8 +52,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_msg.cc b/src/ips_options/ips_msg.cc index 11f78772a..d4c6a960b 100644 --- a/src/ips_options/ips_msg.cc +++ b/src/ips_options/ips_msg.cc @@ -35,7 +35,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "msg"; +#define s_name "msg" //------------------------------------------------------------------------- // module @@ -49,8 +49,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_pcre.cc b/src/ips_options/ips_pcre.cc index 3d7e25900..4d0d3a59c 100644 --- a/src/ips_options/ips_pcre.cc +++ b/src/ips_options/ips_pcre.cc @@ -68,7 +68,7 @@ #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 @@ -641,8 +641,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_pkt_data.cc b/src/ips_options/ips_pkt_data.cc index 6b9ac8623..3163419e1 100644 --- a/src/ips_options/ips_pkt_data.cc +++ b/src/ips_options/ips_pkt_data.cc @@ -33,7 +33,7 @@ #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; @@ -63,8 +63,8 @@ int PktDataOption::eval(Cursor& c, Packet* p) // 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 { diff --git a/src/ips_options/ips_priority.cc b/src/ips_options/ips_priority.cc index 36eb06fc3..421433b4e 100644 --- a/src/ips_options/ips_priority.cc +++ b/src/ips_options/ips_priority.cc @@ -33,7 +33,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "priority"; +#define s_name "priority" //------------------------------------------------------------------------- // module @@ -47,8 +47,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_raw_data.cc b/src/ips_options/ips_raw_data.cc index 9317f4e71..9144a7359 100644 --- a/src/ips_options/ips_raw_data.cc +++ b/src/ips_options/ips_raw_data.cc @@ -33,7 +33,7 @@ #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; @@ -63,8 +63,8 @@ int RawDataOption::eval(Cursor& c, Packet* p) // 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 { diff --git a/src/ips_options/ips_reference.cc b/src/ips_options/ips_reference.cc index 03a22d6ee..522d6066f 100644 --- a/src/ips_options/ips_reference.cc +++ b/src/ips_options/ips_reference.cc @@ -33,7 +33,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "reference"; +#define s_name "reference" //------------------------------------------------------------------------- // module @@ -50,8 +50,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_rem.cc b/src/ips_options/ips_rem.cc index a163179ba..2dac78ce5 100644 --- a/src/ips_options/ips_rem.cc +++ b/src/ips_options/ips_rem.cc @@ -32,7 +32,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "rem"; +#define s_name "rem" //------------------------------------------------------------------------- // module @@ -46,8 +46,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_replace.cc b/src/ips_options/ips_replace.cc index 4a095ee7b..c1f5ec31e 100644 --- a/src/ips_options/ips_replace.cc +++ b/src/ips_options/ips_replace.cc @@ -81,7 +81,7 @@ static bool replace_ok() // replace rule option //------------------------------------------------------------------------- -static const char* s_name = "replace"; +#define s_name "replace" static THREAD_LOCAL ProfileStats replacePerfStats; @@ -201,8 +201,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_rev.cc b/src/ips_options/ips_rev.cc index aa5fdaa19..93c01f174 100644 --- a/src/ips_options/ips_rev.cc +++ b/src/ips_options/ips_rev.cc @@ -31,7 +31,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "rev"; +#define s_name "rev" //------------------------------------------------------------------------- // module @@ -45,8 +45,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_rpc.cc b/src/ips_options/ips_rpc.cc index 934826b45..2e11fb8d7 100644 --- a/src/ips_options/ips_rpc.cc +++ b/src/ips_options/ips_rpc.cc @@ -43,7 +43,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "rpc"; +#define s_name "rpc" static THREAD_LOCAL ProfileStats rpcCheckPerfStats; @@ -258,8 +258,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_seq.cc b/src/ips_options/ips_seq.cc index b0edb4f70..a88228815 100644 --- a/src/ips_options/ips_seq.cc +++ b/src/ips_options/ips_seq.cc @@ -35,7 +35,7 @@ #include "framework/range.h" #include "protocols/tcp.h" -static const char* s_name = "seq"; +#define s_name "seq" static THREAD_LOCAL ProfileStats tcpSeqPerfStats; @@ -111,8 +111,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_session.cc b/src/ips_options/ips_session.cc index 1e0c2bcef..668b89e51 100644 --- a/src/ips_options/ips_session.cc +++ b/src/ips_options/ips_session.cc @@ -71,7 +71,7 @@ #include "framework/module.h" #include "sfip/sf_ip.h" -static const char* s_name = "session"; +#define s_name "session" static THREAD_LOCAL ProfileStats sessionPerfStats; @@ -327,8 +327,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_sid.cc b/src/ips_options/ips_sid.cc index 4eb5fffcc..a6318b476 100644 --- a/src/ips_options/ips_sid.cc +++ b/src/ips_options/ips_sid.cc @@ -31,7 +31,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "sid"; +#define s_name "sid" //------------------------------------------------------------------------- // module @@ -45,8 +45,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_so.cc b/src/ips_options/ips_so.cc index 11b1a978d..49f5194d5 100644 --- a/src/ips_options/ips_so.cc +++ b/src/ips_options/ips_so.cc @@ -34,7 +34,7 @@ using namespace std; #include "parser/parser.h" #include "time/profiler.h" -static const char* s_name = "so"; +#define s_name "so" static THREAD_LOCAL ProfileStats soPerfStats; @@ -117,8 +117,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_soid.cc b/src/ips_options/ips_soid.cc index e84141b0f..a10ede625 100644 --- a/src/ips_options/ips_soid.cc +++ b/src/ips_options/ips_soid.cc @@ -36,7 +36,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "soid"; +#define s_name "soid" //------------------------------------------------------------------------- // module @@ -50,8 +50,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_tag.cc b/src/ips_options/ips_tag.cc index 7ad5b8993..5e7c06e6f 100644 --- a/src/ips_options/ips_tag.cc +++ b/src/ips_options/ips_tag.cc @@ -35,7 +35,7 @@ #include "framework/parameter.h" #include "framework/module.h" -static const char* s_name = "tag"; +#define s_name "tag" //------------------------------------------------------------------------- // module @@ -58,8 +58,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_tos.cc b/src/ips_options/ips_tos.cc index 9e5958478..c289f880b 100644 --- a/src/ips_options/ips_tos.cc +++ b/src/ips_options/ips_tos.cc @@ -33,7 +33,7 @@ #include "framework/module.h" #include "framework/range.h" -static const char* s_name = "tos"; +#define s_name "tos" static THREAD_LOCAL ProfileStats ipTosPerfStats; @@ -113,8 +113,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_ttl.cc b/src/ips_options/ips_ttl.cc index 641287b44..7d6cf63b8 100644 --- a/src/ips_options/ips_ttl.cc +++ b/src/ips_options/ips_ttl.cc @@ -35,7 +35,7 @@ #include "framework/module.h" #include "framework/range.h" -static const char* s_name = "ttl"; +#define s_name "ttl" static THREAD_LOCAL ProfileStats ttlCheckPerfStats; @@ -112,8 +112,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/ips_options/ips_window.cc b/src/ips_options/ips_window.cc index ade4654f8..1d42b3d93 100644 --- a/src/ips_options/ips_window.cc +++ b/src/ips_options/ips_window.cc @@ -35,7 +35,7 @@ #include "framework/range.h" #include "protocols/tcp.h" -static const char* s_name = "window"; +#define s_name "window" static THREAD_LOCAL ProfileStats tcpWinPerfStats; @@ -111,8 +111,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/log/log_text.cc b/src/log/log_text.cc index 74468e1ee..258a54963 100644 --- a/src/log/log_text.cc +++ b/src/log/log_text.cc @@ -1461,7 +1461,7 @@ static void LogCharData(TextLog* log, char *data, int len) #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) { diff --git a/src/loggers/alert_csv.cc b/src/loggers/alert_csv.cc index 7f4a99a98..79603fe90 100644 --- a/src/loggers/alert_csv.cc +++ b/src/loggers/alert_csv.cc @@ -60,17 +60,17 @@ using namespace std; // 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[] = { @@ -90,8 +90,8 @@ 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 { diff --git a/src/loggers/alert_fast.cc b/src/loggers/alert_fast.cc index c86d86e92..a091104a2 100644 --- a/src/loggers/alert_fast.cc +++ b/src/loggers/alert_fast.cc @@ -96,8 +96,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/loggers/alert_full.cc b/src/loggers/alert_full.cc index b364d3d37..5041a7f04 100644 --- a/src/loggers/alert_full.cc +++ b/src/loggers/alert_full.cc @@ -85,8 +85,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/loggers/alert_luajit.cc b/src/loggers/alert_luajit.cc index 1fcb56103..9e3a72271 100644 --- a/src/loggers/alert_luajit.cc +++ b/src/loggers/alert_luajit.cc @@ -134,8 +134,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/loggers/alert_sf_socket.cc b/src/loggers/alert_sf_socket.cc index 0a9f55a8d..0e7b34215 100644 --- a/src/loggers/alert_sf_socket.cc +++ b/src/loggers/alert_sf_socket.cc @@ -66,7 +66,7 @@ static THREAD_LOCAL SfSock context; using namespace std; typedef vector RuleVector; -static const char* s_name = "alert_sfsocket"; +#define s_name "alert_sfsocket" //------------------------------------------------------------------------- // alert_sfsocket module @@ -94,8 +94,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/loggers/alert_syslog.cc b/src/loggers/alert_syslog.cc index ba6585ec9..8e24dc837 100644 --- a/src/loggers/alert_syslog.cc +++ b/src/loggers/alert_syslog.cc @@ -51,16 +51,16 @@ 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) { @@ -82,8 +82,8 @@ 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) { @@ -101,8 +101,8 @@ 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) { @@ -141,8 +141,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/loggers/alert_test.cc b/src/loggers/alert_test.cc index 54ae28d0d..078d42ac0 100644 --- a/src/loggers/alert_test.cc +++ b/src/loggers/alert_test.cc @@ -82,8 +82,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/loggers/alert_unixsock.cc b/src/loggers/alert_unixsock.cc index 1ac51bcac..33f659092 100644 --- a/src/loggers/alert_unixsock.cc +++ b/src/loggers/alert_unixsock.cc @@ -96,7 +96,7 @@ struct UnixSock static THREAD_LOCAL UnixSock us; -static const char* s_name = "alert_unixsock"; +#define s_name "alert_unixsock" //------------------------------------------------------------------------- // alert_unixsock module @@ -109,8 +109,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/loggers/log_null.cc b/src/loggers/log_null.cc index aa88e5dd8..6ae0c4e72 100644 --- a/src/loggers/log_null.cc +++ b/src/loggers/log_null.cc @@ -34,8 +34,8 @@ #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 diff --git a/src/loggers/log_pcap.cc b/src/loggers/log_pcap.cc index bb454e513..fec5dd76e 100644 --- a/src/loggers/log_pcap.cc +++ b/src/loggers/log_pcap.cc @@ -101,8 +101,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/loggers/unified2.cc b/src/loggers/unified2.cc index d7a15b9b3..ec86b45b6 100644 --- a/src/loggers/unified2.cc +++ b/src/loggers/unified2.cc @@ -1066,8 +1066,8 @@ static const Parameter s_params[] = { 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 { diff --git a/src/main/help.cc b/src/main/help.cc index 955431e03..8e13cb006 100644 --- a/src/main/help.cc +++ b/src/main/help.cc @@ -47,49 +47,49 @@ using namespace std; #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 [] output matching commands\n" -"--help-config [] output matching config options\n" -"--help-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 [