Struct t2plugin::nethdr::Ip4Header

source ·
#[repr(C, packed)]
pub struct Ip4Header { pub tos: u8, pub ttl: u8, /* private fields */ }
Expand description

Fields§

§tos: u8

Type of service in old traffic. DSCP and ECN flags in modern traffic.

§ttl: u8

Packet time to live

Implementations§

source§

impl Ip4Header

source

pub fn version(&self) -> u8

IP version. Must always be 4.

source

pub fn header_len(&self) -> u8

Length of the IPv4 header (with options) in bytes.

source

pub fn packet_len(&self) -> u16

Length of the packet in bytes, starting from the 1st byte of the IPv4 header.

source

pub fn ipid(&self) -> u16

IP identification field, used for grouping fragmented packets.

source

pub fn proto(&self) -> L4Type

Type of the layer 4 header as defined in L4Type.

source

pub fn src_ip(&self) -> Ipv4Addr

IPv4 source address

source

pub fn dst_ip(&self) -> Ipv4Addr

IPv4 destination address

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.