Struct pcap_file::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 represents 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:

Be careful when using this code, it's not being tested!
PcapHeader {

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

[src]

Parses a Reader and creates a new PcapHeader from it if possible

[src]

Convert a PcapHeader to a Vec<u8>.

[src]

Return the endianness of the global header

Panics

Panics if the magic number is invalid

[src]

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]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for PcapHeader
[src]

[src]

Formats the value using the given formatter.

impl Eq for PcapHeader
[src]

impl PartialEq for PcapHeader
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Default for PcapHeader
[src]

[src]

Returns the "default value" for a type. Read more