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]

Wrap a buffer with an UDP packet. Returns an error if the buffer is too small to contain one.

Consumes the packet, returning the underlying buffer.

Return the source port field.

Return the destination port field.

Return the length field.

Return the checksum field.

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.

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

Return a pointer to the payload.

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

Set the source port field.

Set the destination port field.

Set the length field.

Set the checksum field.

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]

Return a mutable pointer to the payload.

Trait Implementations

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

Formats the value using the given formatter.

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

Formats the value using the given formatter.

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

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