]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: add take_until_and_consume replacement function
authorPierre Chifflier <chifflier@wzdftpd.net>
Wed, 30 Oct 2019 16:17:32 +0000 (17:17 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 2 Mar 2020 16:16:42 +0000 (17:16 +0100)
rust/src/common.rs [new file with mode: 0644]
rust/src/lib.rs

diff --git a/rust/src/common.rs b/rust/src/common.rs
new file mode 100644 (file)
index 0000000..3ed1ef3
--- /dev/null
@@ -0,0 +1,12 @@
+#[macro_export]
+macro_rules! take_until_and_consume (
+ ( $i:expr, $needle:expr ) => (
+    {
+      let input: &[u8] = $i;
+
+      let (rem, res) = ::nom::take_until!(input, $needle)?;
+      let (rem, _) = ::nom::take!(rem, $needle.len())?;
+      Ok((rem, res))
+    }
+  );
+);
index e0955b1a41aba3f8bf2a3397fe3a3b0ab1e123f6..81ada2101ccc89f573360db3a48c4686d94529dd 100644 (file)
@@ -40,6 +40,8 @@ pub mod log;
 #[macro_use]
 pub mod core;
 
+#[macro_use]
+pub mod common;
 pub mod conf;
 pub mod json;
 #[macro_use]