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.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Packet<T>where
T: Freeze,
impl<T> RefUnwindSafe for Packet<T>where
T: RefUnwindSafe,
impl<T> Send for Packet<T>where
T: Send,
impl<T> Sync for Packet<T>where
T: Sync,
impl<T> Unpin for Packet<T>where
T: Unpin,
impl<T> UnwindSafe for Packet<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more