Skip to content

Commit d8bb711

Browse files
committed
rust/ffi: bindgen thread storage
Ticket: OISF#8445
1 parent 211844e commit d8bb711

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
@@ -1860,6 +1860,39 @@ extern "C" {
18601860
#[doc = " \\internal\n\n Run all registered flow init callbacks."]
18611861
pub fn SCThreadRunInitCallbacks(tv: *mut ThreadVars);
18621862
}
1863+
#[repr(C)]
1864+
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
1865+
pub struct SCThreadStorageId {
1866+
pub id: ::std::os::raw::c_int,
1867+
}
1868+
extern "C" {
1869+
pub fn SCThreadStorageSize() -> ::std::os::raw::c_uint;
1870+
}
1871+
extern "C" {
1872+
pub fn SCThreadGetStorageById(
1873+
tv: *const ThreadVars, id: SCThreadStorageId,
1874+
) -> *mut ::std::os::raw::c_void;
1875+
}
1876+
extern "C" {
1877+
pub fn SCThreadSetStorageById(
1878+
tv: *mut ThreadVars, id: SCThreadStorageId, ptr: *mut ::std::os::raw::c_void,
1879+
) -> ::std::os::raw::c_int;
1880+
}
1881+
extern "C" {
1882+
pub fn SCThreadFreeStorageById(tv: *mut ThreadVars, id: SCThreadStorageId);
1883+
}
1884+
extern "C" {
1885+
pub fn SCThreadFreeStorage(tv: *mut ThreadVars);
1886+
}
1887+
extern "C" {
1888+
pub fn SCRegisterThreadStorageTests();
1889+
}
1890+
extern "C" {
1891+
pub fn SCThreadStorageRegister(
1892+
name: *const ::std::os::raw::c_char,
1893+
Free: ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void)>,
1894+
) -> SCThreadStorageId;
1895+
}
18631896
extern "C" {
18641897
pub fn SCSRepCatGetByShortname(shortname: *const ::std::os::raw::c_char) -> u8;
18651898
}

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)