[][src]Trait rawsock::traits::DynamicInterface

pub trait DynamicInterface<'a>: Send + Sync {
    fn send(&self, packet: &[u8]) -> Result<(), Error>;
fn receive<'b>(&'b mut self) -> Result<BorrowedPacket<'b>, Error>;
fn flush(&self);
fn data_link(&self) -> DataLink;
fn stats(&self) -> Result<Stats, Error>;
fn break_loop(&self);
fn loop_infinite_dyn(
        &self,
        callback: &dyn FnMut(&BorrowedPacket)
    ) -> Result<(), Error>; }

Trait for structures representing an opened interface (or network card or network device)

Interfaces are opened using a concrete library - check the Library trait.

Required methods

fn send(&self, packet: &[u8]) -> Result<(), Error>

Sends a raw packet.

fn receive<'b>(&'b mut self) -> Result<BorrowedPacket<'b>, Error>

Receives a raw packet.

fn flush(&self)

Flushes a queue

Provides information about the underlying technology used for this connection.

fn stats(&self) -> Result<Stats, Error>

Provides transmission statistics

fn break_loop(&self)

Breaks previously started loops.

fn loop_infinite_dyn(
    &self,
    callback: &dyn FnMut(&BorrowedPacket)
) -> Result<(), Error>

Runs infinite loop and passes received packets via callback.

Exits when the break_loop() function is called or on error.

Loading content...

Implementors

impl<'a> DynamicInterface<'a> for rawsock::pcap::Interface<'a>[src]

impl<'a> DynamicInterface<'a> for rawsock::pfring::Interface<'a>[src]

impl<'a> DynamicInterface<'a> for rawsock::wpcap::Interface<'a>[src]

Loading content...