Struct smoltcp::wire::UdpPacket [] [src]

pub struct UdpPacket<T: AsRef<[u8]>> { /* fields omitted */ }

A read/write wrapper around an User Datagram Protocol packet buffer.

Methods

impl<T: AsRef<[u8]>> Packet<T>
[src]

[src]

Imbue a raw octet buffer with UDP packet structure.

[src]

Shorthand for a combination of new and check_len.

[src]

Ensure that no accessor method will panic if called. Returns Err(Error::Truncated) if the buffer is too short. Returns Err(Error::Malformed) if the length field has a value smaller than the header length.

The result of this check is invalidated by calling set_len.

[src]

Consume the packet, returning the underlying buffer.

[src]

Return the source port field.

[src]

Return the destination port field.

[src]

Return the length field.

[src]

Return the checksum field.

[src]

Validate the packet checksum.

Panics

This function panics unless src_addr and dst_addr belong to the same family, and that family is IPv4 or IPv6.

Fuzzing

This function always returns true when fuzzing.

impl<'a, T: AsRef<[u8]> + ?Sized> Packet<&'a T>
[src]

[src]

Return a pointer to the payload.

impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T>
[src]

[src]

Set the source port field.

[src]

Set the destination port field.

[src]

Set the length field.

[src]

Set the checksum field.

[src]

Compute and fill in the header checksum.

Panics

This function panics unless src_addr and dst_addr belong to the same family, and that family is IPv4 or IPv6.

impl<'a, T: AsRef<[u8]> + AsMut<[u8]> + ?Sized> Packet<&'a mut T>
[src]

[src]

Return a mutable pointer to the payload.

Trait Implementations

impl<T: Debug + AsRef<[u8]>> Debug for Packet<T>
[src]

[src]

Formats the value using the given formatter.

impl<'a, T: AsRef<[u8]> + ?Sized> Display for Packet<&'a T>
[src]

[src]

Formats the value using the given formatter. Read more

impl<T: AsRef<[u8]>> PrettyPrint for Packet<T>
[src]

[src]

Write a concise, formatted representation of a packet contained in the provided buffer, and any nested packets it may contain. Read more