Go to the documentation of this file.
61 #define PARSE_REGEX "^\\s*([A-z_]+)\\s*\\s*([A-z_]+)\\s*(?:,\\s*([A-z_]+)\\s+([A-z_]+))?\\s*(?:,\\s*([A-z_]+)\\s+([A-z_]+))?$"
70 static void DetectConfigRegisterTests(
void);
88 static void ConfigApplyTx(
Flow *f,
98 SCLogDebug(
"tx %p txd %p: log_flags %x", tx, txd, txd->config.log_flags);
106 AppLayerTxConfig req;
107 memset(&req, 0,
sizeof(req));
126 bool this_tx =
false;
127 bool this_flow =
false;
129 switch (config->
scope) {
140 ConfigApplyTx(p->
flow, det_ctx->
tx_id, config);
141 }
else if (this_flow) {
153 ConfigApply(det_ctx, p, config);
179 "filestore can't work with bypass keyword");
183 pcre2_match_data *match = NULL;
185 if (
str == NULL || strlen(
str) == 0) {
199 SCLogError(
"config is rather picky at this time");
202 pcre2len =
sizeof(subsys);
203 res = pcre2_substring_copy_bynumber(match, 1, (PCRE2_UCHAR8 *)subsys, &pcre2len);
205 SCLogError(
"pcre2_substring_copy_bynumber failed");
209 if (strcmp(subsys,
"logging") != 0) {
210 SCLogError(
"only 'logging' supported at this time");
215 pcre2len =
sizeof(state);
216 res = pcre2_substring_copy_bynumber(match, 2, (PCRE2_UCHAR8 *)state, &pcre2len);
218 SCLogError(
"pcre2_substring_copy_bynumber failed");
222 if (strcmp(state,
"disable") != 0) {
223 SCLogError(
"only 'disable' supported at this time");
228 pcre2len =
sizeof(
type);
229 res = pcre2_substring_copy_bynumber(match, 3, (PCRE2_UCHAR8 *)
type, &pcre2len);
231 SCLogError(
"pcre2_substring_copy_bynumber failed");
235 if (strcmp(
type,
"type") != 0) {
236 SCLogError(
"only 'type' supported at this time");
241 pcre2len =
sizeof(typeval);
242 res = pcre2_substring_copy_bynumber(match, 4, (PCRE2_UCHAR8 *)typeval, &pcre2len);
244 SCLogError(
"pcre2_substring_copy_bynumber failed");
248 if (!(strcmp(typeval,
"tx") == 0 ||strcmp(typeval,
"flow") == 0)) {
249 SCLogError(
"only 'tx' and 'flow' supported at this time");
254 pcre2len =
sizeof(scope);
255 res = pcre2_substring_copy_bynumber(match, 5, (PCRE2_UCHAR8 *)scope, &pcre2len);
257 SCLogError(
"pcre2_substring_copy_bynumber failed");
261 if (strcmp(scope,
"scope") != 0) {
262 SCLogError(
"only 'scope' supported at this time");
267 pcre2len =
sizeof(scopeval);
268 res = pcre2_substring_copy_bynumber(match, 6, (PCRE2_UCHAR8 *)scopeval, &pcre2len);
270 SCLogError(
"pcre2_substring_copy_bynumber failed");
274 if (!(strcmp(scopeval,
"tx") == 0 ||strcmp(scopeval,
"flow") == 0)) {
275 SCLogError(
"only 'tx' and 'flow' supported at this time");
284 if (strcmp(typeval,
"tx") == 0) {
287 if (strcmp(scopeval,
"tx") == 0) {
300 pcre2_match_data_free(match);
305 pcre2_match_data_free(match);
323 static int DetectConfigTest01(
void)
329 "config dns any any -> any any ("
330 "dns.query; content:\"common.domain.com\"; "
331 "config:logging disable, type tx, scope tx; "
338 void DetectConfigRegisterTests(
void)
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
SigTableElmt * sigmatch_table
void DetectConfigRegister(void)
Registration function for keyword: filestore.
void(* Free)(DetectEngineCtx *, void *)
void AppLayerParserApplyTxConfig(uint8_t ipproto, AppProto alproto, void *state, void *tx, enum ConfigAction mode, AppLayerTxConfig config)
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
#define PARSE_REGEX
Regex for parsing our flow options.
main detection engine ctx
#define APP_LAYER_TX_SKIP_INSPECT_FLAG
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
int DetectParsePcreExec(DetectParseRegex *parse_regex, pcre2_match_data **match, const char *str, int start_offset, int options)
Signature * DetectEngineAppendSig(DetectEngineCtx *, const char *)
Parse and append a Signature into the Detection Engine Context signature list.
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
#define SIG_FLAG_APPLAYER
@ DETECT_SM_LIST_POSTMATCH
#define PASS
Pass the test.
uint64_t AppLayerParserGetTxDetectFlags(AppLayerTxData *txd, const uint8_t dir)
void DetectSetupParseRegexes(const char *parse_str, DetectParseRegex *detect_parse)
Data structures and function prototypes for keeping state for the detection engine.
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
void * AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id)
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
struct AppLayerTxData AppLayerTxData
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
AppLayerTxData * AppLayerParserGetTxData(uint8_t ipproto, AppProto alproto, void *tx)
#define SCLogError(...)
Macro used to log ERROR messages.
DetectEngineCtx * DetectEngineCtxInit(void)
SigMatch * SigMatchAppendSMToList(DetectEngineCtx *de_ctx, Signature *s, uint16_t type, SigMatchCtx *ctx, const int list)
Append a SigMatch to the list type.
AppProto alproto
application level protocol
void(* RegisterTests)(void)