Struct PcapHeader

Source
pub struct PcapHeader {
    pub magic_number: u32,
    pub version_major: u16,
    pub version_minor: u16,
    pub thiszone: i32,
    pub sigfigs: u32,
    pub snaplen: u32,
    pub network: Linktype,
}
Expand description

PCAP global header

Fields§

§magic_number: u32

File format and byte ordering. If equal to 0xa1b2c3d4 or 0xa1b23c4d then the rest of the file uses native byte ordering. If 0xd4c3b2a1 or 0x4d3cb2a1 (swapped), then all following fields will have to be swapped too.

§version_major: u16

Version major number (currently 2)

§version_minor: u16

Version minor number (currently 4)

§thiszone: i32

The correction time in seconds between GMT (UTC) and the local timezone of the following packet header timestamps

§sigfigs: u32

In theory, the accuracy of time stamps in the capture; in practice, all tools set it to 0

§snaplen: u32

max len of captured packets, in octets

§network: Linktype

Data link type

Implementations§

Source§

impl PcapHeader

Source

pub fn new() -> PcapHeader

Source

pub const fn size(&self) -> usize

Source

pub fn is_bigendian(&self) -> bool

Source

pub fn is_modified_format(&self) -> bool

Source

pub fn is_nanosecond_precision(&self) -> bool

Trait Implementations§

Source§

impl Clone for PcapHeader

Source§

fn clone(&self) -> PcapHeader

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PcapHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PcapHeader

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a> From<&'a PcapHeader> for PcapBlock<'a>

Source§

fn from(b: &'a PcapHeader) -> PcapBlock<'a>

Converts to this type from the input type.
Source§

impl<'a> From<PcapHeader> for PcapBlockOwned<'a>

Source§

fn from(b: PcapHeader) -> PcapBlockOwned<'a>

Converts to this type from the input type.
Source§

impl ToVec for PcapHeader

Available on crate feature serialize only.
Source§

fn to_vec_raw(&self) -> Result<Vec<u8>, GenError>

Serialize to bytes representation (little-endian). Do not check values
Source§

fn to_vec(&mut self) -> Result<Vec<u8>, GenError>

Serialize to bytes representation (little-endian). Check values and fix all fields before serializing.
Source§

fn fix(&mut self)

Check and correct all fields: use magic, fix lengths fields and other values if possible.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.