rust: add bindings to SCPlugin.* to sys crate

Also disable bindgen's generated layout tests.  They are valid for the
platform generating the tests, but may not be valid for other
platforms. For example, if the tests are generated on a 64 bit
platform the tests will not be valid when run on a 32 bit platform as
pointers are a different size.

However, the generating bindings are valid for both platform.

Ticket: #7341
pull/12590/head
Jason Ish 1 month ago committed by Victor Julien
parent 9b73de6f6d
commit 10ede91536

@ -110,10 +110,13 @@ if HAVE_BINDGEN
$(BINDGEN) \
-o sys/src/sys.rs \
--rust-target 1.68 \
--no-layout-tests \
--disable-header-comment \
--default-enum-style rust \
--allowlist-type 'AppProto.*' \
--allowlist-function 'AppProto.*' \
--allowlist-type 'SC.*' \
--allowlist-function 'SC.*' \
$(abs_top_srcdir)/src/bindgen.h \
-- \
-DHAVE_CONFIG_H -I../src -I../rust/gen $(CPPFLAGS)

@ -54,3 +54,74 @@ extern "C" {
alproto: AppProto, proto_name: *const ::std::os::raw::c_char,
);
}
#[doc = " Structure to define a Suricata plugin."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SCPlugin_ {
pub name: *const ::std::os::raw::c_char,
pub license: *const ::std::os::raw::c_char,
pub author: *const ::std::os::raw::c_char,
pub Init: ::std::option::Option<unsafe extern "C" fn()>,
}
#[doc = " Structure to define a Suricata plugin."]
pub type SCPlugin = SCPlugin_;
pub type SCPluginRegisterFunc = ::std::option::Option<unsafe extern "C" fn() -> *mut SCPlugin>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SCCapturePlugin_ {
pub name: *mut ::std::os::raw::c_char,
pub Init: ::std::option::Option<
unsafe extern "C" fn(
args: *const ::std::os::raw::c_char,
plugin_slot: ::std::os::raw::c_int,
receive_slot: ::std::os::raw::c_int,
decode_slot: ::std::os::raw::c_int,
),
>,
pub ThreadInit: ::std::option::Option<
unsafe extern "C" fn(
ctx: *mut ::std::os::raw::c_void,
thread_id: ::std::os::raw::c_int,
thread_ctx: *mut *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int,
>,
pub ThreadDeinit: ::std::option::Option<
unsafe extern "C" fn(
ctx: *mut ::std::os::raw::c_void,
thread_ctx: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int,
>,
pub GetDefaultMode:
::std::option::Option<unsafe extern "C" fn() -> *const ::std::os::raw::c_char>,
pub entries: SCCapturePlugin___bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SCCapturePlugin___bindgen_ty_1 {
pub tqe_next: *mut SCCapturePlugin_,
pub tqe_prev: *mut *mut SCCapturePlugin_,
}
pub type SCCapturePlugin = SCCapturePlugin_;
extern "C" {
pub fn SCPluginRegisterCapture(arg1: *mut SCCapturePlugin) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SCAppLayerPlugin_ {
pub version: u64,
pub name: *mut ::std::os::raw::c_char,
pub Register: ::std::option::Option<unsafe extern "C" fn()>,
pub KeywordsRegister: ::std::option::Option<unsafe extern "C" fn()>,
pub logname: *mut ::std::os::raw::c_char,
pub confname: *mut ::std::os::raw::c_char,
pub Logger: ::std::option::Option<
unsafe extern "C" fn(
tx: *mut ::std::os::raw::c_void,
jb: *mut ::std::os::raw::c_void,
) -> bool,
>,
}
pub type SCAppLayerPlugin = SCAppLayerPlugin_;
extern "C" {
pub fn SCPluginRegisterAppLayer(arg1: *mut SCAppLayerPlugin) -> ::std::os::raw::c_int;
}

@ -30,5 +30,6 @@
#include "stdbool.h"
#include "app-layer-protos.h"
#include "suricata-plugin.h"
#endif

Loading…
Cancel
Save