From: Jason Ish Date: Mon, 25 Nov 2019 22:51:44 +0000 (-0600) Subject: app-layer: method to see if parser supports tx detect flags X-Git-Tag: suricata-5.0.1~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=739df21e2d87fe195a09334f66409f458711f3f8;p=thirdparty%2Fsuricata.git app-layer: method to see if parser supports tx detect flags Add method to check if a parser for an app-layer protocol supports tx detect flags. This is a bit of a hack for now as where we need to run this check from we do not have the IP protocol. --- diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index e413115504..4e526d493f 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -1149,6 +1149,17 @@ int AppLayerParserSetTxDetectState(const Flow *f, SCReturnInt(r); } +bool AppLayerParserSupportsTxDetectFlags(AppProto alproto) +{ + SCEnter(); + for (uint8_t p = 0; p < FLOW_PROTO_APPLAYER_MAX; p++) { + if (alp_ctx.ctxs[p][alproto].GetTxDetectFlags != NULL) { + SCReturnBool(true); + } + } + SCReturnBool(false); +} + uint64_t AppLayerParserGetTxDetectFlags(uint8_t ipproto, AppProto alproto, void *tx, uint8_t dir) { SCEnter(); diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index 492e3e5ea5..0ce16c0898 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -227,6 +227,7 @@ int AppLayerParserSetTxDetectState(const Flow *f, void *tx, DetectEngineState *s uint64_t AppLayerParserGetTxDetectFlags(uint8_t ipproto, AppProto alproto, void *tx, uint8_t dir); void AppLayerParserSetTxDetectFlags(uint8_t ipproto, AppProto alproto, void *tx, uint8_t dir, uint64_t); +bool AppLayerParserSupportsTxDetectFlags(AppProto alproto); /***** General *****/