]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: add buffer helper functions
authorVictor Julien <vjulien@oisf.net>
Fri, 3 Dec 2021 08:45:56 +0000 (09:45 +0100)
committerVictor Julien <vjulien@oisf.net>
Tue, 7 Dec 2021 06:56:34 +0000 (07:56 +0100)
src/detect-engine.c
src/detect-engine.h

index 3bf1268295b6ae7eeb73b133af6c127b63c5c9d6..5cb6e304529ae25299ca22a73250255420095784 100644 (file)
@@ -920,6 +920,30 @@ const char *DetectBufferTypeGetDescriptionByName(const char *name)
     return exists->description;
 }
 
+void DetectEngineBufferTypeSupportsPacket(DetectEngineCtx *de_ctx, const char *name)
+{
+    DetectBufferType *exists = DetectEngineBufferTypeLookupByName(de_ctx, name);
+    BUG_ON(!exists);
+    exists->packet = true;
+    SCLogDebug("%p %s -- %d supports packet inspection", exists, name, exists->id);
+}
+
+void DetectEngineBufferTypeSupportsMpm(DetectEngineCtx *de_ctx, const char *name)
+{
+    DetectBufferType *exists = DetectEngineBufferTypeLookupByName(de_ctx, name);
+    BUG_ON(!exists);
+    exists->mpm = true;
+    SCLogDebug("%p %s -- %d supports mpm", exists, name, exists->id);
+}
+
+void DetectEngineBufferTypeSupportsTransformations(DetectEngineCtx *de_ctx, const char *name)
+{
+    DetectBufferType *exists = DetectEngineBufferTypeLookupByName(de_ctx, name);
+    BUG_ON(!exists);
+    exists->supports_transforms = true;
+    SCLogDebug("%p %s -- %d supports transformations", exists, name, exists->id);
+}
+
 bool DetectEngineBufferTypeSupportsPacketGetById(const DetectEngineCtx *de_ctx, const int id)
 {
     const DetectBufferType *map = DetectEngineBufferTypeGetById(de_ctx, id);
index fadb6af09ca30565b5ea523ba567d39656c68be1..933222d3c9243a7db501d8d32f26c80d59b6602d 100644 (file)
@@ -75,6 +75,9 @@ bool DetectEngineBufferRunValidateCallback(
         const DetectEngineCtx *de_ctx, const int id, const Signature *s, const char **sigerror);
 bool DetectEngineBufferTypeValidateTransform(DetectEngineCtx *de_ctx, int sm_list,
         const uint8_t *content, uint16_t content_len, const char **namestr);
+void DetectEngineBufferTypeSupportsPacket(DetectEngineCtx *de_ctx, const char *name);
+void DetectEngineBufferTypeSupportsMpm(DetectEngineCtx *de_ctx, const char *name);
+void DetectEngineBufferTypeSupportsTransformations(DetectEngineCtx *de_ctx, const char *name);
 
 /* prototypes */
 DetectEngineCtx *DetectEngineCtxInitWithPrefix(const char *prefix);