]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: BIT_U16 macro utility
authorPhilippe Antoine <contact@catenacyber.fr>
Tue, 8 Dec 2020 13:53:01 +0000 (14:53 +0100)
committerPhilippe Antoine <contact@catenacyber.fr>
Sun, 24 Jan 2021 19:40:14 +0000 (20:40 +0100)
rust/src/core.rs
rust/src/filecontainer.rs

index 07e49be071cf804563d5ddc52c8c9b5dfd8bcc24..db929303217abe8caec3ed35225e09facdd1aa1f 100644 (file)
@@ -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
+}
index 7d0fc9d6fcff1455fb2e7bf8d0f45de9e439b37d..3c325e85ac478f0d127f93188d90eb7146791c22 100644 (file)
@@ -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