Struct etherparse::UdpHeader

source ·
pub struct UdpHeader {
    pub source_port: u16,
    pub destination_port: u16,
    pub length: u16,
    pub checksum: u16,
}
Expand description

Udp header according to rfc768.

Fields§

§source_port: u16

Source port of the packet (optional).

§destination_port: u16

Destination port of the packet.

§length: u16

Length of the packet (includes the udp header length of 8 bytes).

§checksum: u16

The checksum of the packet. The checksum is calculated from a pseudo header, the udp header and the payload. The pseudo header is composed of source and destination address, protocol number

Implementations§

Returns an udp header for the given parameters

Calculate an udp header given an ipv4 header and the payload

Calculates the upd header checksum based on a ipv4 header.

Calculates the upd header checksum based on a ipv4 header.

Calculate an udp header given an ipv6 header and the payload

Calculates the checksum of the current udp header given an ipv6 header and the payload.

Calculates the checksum of the current udp header given an ipv6 source & destination address plus the payload.

Tries to read an udp header from the current position.

Write the udp header without recalculating the checksum or length.

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

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.