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);
180 "filestore can't work with bypass keyword");
184 pcre2_match_data *match = NULL;
190 if (
str == NULL || strlen(
str) == 0) {
204 SCLogError(
"config is rather picky at this time");
207 pcre2len =
sizeof(subsys);
208 res = pcre2_substring_copy_bynumber(match, 1, (PCRE2_UCHAR8 *)subsys, &pcre2len);
210 SCLogError(
"pcre2_substring_copy_bynumber failed");
214 if (strcmp(subsys,
"logging") != 0) {
215 SCLogError(
"only 'logging' supported at this time");
220 pcre2len =
sizeof(state);
221 res = pcre2_substring_copy_bynumber(match, 2, (PCRE2_UCHAR8 *)state, &pcre2len);
223 SCLogError(
"pcre2_substring_copy_bynumber failed");
227 if (strcmp(state,
"disable") != 0) {
228 SCLogError(
"only 'disable' supported at this time");
233 pcre2len =
sizeof(
type);
234 res = pcre2_substring_copy_bynumber(match, 3, (PCRE2_UCHAR8 *)
type, &pcre2len);
236 SCLogError(
"pcre2_substring_copy_bynumber failed");
240 if (strcmp(
type,
"type") != 0) {
241 SCLogError(
"only 'type' supported at this time");
246 pcre2len =
sizeof(typeval);
247 res = pcre2_substring_copy_bynumber(match, 4, (PCRE2_UCHAR8 *)typeval, &pcre2len);
249 SCLogError(
"pcre2_substring_copy_bynumber failed");
253 if (!(strcmp(typeval,
"tx") == 0 ||strcmp(typeval,
"flow") == 0)) {
254 SCLogError(
"only 'tx' and 'flow' supported at this time");
259 pcre2len =
sizeof(scope);
260 res = pcre2_substring_copy_bynumber(match, 5, (PCRE2_UCHAR8 *)scope, &pcre2len);
262 SCLogError(
"pcre2_substring_copy_bynumber failed");
266 if (strcmp(scope,
"scope") != 0) {
267 SCLogError(
"only 'scope' supported at this time");
272 pcre2len =
sizeof(scopeval);
273 res = pcre2_substring_copy_bynumber(match, 6, (PCRE2_UCHAR8 *)scopeval, &pcre2len);
275 SCLogError(
"pcre2_substring_copy_bynumber failed");
279 if (!(strcmp(scopeval,
"tx") == 0 ||strcmp(scopeval,
"flow") == 0)) {
280 SCLogError(
"only 'tx' and 'flow' supported at this time");
289 if (strcmp(typeval,
"tx") == 0) {
292 if (strcmp(scopeval,
"tx") == 0) {
303 pcre2_match_data_free(match);
308 pcre2_match_data_free(match);
328 static int DetectConfigTest01(
void)
334 "config dns any any -> any any ("
335 "dns.query; content:\"common.domain.com\"; "
336 "config:logging disable, type tx, scope tx; "
343 void DetectConfigRegisterTests(
void)
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
void SigMatchAppendSMToList(Signature *s, SigMatch *new, const int list)
Append a SigMatch to the list type.
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 *)
SigMatch * SigMatchAlloc(void)
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.
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
AppLayerTxData * AppLayerParserGetTxData(uint8_t ipproto, AppProto alproto, void *tx)
#define SCLogError(...)
Macro used to log ERROR messages.
a single match condition for a signature
DetectEngineCtx * DetectEngineCtxInit(void)
AppProto alproto
application level protocol
void(* RegisterTests)(void)