Struct smoltcp::wire::SixlowpanUdpNhcPacket
source · pub struct SixlowpanUdpNhcPacket<T: AsRef<[u8]>> { /* private fields */ }
Expand description
A read/write wrapper around a 6LoWPAN_NHC UDP frame. RFC 6282 § 4.3 specifies the format of the header.
The base header has the following formath:
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 1 | 1 | 1 | 1 | 0 | C | P |
+---+---+---+---+---+---+---+---+
With:
- C: checksum, specifies if the checksum is elided.
- P: ports, specifies if the ports are elided.
Implementations§
source§impl<T: AsRef<[u8]>> UdpNhcPacket<T>
impl<T: AsRef<[u8]>> UdpNhcPacket<T>
sourcepub const fn new_unchecked(buffer: T) -> Self
pub const fn new_unchecked(buffer: T) -> Self
Input a raw octet buffer with a LOWPAN_NHC frame structure for UDP.
sourcepub fn new_checked(buffer: T) -> Result<Self>
pub fn new_checked(buffer: T) -> Result<Self>
Shorthand for a combination of new_unchecked and check_len.
sourcepub fn check_len(&self) -> Result<()>
pub fn check_len(&self) -> Result<()>
Ensure that no accessor method will panic if called.
Returns Err(Error::Truncated)
if the buffer is too short.
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the frame, returning the underlying buffer.