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

pub struct LlmpBroker<SP> where
    SP: ShMemProvider + 'static, 
{ pub llmp_out: LlmpSender<SP>, pub llmp_clients: Vec<LlmpReceiver<SP>>, // some fields omitted }

The broker (node 0)

Fields

llmp_out: LlmpSender<SP>

Broadcast map from broker to all clients

llmp_clients: Vec<LlmpReceiver<SP>>

Users of Llmp can add message handlers in the broker. This allows us to intercept messages right in the broker This keeps the out map clean.

Implementations

impl<SP> LlmpBroker<SP> where
    SP: ShMemProvider + 'static, 
[src]

The broker forwards all messages to its own bus-like broadcast map. It may intercept messages passing through.

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

Create and initialize a new LlmpBroker

pub fn register_client(&mut self, client_page: LlmpSharedMap<SP::Mem>)[src]

Registers a new client for the given sharedmap str and size. Returns the id of the new client in [broker.client_map]

pub fn connect_b2b<A>(&mut self, addr: A) -> Result<(), Error> where
    A: ToSocketAddrs
[src]

Connects to a broker running on another machine. This will spawn a new background thread, registered as client, that proxies all messages to a remote machine. Returns the description of the new page that still needs to be announced/added to the broker afterwards.

pub fn once<F>(&mut self, on_new_msg: &mut F) -> Result<(), Error> where
    F: FnMut(ClientId, Tag, Flags, &[u8]) -> Result<LlmpMsgHookResult, Error>, 
[src]

The broker walks all pages and looks for changes, then broadcasts them on its own shared page, once.

pub fn loop_forever<F>(
    &mut self,
    on_new_msg: &mut F,
    sleep_time: Option<Duration>
) where
    F: FnMut(ClientId, Tag, Flags, &[u8]) -> Result<LlmpMsgHookResult, Error>, 
[src]

Loops infinitely, forwarding and handling all incoming messages from clients. Never returns. Panics on error. 5 millis of sleep can’t hurt to keep busywait not at 100%

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

Broadcasts the given buf to all lients

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

Sends a buf with the given flags.

pub fn launch_tcp_listener_on(
    &mut self,
    port: u16
) -> Result<JoinHandle<()>, Error>
[src]

Launches a thread using a tcp listener socket, on which new clients may connect to this broker Does so on the given port.

pub fn launch_listener(
    &mut self,
    listener: Listener
) -> Result<JoinHandle<()>, Error>
[src]

Launches a thread using a listener socket, on which new clients may connect to this broker

Trait Implementations

impl<SP: Debug> Debug for LlmpBroker<SP> where
    SP: ShMemProvider + 'static, 
[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 LlmpBroker<SP> where
    SP: RefUnwindSafe,
    <SP as ShMemProvider>::Mem: RefUnwindSafe

impl<SP> !Send for LlmpBroker<SP>

impl<SP> !Sync for LlmpBroker<SP>

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

impl<SP> UnwindSafe for LlmpBroker<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.