From 333f4f686c7cbe7b4ec320bee793c2e2bb77d1d7 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Fri, 22 May 2026 16:58:23 -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 aecaf19090..adba9fd6cb 100644 --- a/rust/sys/src/sys.rs +++ b/rust/sys/src/sys.rs @@ -1846,6 +1846,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; +} extern "C" { pub fn SCSRepCatGetByShortname(shortname: *const ::std::os::raw::c_char) -> u8; } diff --git a/src/bindgen.h b/src/bindgen.h index 6cbc4881d4..3af9cc40ee 100644 --- a/src/bindgen.h +++ b/src/bindgen.h @@ -63,6 +63,7 @@ #include "flow-bindgen.h" #include "flow-callbacks.h" +#include "flow-storage.h" #include "reputation.h" #include "feature.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;