Skip to content

Commit

Permalink
Add recv_blocking_with_flags (AFLplusplus#2102)
Browse files Browse the repository at this point in the history
* add recv_blocking_with_flags

* rollback, whoops
  • Loading branch information
addisoncrump authored Apr 26, 2024
1 parent abcb2bf commit c2e0e8d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions libafl_bolts/src/llmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down Expand Up @@ -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<Self, Error> {
Expand Down

0 comments on commit c2e0e8d

Please sign in to comment.