Struct pcap_file::pcap_header::PcapHeader [] [src]

pub struct PcapHeader {
    pub magic_number: u32,
    pub version_major: u16,
    pub version_minor: u16,
    pub ts_correction: i32,
    pub ts_accuracy: u32,
    pub snaplen: u32,
    pub datalink: Datalink,
}

Struct that represent the global Pcap header of a Pcap file

Fields

Magic number

Major version number

Minor version number

GMT to local timezone correction, should always be 0

Timestamp accuracy, should always be 0

Max length of captured packet, typically 65535

Datalink type (first layer in the packet (u32))

Methods

impl PcapHeader
[src]

Creates a new PcapHeader with the following parameters:

PcapHeader {

    magic_number : 0xa1b2c3d4,
    version_major : 2,
    version_minor : 4,
    ts_correction : 0,
    ts_accuracy : 0,
    snaplen : 65535,
    datalink : datalink
};

Parse a Reader and create a new PcapHeader from it if possible

Convert the PcapHeader to a slice of bytes.

Return the endianness of the global header

Panics

Panics if the magic number is invalid

Return the timestamp resolution of the global header

Panics

Panics if the magic number is invalid

Trait Implementations

impl Copy for PcapHeader
[src]

impl Clone for PcapHeader
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for PcapHeader
[src]

Formats the value using the given formatter.