]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
app-layer: method to see if parser supports tx detect flags
authorJason Ish <jason.ish@oisf.net>
Mon, 25 Nov 2019 22:51:44 +0000 (16:51 -0600)
committerJason Ish <jason.ish@oisf.net>
Wed, 27 Nov 2019 18:43:36 +0000 (12:43 -0600)
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.

src/app-layer-parser.c
src/app-layer-parser.h

index e4131155040880f48eb9b1cfb9e58229793aca6a..4e526d493f1d31cc361c88636f725ac6c77192e3 100644 (file)
@@ -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();
index 492e3e5ea5d586a6171a345af4a681c23f404328..0ce16c08985f7226bbeaaa04aad944d6ecec975b 100644 (file)
@@ -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 *****/