Struct smoltcp::wire::SixlowpanFragPacket
source · pub struct SixlowpanFragPacket<T: AsRef<[u8]>> { /* private fields */ }
Expand description
A read/write wrapper around a 6LoWPAN Fragment header. RFC 4944 § 5.3 specifies the format of the header.
A First Fragment header has the following format:
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1 1 0 0 0| datagram_size | datagram_tag |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Subsequent fragment headers have the following format:
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1 1 1 0 0| datagram_size | datagram_tag |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|datagram_offset|
+-+-+-+-+-+-+-+-+
Implementations§
source§impl<T: AsRef<[u8]>> Packet<T>
impl<T: AsRef<[u8]>> Packet<T>
sourcepub const fn new_unchecked(buffer: T) -> Self
pub const fn new_unchecked(buffer: T) -> Self
Input a raw octet buffer with a 6LoWPAN Fragment header structure.
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)
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.
sourcepub fn datagram_size(&self) -> u16
pub fn datagram_size(&self) -> u16
Return the total datagram size.
sourcepub fn datagram_tag(&self) -> u16
pub fn datagram_tag(&self) -> u16
Return the datagram tag.
sourcepub fn datagram_offset(&self) -> u8
pub fn datagram_offset(&self) -> u8
Return the datagram offset.
sourcepub fn is_first_fragment(&self) -> bool
pub fn is_first_fragment(&self) -> bool
Returns true
when this header is from the first fragment of a link.
sourcepub fn get_key(&self, ieee802154_repr: &Ieee802154Repr) -> Key
pub fn get_key(&self, ieee802154_repr: &Ieee802154Repr) -> Key
Returns the key for identifying the packet it belongs to.