From f3332694e30ff9615835648308e1c276040a6b9e Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Fri, 29 May 2026 17:06:36 -0600 Subject: [PATCH] rust/ffi: bindgen flow storage Ticket: #8447 --- rust/sys/src/sys.rs | 32 ++++++++++++++++++++++++++++++++ src/bindgen.h | 1 + src/flow-storage.h | 2 ++ 3 files changed, 35 insertions(+) diff --git a/rust/sys/src/sys.rs b/rust/sys/src/sys.rs index 0539d3d435..0f0e7d3d65 100644 --- a/rust/sys/src/sys.rs +++ b/rust/sys/src/sys.rs @@ -1919,6 +1919,38 @@ extern "C" { #[doc = " \\internal\n\n Run all registered flow init callbacks."] pub fn SCFlowRunFinishCallbacks(tv: *mut ThreadVars, f: *mut Flow); } +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct SCFlowStorageId { + pub id: ::std::os::raw::c_int, +} +extern "C" { + pub fn SCFlowStorageSize() -> ::std::os::raw::c_uint; +} +extern "C" { + pub fn SCFlowGetStorageById(h: *const Flow, id: SCFlowStorageId) + -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn SCFlowSetStorageById( + h: *mut Flow, id: SCFlowStorageId, ptr: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn SCFlowFreeStorageById(h: *mut Flow, id: SCFlowStorageId); +} +extern "C" { + pub fn SCFlowFreeStorage(h: *mut Flow); +} +extern "C" { + pub fn SCRegisterFlowStorageTests(); +} +extern "C" { + pub fn SCFlowStorageRegister( + name: *const ::std::os::raw::c_char, + Free: ::std::option::Option, + ) -> SCFlowStorageId; +} #[doc = " \\brief Function type for thread intialization callbacks.\n\n Once registered by SCThreadRegisterInitCallback, this function will\n be called for every thread being initialized during Suricata\n startup.\n\n \\param tv The ThreadVars struct that has just been initialized.\n \\param user The user data provided when registering the callback."] pub type SCThreadInitCallbackFn = ::std::option::Option< unsafe extern "C" fn(tv: *mut ThreadVars, user: *mut ::std::os::raw::c_void), diff --git a/src/bindgen.h b/src/bindgen.h index d76b60c14e..7432437680 100644 --- a/src/bindgen.h +++ b/src/bindgen.h @@ -62,6 +62,7 @@ #include "flow-bindgen.h" #include "flow-callbacks.h" +#include "flow-storage.h" #include "thread-callbacks.h" #include "thread-storage.h" diff --git a/src/flow-storage.h b/src/flow-storage.h index a13afc3167..b32c7d14f7 100644 --- a/src/flow-storage.h +++ b/src/flow-storage.h @@ -26,7 +26,9 @@ #ifndef SURICATA_FLOW_STORAGE_H #define SURICATA_FLOW_STORAGE_H +#ifndef SURICATA_BINDGEN_H #include "flow.h" +#endif typedef struct SCFlowStorageId { int id;