|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
use std;
|
|
|
|
|
use core::{STREAM_TOSERVER};
|
|
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
|
pub struct AppLayerGetTxIterTuple {
|
|
|
|
@ -96,3 +97,49 @@ macro_rules!export_tx_set_detect_state {
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug,Default)]
|
|
|
|
|
pub struct TxDetectFlags {
|
|
|
|
|
ts: u64,
|
|
|
|
|
tc: u64,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl TxDetectFlags {
|
|
|
|
|
pub fn set(&mut self, direction: u8, flags: u64) {
|
|
|
|
|
if direction & STREAM_TOSERVER != 0 {
|
|
|
|
|
self.ts = flags;
|
|
|
|
|
} else {
|
|
|
|
|
self.tc = flags;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn get(&self, direction: u8) -> u64 {
|
|
|
|
|
if (direction & STREAM_TOSERVER) != 0 {
|
|
|
|
|
self.ts
|
|
|
|
|
} else {
|
|
|
|
|
self.tc
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
|
macro_rules!export_tx_detect_flags_set {
|
|
|
|
|
($name:ident, $type:ty) => {
|
|
|
|
|
#[no_mangle]
|
|
|
|
|
pub unsafe extern "C" fn $name(tx: *mut std::os::raw::c_void, direction: u8, flags: u64) {
|
|
|
|
|
let tx = &mut *(tx as *mut $type);
|
|
|
|
|
tx.detect_flags.set(direction, flags);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
|
macro_rules!export_tx_detect_flags_get {
|
|
|
|
|
($name:ident, $type:ty) => {
|
|
|
|
|
#[no_mangle]
|
|
|
|
|
pub unsafe extern "C" fn $name(tx: *mut std::os::raw::c_void, direction: u8) -> u64 {
|
|
|
|
|
let tx = &mut *(tx as *mut $type);
|
|
|
|
|
return tx.detect_flags.get(direction);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|