app-layer: GetTxIteratorFn uses a AppLayerGetTxIterState

Even if every current rust parser uses the u64 variant of the C union
pull/14639/head
Philippe Antoine 10 months ago committed by Victor Julien
parent 4b541b39f2
commit c0d6747e82

@ -145,6 +145,7 @@ if HAVE_BINDGEN
--allowlist-function 'File.*' \
--allowlist-type 'SC.*' \
--allowlist-type 'AppLayerEventType' \
--allowlist-type 'AppLayerGetTxIterState' \
--allowlist-function 'SC.*' \
--allowlist-var 'SC.*' \
--opaque-type 'SCConfNode' \

@ -30,7 +30,8 @@ use crate::core::StreamingBufferConfig;
// AppLayerEvent from this module.
pub use suricata_derive::AppLayerEvent;
use suricata_sys::sys::{
AppLayerDecoderEvents, AppLayerParserState, AppProto, DetectEngineState, GenericVar,
AppLayerDecoderEvents, AppLayerGetTxIterState, AppLayerParserState, AppProto,
DetectEngineState, GenericVar,
};
#[cfg(not(test))]
use suricata_sys::sys::{
@ -512,7 +513,7 @@ pub type GetTxIteratorFn = unsafe extern "C" fn (ipproto: u8, alproto: AppPro
state: *mut c_void,
min_tx_id: u64,
max_tx_id: u64,
istate: &mut u64)
istate: *mut AppLayerGetTxIterState)
-> AppLayerGetTxIterTuple;
pub type GetTxDataFn = unsafe extern "C" fn(*mut c_void) -> *mut AppLayerTxData;
pub type GetStateDataFn = unsafe extern "C" fn(*mut c_void) -> *mut AppLayerStateData;
@ -698,10 +699,10 @@ pub trait State<Tx: Transaction> {
pub unsafe extern "C" fn state_get_tx_iterator<S: State<Tx>, Tx: Transaction>(
_ipproto: u8, _alproto: AppProto, state: *mut std::os::raw::c_void, min_tx_id: u64,
_max_tx_id: u64, istate: &mut u64,
_max_tx_id: u64, istate: *mut AppLayerGetTxIterState,
) -> AppLayerGetTxIterTuple {
let state = cast_pointer!(state, S);
state.get_transaction_iterator(min_tx_id, istate)
state.get_transaction_iterator(min_tx_id, &mut (*istate).un.u64_)
}
/// AppLayerFrameType trait.

@ -985,6 +985,35 @@ extern "C" {
ipproto: *const ::std::os::raw::c_char, alproto_name: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct AppLayerGetTxIterState {
pub un: AppLayerGetTxIterState__bindgen_ty_1,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union AppLayerGetTxIterState__bindgen_ty_1 {
pub ptr: *mut ::std::os::raw::c_void,
pub u64_: u64,
}
impl Default for AppLayerGetTxIterState__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
impl Default for AppLayerGetTxIterState {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
extern "C" {
pub fn SCAppLayerParserReallocCtx(alproto: AppProto) -> ::std::os::raw::c_int;
}

Loading…
Cancel
Save