Struct etherparse::Ipv4Header[][src]

pub struct Ipv4Header {
    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],
}

IPv4 header without options.

Fields

Methods

impl Ipv4Header
[src]

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

impl Clone for Ipv4Header
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Ipv4Header
[src]

Formats the value using the given formatter. Read more

impl Eq for Ipv4Header
[src]

impl PartialEq for Ipv4Header
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Default for Ipv4Header
[src]

Returns the "default value" for a type. Read more

impl SerializedSize for Ipv4Header
[src]

SERIALIZED_SIZE: usize = 20

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

Auto Trait Implementations

impl Send for Ipv4Header

impl Sync for Ipv4Header