Struct rpcap::read::PcapReader
[−]
[src]
pub struct PcapReader<R: Read> { /* fields omitted */ }
The PcapReader
struct allows reading packets from a packet capture.
Methods
impl<R: Read> PcapReader<R>
[src]
fn new(reader: R) -> Result<Self, PcapError>
Create a new PcapReader
that reads the packet capture data from the specified Reader
.
fn get_linktype(&self) -> u32
Returns the link type of this packet capture. See Linktype
for the known values.
fn get_snaplen(&self) -> usize
Returns the maximum packet size. Packets larger than this usually get truncated to this size by the recording application.
fn next(&mut self) -> Result<Option<CapturedPacket>, PcapError>
This function allows iterating over the packets in the packet capture, in a similar fashion to normal iterators. (The exact interface is unfortunately incompatible.)
Returns Ok(None)
on EOF, or a packet as long as one is available.