Go to the documentation of this file.
37 #define PARSE_REGEX "^\\s*(\\d+|\"\\d+\")\\s*$"
43 static void PriorityRegisterTests(
void);
63 char copy_str[128] =
"";
76 pcre2len =
sizeof(copy_str);
77 ret = pcre2_substring_copy_bynumber(parse_regex.
match, 1, (PCRE2_UCHAR8 *)copy_str, &pcre2len);
79 SCLogError(
"pcre2_substring_copy_bynumber failed");
85 prio = strtol(copy_str, &endptr, 10);
86 if (endptr == NULL || *endptr !=
'\0') {
88 "to priority keyword");
94 "keyword. Using highest priority in the rule");
107 static int DetectPriorityTest01(
void)
113 "(msg:\"Priority test\"; priority:2; sid:1;)");
122 static int DetectPriorityTest02(
void)
128 "(msg:\"Priority test\"; priority:1; sid:1;)");
133 "(msg:\"Priority test\"; priority:boo; sid:2;)");
137 "(msg:\"Priority test\"; priority:10boo; sid:3;)");
141 "(msg:\"Priority test\"; priority:b10oo; sid:4;)");
145 "(msg:\"Priority test\"; priority:boo10; sid:5;)");
149 "(msg:\"Priority test\"; priority:-1; sid:6;)");
153 "(msg:\"Priority test\"; sid:7;)");
158 "(msg:\"Priority test\"; priority:5; priority:4; sid:8;)");
163 "(msg:\"Priority test\"; priority:5; priority:4; "
164 "priority:1; sid:9;)");
175 static void PriorityRegisterTests(
void)
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
int DetectParsePcreExec(DetectParseRegex *parse_regex, const char *str, int start_offset, int options)
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
void DetectPriorityRegister(void)
Registers the handler functions for the "priority" keyword.
main detection engine ctx
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
Signature * DetectEngineAppendSig(DetectEngineCtx *, const char *)
Parse and append a Signature into the Detection Engine Context signature list.
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
#define FAIL_IF_NOT_NULL(expr)
Fail a test if expression evaluates to non-NULL.
#define PASS
Pass the test.
void DetectSetupParseRegexes(const char *parse_str, DetectParseRegex *detect_parse)
#define SCLogWarning(...)
Macro used to log WARNING messages.
Signature * SigInit(DetectEngineCtx *de_ctx, const char *sigstr)
Parses a signature and adds it to the Detection Engine Context.
#define SIG_FLAG_INIT_PRIO_EXPLICT
SignatureInitData * init_data
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
#define SCLogError(...)
Macro used to log ERROR messages.
DetectEngineCtx * DetectEngineCtxInit(void)
void(* RegisterTests)(void)