diff --git a/rust/ffi/src/applayer.rs b/rust/ffi/src/applayer.rs index 876a485f44..7b0f9c927c 100644 --- a/rust/ffi/src/applayer.rs +++ b/rust/ffi/src/applayer.rs @@ -63,6 +63,18 @@ pub const APP_LAYER_PARSER_SFRAME_TC: u16 = 1 << 10; /* Flags for AppLayerParserProtoCtx. */ pub const APP_LAYER_PARSER_OPT_ACCEPT_GAPS: u32 = 1 << 0; +// Other flags are defined in C app-layer-parser.h +/** should inspection be skipped in that direction */ +pub const APP_LAYER_TX_SKIP_INSPECT_TS: u8 = 1 << 0; +pub const APP_LAYER_TX_SKIP_INSPECT_TC: u8 = 1 << 1; + +// Other flags are defined in C flow.h +/* File flags */ +pub const FLOWFILE_NO_STORE_TS: u16 = 1 << 2; +pub const FLOWFILE_NO_STORE_TC: u16 = 1 << 3; +pub const FLOWFILE_STORE_TS: u16 = 1 << 12; +pub const FLOWFILE_STORE_TC: u16 = 1 << 13; + pub trait AppLayerResultRust { fn ok() -> Self; fn err() -> Self; diff --git a/rust/src/applayer.rs b/rust/src/applayer.rs index 1460509535..67b5f3c949 100644 --- a/rust/src/applayer.rs +++ b/rust/src/applayer.rs @@ -104,11 +104,9 @@ impl Drop for AppLayerTxData { } -// need to keep in sync with C flow.h -pub const FLOWFILE_NO_STORE_TS: u16 = BIT_U16!(2); -pub const FLOWFILE_NO_STORE_TC: u16 = BIT_U16!(3); -pub const FLOWFILE_STORE_TS: u16 = BIT_U16!(12); -pub const FLOWFILE_STORE_TC: u16 = BIT_U16!(13); +pub use suricata_ffi::applayer::{ + FLOWFILE_NO_STORE_TS, FLOWFILE_NO_STORE_TC, FLOWFILE_STORE_TS, FLOWFILE_STORE_TC, +}; #[no_mangle] pub unsafe extern "C" fn SCTxDataUpdateFileFlags(txd: &mut suricata_sys::sys::AppLayerTxData, state_flags: u16) { @@ -320,10 +318,9 @@ pub use suricata_ffi::applayer::{ APP_LAYER_PARSER_BYPASS_READY, APP_LAYER_PARSER_EOF_TC, APP_LAYER_PARSER_EOF_TS, APP_LAYER_PARSER_NO_INSPECTION, APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD, APP_LAYER_PARSER_NO_REASSEMBLY, APP_LAYER_PARSER_OPT_ACCEPT_GAPS, + APP_LAYER_TX_SKIP_INSPECT_TS, APP_LAYER_TX_SKIP_INSPECT_TC, }; -pub const APP_LAYER_TX_SKIP_INSPECT_TS: u8 = BIT_U8!(0); -pub const APP_LAYER_TX_SKIP_INSPECT_TC: u8 = BIT_U8!(1); pub const _APP_LAYER_TX_INSPECTED_TS: u8 = BIT_U8!(2); pub const _APP_LAYER_TX_INSPECTED_TC: u8 = BIT_U8!(3); pub const APP_LAYER_TX_ACCEPT: u8 = BIT_U8!(4); diff --git a/rust/src/core.rs b/rust/src/core.rs index 956b67542b..b811d56e2e 100644 --- a/rust/src/core.rs +++ b/rust/src/core.rs @@ -44,9 +44,9 @@ macro_rules!BIT_U8 { ($x:expr) => (1 << $x); } -macro_rules!BIT_U16 { +/*unused macro_rules!BIT_U16 { ($x:expr) => (1 << $x); -} +}*/ macro_rules!BIT_U32 { ($x:expr) => (1 << $x); diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index 736a8ecb9a..2a797f5aee 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -44,8 +44,9 @@ typedef struct AppLayerGetFileState AppLayerGetFileState; /* for use with the detect_progress_ts|detect_progress_tc fields */ /** should inspection be skipped in that direction */ -#define APP_LAYER_TX_SKIP_INSPECT_TS BIT_U8(0) -#define APP_LAYER_TX_SKIP_INSPECT_TC BIT_U8(1) +// defined in rust +// #define APP_LAYER_TX_SKIP_INSPECT_TS BIT_U8(0) +// #define APP_LAYER_TX_SKIP_INSPECT_TC BIT_U8(1) /** is tx fully inspected? */ #define APP_LAYER_TX_INSPECTED_TS BIT_U8(2) #define APP_LAYER_TX_INSPECTED_TC BIT_U8(3) diff --git a/src/flow.h b/src/flow.h index 887eaa39a9..75dce38f68 100644 --- a/src/flow.h +++ b/src/flow.h @@ -130,8 +130,9 @@ typedef struct AppLayerParserState_ AppLayerParserState; #define FLOWFILE_NO_MAGIC_TC BIT_U16(1) /** even if the flow has files, don't store 'm */ -#define FLOWFILE_NO_STORE_TS BIT_U16(2) -#define FLOWFILE_NO_STORE_TC BIT_U16(3) +// defined in rust +// #define FLOWFILE_NO_STORE_TS BIT_U16(2) +// #define FLOWFILE_NO_STORE_TC BIT_U16(3) /** no md5 on files in this flow */ #define FLOWFILE_NO_MD5_TS BIT_U16(4) #define FLOWFILE_NO_MD5_TC BIT_U16(5) @@ -147,8 +148,9 @@ typedef struct AppLayerParserState_ AppLayerParserState; // vacancy(2) /** store files in the flow */ -#define FLOWFILE_STORE_TS BIT_U16(12) -#define FLOWFILE_STORE_TC BIT_U16(13) +// defined in rust +// #define FLOWFILE_STORE_TS BIT_U16(12) +// #define FLOWFILE_STORE_TC BIT_U16(13) #define FLOWFILE_NONE_TS \ (FLOWFILE_NO_MAGIC_TS | FLOWFILE_NO_STORE_TS | FLOWFILE_NO_MD5_TS | FLOWFILE_NO_SHA1_TS | \