Struct libafl::bolts::llmp::LlmpSender[][src]

pub struct LlmpSender<SP> where
    SP: ShMemProvider
{ pub id: u32, pub last_msg_sent: *const LlmpMsg, pub out_maps: Vec<LlmpSharedMap<SP::Mem>>, pub keep_pages_forever: bool, // some fields omitted }

Sending end on a (unidirectional) sharedmap channel

Fields

id: u32

ID of this sender. Only used in the broker.

last_msg_sent: *const LlmpMsg

Ref to the last message this sender sent on the last page. If null, a new page (just) started.

out_maps: Vec<LlmpSharedMap<SP::Mem>>

A vec of page wrappers, each containing an intialized AfShmem

keep_pages_forever: bool

If true, pages will never be pruned. The broker uses this feature. By keeping the message history around, new clients may join at any time in the future.

Implementations

impl<SP> LlmpSender<SP> where
    SP: ShMemProvider
[src]

An actor on the sending part of the shared map

pub fn new(
    shmem_provider: SP,
    id: u32,
    keep_pages_forever: bool
) -> Result<Self, Error>
[src]

Create a new LlmpSender using a given ShMemProvider, and id. If keep_pages_forever is true, ShMem will never be freed. If it is false, the pages will be unmapped once they are full, and have been mapped by at least one LlmpReceiver.

pub unsafe fn reset(&mut self)[src]

Completely reset the current sender map. Afterwards, no receiver should read from it at a different location. This is only useful if all connected llmp parties start over, for example after a crash.

Safety

Only safe if you really really restart the page on everything connected

pub fn on_existing_from_env(
    shmem_provider: SP,
    env_name: &str
) -> Result<Self, Error>
[src]

Reattach to a vacant out_map, to with a previous sender stored the information in an env before.

pub fn to_env(&self, env_name: &str) -> Result<(), Error>[src]

Store the info to this sender to env. A new client can reattach to it using LlmpSender::on_existing_from_env().

pub fn await_save_to_unmap_blocking(&self)[src]

Waits for this sender to be save to unmap. If a receiver is involved, this function should always be called.

pub fn save_to_unmap(&self) -> bool[src]

If we are allowed to unmap this client

pub fn on_existing_map(
    shmem_provider: SP,
    current_out_map: SP::Mem,
    last_msg_sent_offset: Option<u64>
) -> Result<Self, Error>
[src]

Reattach to a vacant out_map. It is essential, that the receiver (or someone else) keeps a pointer to this map else reattach will get a new, empty page, from the OS, or fail.

pub fn alloc_next(&mut self, buf_len: usize) -> Result<*mut LlmpMsg, Error>[src]

Allocates the next space on this sender page

pub unsafe fn cancel_send(&mut self, msg: *mut LlmpMsg)[src]

Cancel send of the next message, this allows us to allocate a new message without sending this one.

Safety

They msg pointer may no longer be used after cancel_send

pub fn send_buf(&mut self, tag: Tag, buf: &[u8]) -> Result<(), Error>[src]

Allocates a message of the given size, tags it, and sends it off.

pub fn send_buf_with_flags(
    &mut self,
    tag: Tag,
    flags: Flags,
    buf: &[u8]
) -> Result<(), Error>
[src]

Send a buf with the given flags.

pub fn describe(&self) -> Result<LlmpDescription, Error>[src]

Describe this LlmpClient in a way that it can be restored later, using Self::on_existing_from_description.

pub fn on_existing_from_description(
    shmem_provider: SP,
    description: &LlmpDescription
) -> Result<Self, Error>
[src]

Create this client on an existing map from the given description. Acquired with [self.describe].

Trait Implementations

impl<SP: Debug> Debug for LlmpSender<SP> where
    SP: ShMemProvider,
    SP::Mem: Debug
[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<SP> RefUnwindSafe for LlmpSender<SP> where
    SP: RefUnwindSafe,
    <SP as ShMemProvider>::Mem: RefUnwindSafe

impl<SP> !Send for LlmpSender<SP>

impl<SP> !Sync for LlmpSender<SP>

impl<SP> Unpin for LlmpSender<SP> where
    SP: Unpin,
    <SP as ShMemProvider>::Mem: Unpin

impl<SP> UnwindSafe for LlmpSender<SP> where
    SP: UnwindSafe,
    <SP as ShMemProvider>::Mem: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.