Struct etherparse::Ipv4Header

source ·
pub struct Ipv4Header {
Show 13 fields pub header_length: u8, pub differentiated_services_code_point: u8, pub explicit_congestion_notification: u8, pub total_length: u16, pub identification: u16, pub dont_fragment: bool, pub more_fragments: bool, pub fragments_offset: u16, pub time_to_live: u8, pub protocol: u8, pub header_checksum: u16, pub source: [u8; 4], pub destination: [u8; 4],
}
Expand description

IPv4 header without options.

Fields§

§header_length: u8§differentiated_services_code_point: u8§explicit_congestion_notification: u8§total_length: u16§identification: u16§dont_fragment: bool§more_fragments: bool§fragments_offset: u16§time_to_live: u8§protocol: u8§header_checksum: u16§source: [u8; 4]§destination: [u8; 4]

Implementations§

Constructs an Ipv4Header with standard values for non specified values. Note: This header calculates the checksum assuming that there are no ipv4 options. In case there are calculate the checksum using the “calc_header_checksum” method.

Reads an IPv4 header from the current position.

Reads an IPv4 header assuming the version & ihl field have already been read.

Skips the ipv4 header options based on the header length.

Writes a given IPv4 header to the current position (this method automatically calculates the header length and checksum).

Writes a given IPv4 header to the current position (this method just writes the specified checksum and header_length and does note compute it).

Calculate header checksum of the current ipv4 header.

Sets the field total_length based on the size of the payload and the options. Returns an error if the payload is too big to fit.

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
Returns the “default value” for a type. 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

Size of the header itself (without options) in bytes.

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.