pub struct Icmpv4Header {
    pub icmp_type: Icmpv4Type,
    pub checksum: u16,
}
Expand description

A header of an ICMPv4 packet.

What is part of the header depends on the ICMPv4 type and code. But usually the static sized elements are part of the header.

Fields§

§icmp_type: Icmpv4Type

Type & type specific values & code.

§checksum: u16

Checksum in the ICMP header.

Implementations§

Minimum number of bytes/octets an Icmpv4Header takes up in serialized form.

Maximum number of bytes/octets an Icmpv4Header takes up in serialized form.

Currently this number is determined by the biggest supported ICMPv4 header type, which is currently the “Timestamp” and “Timestamp Reply Message”.

Constructs an Icmpv4Header using the given type and the checksum set to 0.

Creates a Icmpv4Header with a checksum calculated based on the given payload.

Reads an icmp4 header from a slice directly and returns a tuple containing the resulting header & unused part of the slice.

Reads an ICMPv4 header from the given reader.

Write the ICMPv4 header to the given writer.

Length in bytes/octets of this header type.

If the ICMP type has a fixed size returns the number of bytes that should be present after the header of this type.

Calculates & updates the checksum in the header.

Note this method assumes that all unused bytes/octets are filled with zeroes.

Converts the header to the on the wire bytes.

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.