Go to the documentation of this file.
37 #define PARSE_REGEX "^\\s*(src_ip|dest_ip)\\s*$"
44 static void DetectTargetRegisterTests (
void);
82 static int DetectTargetParse(
Signature *s,
const char *targetstr)
90 SCLogError(
"pcre_exec parse error, ret %" PRId32
", string %s", ret, targetstr);
94 pcre2len =
sizeof(value);
95 res = pcre2_substring_copy_bynumber(parse_regex.
match, 1, (PCRE2_UCHAR8 *)value, &pcre2len);
97 SCLogError(
"pcre2_substring_copy_bynumber failed");
102 if (!strcmp(value,
"src_ip")) {
104 SCLogError(
"Conflicting values of target keyword");
108 }
else if (!strcmp(value,
"dest_ip")) {
110 SCLogError(
"Conflicting values of target keyword");
115 SCLogError(
"only 'src_ip' and 'dest_ip' are supported as target value");
134 int ret = DetectTargetParse(s, targetstr);
143 static int DetectTargetSignatureTest01(
void)
158 static void DetectTargetRegisterTests(
void)
161 DetectTargetSignatureTest01);
#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(* Free)(DetectEngineCtx *, void *)
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
#define SIG_FLAG_DEST_IS_TARGET
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 *)
void DetectTargetRegister(void)
Registration function for target keyword.
#define PASS
Pass the test.
void DetectSetupParseRegexes(const char *parse_str, DetectParseRegex *detect_parse)
#define PARSE_REGEX
Regex for parsing our keyword options.
#define SIG_FLAG_SRC_IS_TARGET
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
#define SCLogError(...)
Macro used to log ERROR messages.
DetectEngineCtx * DetectEngineCtxInit(void)
void(* RegisterTests)(void)