pub trait Ipv4Header {
// Required method
fn get_header_prefix(&self) -> &HeaderPrefix;
// Provided methods
fn dscp_and_ecn(&self) -> DscpAndEcn { ... }
fn id(&self) -> u16 { ... }
fn df_flag(&self) -> bool { ... }
fn mf_flag(&self) -> bool { ... }
fn fragment_offset(&self) -> FragmentOffset { ... }
fn fragment_type(&self) -> Ipv4FragmentType { ... }
fn ttl(&self) -> u8 { ... }
fn proto(&self) -> Ipv4Proto { ... }
fn src_ip(&self) -> Ipv4Addr { ... }
fn dst_ip(&self) -> Ipv4Addr { ... }
fn builder(&self) -> Ipv4PacketBuilder { ... }
}
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§
Sourcefn get_header_prefix(&self) -> &HeaderPrefix
fn get_header_prefix(&self) -> &HeaderPrefix
Gets a reference to the IPv4 HeaderPrefix
.
Provided Methods§
Sourcefn dscp_and_ecn(&self) -> DscpAndEcn
fn dscp_and_ecn(&self) -> DscpAndEcn
The Differentiated Services Code Point (DSCP) and the Explicit Congestion Notification (ECN).
Sourcefn fragment_offset(&self) -> FragmentOffset
fn fragment_offset(&self) -> FragmentOffset
The fragment offset.
Sourcefn fragment_type(&self) -> Ipv4FragmentType
fn fragment_type(&self) -> Ipv4FragmentType
The fragment type.
p.fragment_type()
returns Ipv4FragmentType::InitialFragment
if
p.fragment_offset() == 0
and Ipv4FragmentType::NonInitialFragment
otherwise.
Sourcefn proto(&self) -> Ipv4Proto
fn proto(&self) -> Ipv4Proto
The IP Protocol.
proto
returns the Ipv4Proto
from the protocol field.
Sourcefn builder(&self) -> Ipv4PacketBuilder
fn builder(&self) -> Ipv4PacketBuilder
Construct a builder with the same contents as this header.