pub struct Ipv4HeaderSlice<'a> { /* private fields */ }
Expand description

A slice containing an ipv4 header of a network package.

Implementations§

Creates a slice containing an ipv4 header (including header options).

Returns the slice containing the ipv4 header

Read the “version” field of the IPv4 header (should be 4).

Read the “ip header length” (length of the ipv4 header + options in multiples of 4 bytes).

Read the “differentiated_services_code_point” from the slice.

Read the “explicit_congestion_notification” from the slice.

Read the “total length” from the slice (total length of ip header + payload).

Determine the payload length based on the ihl & total_length field of the header.

Read the “identification” field from the slice.

Read the “dont fragment” flag from the slice.

Read the “more fragments” flag from the slice.

Read the “fragment_offset” field from the slice.

Read the “time_to_live” field from the slice.

Read the “protocol” field from the slice.

Read the “header checksum” field from the slice.

Returns a slice containing the ipv4 source address.

Return the ipv4 source address as an std::net::Ipv4Addr

Returns a slice containing the ipv4 source address.

Return the ipv4 destination address as an std::net::Ipv4Addr

Returns a slice containing the ipv4 header options (empty when there are no options).

Returns true if the payload is fragmented.

Either data is missing (more_fragments set) or there is an fragment offset.

Decode all the fields and copy the results to a Ipv4Header struct

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.