From c2e0e8ddbe75fd06040bff944d1076e41680e364 Mon Sep 17 00:00:00 2001 From: Addison Crump Date: Fri, 26 Apr 2024 16:22:32 +0200 Subject: [PATCH] Add recv_blocking_with_flags (#2102) * add recv_blocking_with_flags * rollback, whoops --- libafl_bolts/src/llmp.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/libafl_bolts/src/llmp.rs b/libafl_bolts/src/llmp.rs index c769117b43..b024ae89a0 100644 --- a/libafl_bolts/src/llmp.rs +++ b/libafl_bolts/src/llmp.rs @@ -1775,6 +1775,21 @@ where } } + /// Receive the buffer, also reading the LLMP internal message flags + #[allow(clippy::type_complexity)] + #[inline] + pub fn recv_buf_blocking_with_flags(&mut self) -> Result<(ClientId, Tag, Flags, &[u8]), Error> { + unsafe { + let msg = self.recv_blocking()?; + Ok(( + (*msg).sender, + (*msg).tag, + (*msg).flags, + (*msg).try_as_slice(&mut self.current_recv_shmem)?, + )) + } + } + /// Returns the next sender, tag, buf, looping until it becomes available #[inline] pub fn recv_buf_blocking(&mut self) -> Result<(ClientId, Tag, &[u8]), Error> { @@ -3222,6 +3237,12 @@ where self.receiver.recv_buf_with_flags() } + /// Receive a `buf` from the broker, including the `flags` used during transmission. + #[allow(clippy::type_complexity)] + pub fn recv_buf_blocking_with_flags(&mut self) -> Result<(ClientId, Tag, Flags, &[u8]), Error> { + self.receiver.recv_buf_blocking_with_flags() + } + #[cfg(feature = "std")] /// Creates a new [`LlmpClient`], reading the map id and len from env pub fn create_using_env(mut shmem_provider: SP, env_var: &str) -> Result {