Trait smoltcp::phy::PcapSink

source ·
pub trait PcapSink {
    // Required method
    fn write(&mut self, data: &[u8]);

    // Provided methods
    fn flush(&mut self) { ... }
    fn write_u16(&mut self, value: u16) { ... }
    fn write_u32(&mut self, value: u32) { ... }
    fn global_header(&mut self, link_type: PcapLinkType) { ... }
    fn packet_header(&mut self, timestamp: Instant, length: usize) { ... }
    fn packet(&mut self, timestamp: Instant, packet: &[u8]) { ... }
}
Expand description

A packet capture sink.

Required Methods§

source

fn write(&mut self, data: &[u8])

Write data into the sink.

Provided Methods§

source

fn flush(&mut self)

Flush data written into the sync.

source

fn write_u16(&mut self, value: u16)

Write an u16 into the sink, in native byte order.

source

fn write_u32(&mut self, value: u32)

Write an u32 into the sink, in native byte order.

source

fn global_header(&mut self, link_type: PcapLinkType)

Write the libpcap global header into the sink.

This method may be overridden e.g. if special synchronization is necessary.

source

fn packet_header(&mut self, timestamp: Instant, length: usize)

Write the libpcap packet header into the sink.

See also the note for global_header.

Panics

This function panics if length is greater than 65535.

source

fn packet(&mut self, timestamp: Instant, packet: &[u8])

Write the libpcap packet header followed by packet data into the sink.

See also the note for global_header.

Implementors§

source§

impl<T: Write> PcapSink for T