]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: helper function for multibuffer registration
authorPhilippe Antoine <pantoine@oisf.net>
Mon, 15 Jul 2024 12:12:38 +0000 (14:12 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 16 Jul 2024 04:43:03 +0000 (06:43 +0200)
So that rust does not need to know about SIG_FLAG_TOCLIENT value

src/detect-engine-helper.c
src/detect-engine-helper.h

index 9b58864881663244fc001d6adb0f05a5e595eef4..740fec7618c83759924f944f632e7a721a3a19a1 100644 (file)
@@ -81,6 +81,20 @@ int DetectHelperBufferMpmRegister(const char *name, const char *desc, AppProto a
     return DetectBufferTypeGetByName(name);
 }
 
+int DetectHelperMultiBufferMpmRegister(const char *name, const char *desc, AppProto alproto,
+        bool toclient, bool toserver, InspectionMultiBufferGetDataPtr GetData)
+{
+    if (toserver) {
+        DetectAppLayerMultiRegister(name, alproto, SIG_FLAG_TOSERVER, 0, GetData, 2, 0);
+    }
+    if (toclient) {
+        DetectAppLayerMultiRegister(name, alproto, SIG_FLAG_TOCLIENT, 0, GetData, 2, 0);
+    }
+    DetectBufferTypeSupportsMultiInstance(name);
+    DetectBufferTypeSetDescriptionByName(name, desc);
+    return DetectBufferTypeGetByName(name);
+}
+
 int DetectHelperKeywordRegister(const SCSigTableElmt *kw)
 {
     if (DETECT_TBLSIZE_IDX >= DETECT_TBLSIZE) {
index 5a2c49e1b05980971ddfcf8827a162a3498c56ef..76e27dee7ce552109a013134e53abbea0a7105d5 100644 (file)
@@ -39,6 +39,8 @@ InspectionBuffer *DetectHelperGetData(struct DetectEngineThreadCtx_ *det_ctx,
         const int list_id, SimpleGetTxBuffer GetBuf);
 int DetectHelperBufferMpmRegister(const char *name, const char *desc, AppProto alproto,
         bool toclient, bool toserver, InspectionBufferGetDataPtr GetData);
+int DetectHelperMultiBufferMpmRegister(const char *name, const char *desc, AppProto alproto,
+        bool toclient, bool toserver, InspectionMultiBufferGetDataPtr GetData);
 
 InspectionBuffer *DetectHelperGetMultiData(struct DetectEngineThreadCtx_ *det_ctx,
         const DetectEngineTransforms *transforms, Flow *f, const uint8_t flow_flags, void *txv,