]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
doc/devguide: document the rate filter callback 13146/head
authorJason Ish <jason.ish@oisf.net>
Thu, 1 May 2025 16:10:34 +0000 (10:10 -0600)
committerVictor Julien <victor@inliniac.net>
Fri, 2 May 2025 18:10:09 +0000 (20:10 +0200)
Ticket: #7673

doc/userguide/devguide/extending/detect/index.rst

index 1dde177d88a436fa28dfddbe69c16d173a9582f9..9e913315b19ff4c9ed19025d7e2bc5e63877226f 100644 (file)
@@ -1,2 +1,40 @@
 Detection
-=========
+#########
+
+Rate Filter Callback
+********************
+
+A callback can be registered for any signature hit whose action has
+been modified by the rate filter. This allows for the user to modify
+the action, if needed using their own custom logic.
+
+For an example, see ``examples/lib/custom/main.c`` in the Suricata
+source code.
+
+The Callback
+============
+
+The callback function will be called with the packet, signature
+details (sid, gid, rev), original action, the new action, and a user
+provided argument. It will only be called if the Suricata rate filter
+modified the action:
+
+.. literalinclude:: ../../../../../src/detect.h
+   :language: c
+   :start-at:  * \brief Function type for rate filter callback.
+   :end-at: );
+   :prepend: /**
+
+Callback Registration
+=====================
+
+To register the rate filter callback, use the
+``SCDetectEngineRegisterRateFilterCallback`` function with your
+callback and a user provided argument which will be provided to the
+callback.
+
+.. literalinclude:: ../../../../../src/detect.h
+   :language: c
+   :start-at:  * \brief Register a callback when a rate_filter
+   :end-at: );
+   :prepend: /**