From: Philippe Antoine Date: Tue, 8 Dec 2020 13:53:01 +0000 (+0100) Subject: rust: BIT_U16 macro utility X-Git-Tag: suricata-7.0.0-beta1~1840 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e46b5d1001d61da2131c42554eff10b7400ad81;p=thirdparty%2Fsuricata.git rust: BIT_U16 macro utility --- diff --git a/rust/src/core.rs b/rust/src/core.rs index 07e49be071..db92930321 100644 --- a/rust/src/core.rs +++ b/rust/src/core.rs @@ -48,6 +48,10 @@ pub static mut ALPROTO_FAILED : AppProto = 0; // updated during init pub const IPPROTO_TCP : i32 = 6; pub const IPPROTO_UDP : i32 = 17; +macro_rules!BIT_U16 { + ($x:expr) => (1 << $x); +} + macro_rules!BIT_U32 { ($x:expr) => (1 << $x); } @@ -219,4 +223,4 @@ impl Flow { std::time::Duration::new(secs, usecs as u32 * 1000) } } -} \ No newline at end of file +} diff --git a/rust/src/filecontainer.rs b/rust/src/filecontainer.rs index 7d0fc9d6fc..3c325e85ac 100644 --- a/rust/src/filecontainer.rs +++ b/rust/src/filecontainer.rs @@ -24,7 +24,7 @@ use crate::core::*; extern { pub fn FileFlowToFlags(flow: *const Flow, flags: u8) -> u16; } -pub const FILE_USE_DETECT: u16 = 0x2000; +pub const FILE_USE_DETECT: u16 = BIT_U16!(13); // Generic file structure, so it can be used by different protocols