Skip to content

Commit 02c14c9

Browse files
committed
rust/ffi: bindgen thread storage
Ticket: OISF#8445
1 parent e26b1c1 commit 02c14c9

3 files changed

Lines changed: 36 additions & 0 deletions

File tree

rust/sys/src/sys.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,6 +1862,39 @@ extern "C" {
18621862
#[doc = " \\internal\n\n Run all registered flow init callbacks."]
18631863
pub fn SCThreadRunInitCallbacks(tv: *mut ThreadVars);
18641864
}
1865+
#[repr(C)]
1866+
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
1867+
pub struct SCThreadStorageId {
1868+
pub id: ::std::os::raw::c_int,
1869+
}
1870+
extern "C" {
1871+
pub fn SCThreadStorageSize() -> ::std::os::raw::c_uint;
1872+
}
1873+
extern "C" {
1874+
pub fn SCThreadGetStorageById(
1875+
tv: *const ThreadVars, id: SCThreadStorageId,
1876+
) -> *mut ::std::os::raw::c_void;
1877+
}
1878+
extern "C" {
1879+
pub fn SCThreadSetStorageById(
1880+
tv: *mut ThreadVars, id: SCThreadStorageId, ptr: *mut ::std::os::raw::c_void,
1881+
) -> ::std::os::raw::c_int;
1882+
}
1883+
extern "C" {
1884+
pub fn SCThreadFreeStorageById(tv: *mut ThreadVars, id: SCThreadStorageId);
1885+
}
1886+
extern "C" {
1887+
pub fn SCThreadFreeStorage(tv: *mut ThreadVars);
1888+
}
1889+
extern "C" {
1890+
pub fn SCRegisterThreadStorageTests();
1891+
}
1892+
extern "C" {
1893+
pub fn SCThreadStorageRegister(
1894+
name: *const ::std::os::raw::c_char,
1895+
Free: ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void)>,
1896+
) -> SCThreadStorageId;
1897+
}
18651898
extern "C" {
18661899
pub fn SCSRepCatGetByShortname(shortname: *const ::std::os::raw::c_char) -> u8;
18671900
}

src/bindgen.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#include "flow-callbacks.h"
6666

6767
#include "thread-callbacks.h"
68+
#include "thread-storage.h"
6869

6970
#include "reputation.h"
7071
#include "feature.h"

src/thread-storage.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
#ifndef SURICATA_THREAD_STORAGE_H
2323
#define SURICATA_THREAD_STORAGE_H
2424

25+
#ifndef SURICATA_BINDGEN_H
2526
#include "threadvars.h"
27+
#endif
2628

2729
typedef struct SCThreadStorageId {
2830
int id;

0 commit comments

Comments
 (0)