mirror of
https://github.com/OISF/suricata.git
synced 2026-05-28 04:32:12 -04:00
rust/ffi: move txdata flags to ffi
Ticket: 7666
This commit is contained in:
parent
2525ea2e37
commit
0773fba5fd
5 changed files with 27 additions and 15 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
10
src/flow.h
10
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 | \
|
||||
|
|
|
|||
Loading…
Reference in a new issue