pub trait Ipv4Header {
    // Required method
    fn get_header_prefix(&self) -> &HeaderPrefix;

    // Provided methods
    fn dscp(&self) -> u8 { ... }
    fn ecn(&self) -> u8 { ... }
    fn id(&self) -> u16 { ... }
    fn df_flag(&self) -> bool { ... }
    fn mf_flag(&self) -> bool { ... }
    fn fragment_offset(&self) -> u16 { ... }
    fn fragment_type(&self) -> Ipv4FragmentType { ... }
    fn ttl(&self) -> u8 { ... }
    fn proto(&self) -> Ipv4Proto { ... }
    fn src_ip(&self) -> Ipv4Addr { ... }
    fn dst_ip(&self) -> Ipv4Addr { ... }
}
Expand description

Provides common access to IPv4 header fields.

Ipv4Header provides access to IPv4 header fields as a common implementation for both Ipv4Packet and Ipv4PacketRaw.

Required Methods§

source

fn get_header_prefix(&self) -> &HeaderPrefix

Gets a reference to the IPv4 HeaderPrefix.

Provided Methods§

source

fn dscp(&self) -> u8

The Differentiated Services Code Point (DSCP).

source

fn ecn(&self) -> u8

The Explicit Congestion Notification (ECN).

source

fn id(&self) -> u16

The identification.

source

fn df_flag(&self) -> bool

The Don’t Fragment (DF) flag.

source

fn mf_flag(&self) -> bool

The More Fragments (MF) flag.

source

fn fragment_offset(&self) -> u16

The fragment offset.

source

fn fragment_type(&self) -> Ipv4FragmentType

The fragment type.

p.fragment_type() returns Ipv4FragmentType::InitialFragment if p.fragment_offset() == 0 and Ipv4FragmentType::NonInitialFragment otherwise.

source

fn ttl(&self) -> u8

The Time To Live (TTL).

source

fn proto(&self) -> Ipv4Proto

The IP Protocol.

proto returns the Ipv4Proto from the protocol field.

source

fn src_ip(&self) -> Ipv4Addr

The source IP address.

source

fn dst_ip(&self) -> Ipv4Addr

The destination IP address.

Implementors§

source§

impl<B: ByteSlice> Ipv4Header for Ipv4Packet<B>

source§

impl<B: ByteSlice> Ipv4Header for Ipv4PacketRaw<B>