[][src]Struct pcap_file::pcap::PacketHeader

pub struct PacketHeader {
    pub ts_sec: u32,
    pub ts_nsec: u32,
    pub incl_len: u32,
    pub orig_len: u32,
}

Describes a pcap packet header.

Fields

ts_sec: u32

Timestamp in seconds

ts_nsec: u32

Nanosecond part of the timestamp

incl_len: u32

Number of octets of the packet saved in file

orig_len: u32

Original length of the packet on the wire

Methods

impl PacketHeader[src]

pub fn new(
    ts_sec: u32,
    ts_nsec: u32,
    incl_len: u32,
    orig_len: u32
) -> PacketHeader
[src]

Create a new PacketHeader with the given parameters.

pub fn from_reader<R: Read, B: ByteOrder>(
    reader: &mut R,
    ts_resolution: TsResolution
) -> Result<PacketHeader, PcapError>
[src]

Create a new PacketHeader from a reader.

pub fn from_slice<B: ByteOrder>(
    slice: &[u8],
    ts_resolution: TsResolution
) -> Result<(&[u8], PacketHeader), PcapError>
[src]

Create a new PacketHeader from a slice.

pub fn write_to<W: Write, B: ByteOrder>(
    &self,
    writer: &mut W,
    ts_resolution: TsResolution
) -> Result<(), PcapError>
[src]

Write a PcapHeader to a writer.

Writes 24B in the writer on success.

pub fn timestamp(&self) -> Duration[src]

Get the timestamp of the packet as a Duration

Trait Implementations

impl Clone for PacketHeader[src]

impl Copy for PacketHeader[src]

impl Default for PacketHeader[src]

impl Eq for PacketHeader[src]

impl PartialEq<PacketHeader> for PacketHeader[src]

impl Debug for PacketHeader[src]

impl StructuralPartialEq for PacketHeader[src]

impl StructuralEq for PacketHeader[src]

Auto Trait Implementations

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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.

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

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

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