pub enum SixlowpanFragRepr {
FirstFragment {
size: u16,
tag: u16,
},
Fragment {
size: u16,
tag: u16,
offset: u8,
},
}Expand description
The fields of a 6LoWPAN fragment header.
A first fragment header has the following format (RFC 4944 § 5.3):
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|
+-+-+-+-+-+-+-+-+Variants§
Implementations§
Source§impl Repr
impl Repr
Sourcepub fn parse(buf: &[u8]) -> Result<Self>
pub fn parse(buf: &[u8]) -> Result<Self>
Parse a fragment header from the front of buf.
Errors:
Errorif the buffer is shorter than the header, or does not start with a fragment header dispatch.
Sourcepub const fn offset(&self) -> u8
pub const fn offset(&self) -> u8
The offset of this fragment, in units of 8 octets. Zero for the first.
Sourcepub const fn is_first_fragment(&self) -> bool
pub const fn is_first_fragment(&self) -> bool
Whether this is the header of a first fragment.
Sourcepub const fn buffer_len(&self) -> usize
pub const fn buffer_len(&self) -> usize
Return the length of the header.
Sourcepub fn key(&self, ieee802154_repr: &Ieee802154Repr) -> Key
pub fn key(&self, ieee802154_repr: &Ieee802154Repr) -> Key
The key identifying the datagram this fragment belongs to.
§Panics
Panics if the MAC header has no source or destination address.
Sourcepub fn emit(&self, buf: &mut [u8])
pub fn emit(&self, buf: &mut [u8])
Write the header into the front of buf.
Writes exactly buffer_len bytes.
§Panics
Panics if buf is shorter than buffer_len.
Trait Implementations§
impl Copy for Repr
impl Eq for Repr
impl StructuralPartialEq for Repr
Auto Trait Implementations§
impl Freeze for Repr
impl RefUnwindSafe for Repr
impl Send for Repr
impl Sync for Repr
impl Unpin for Repr
impl UnsafeUnpin for Repr
impl UnwindSafe for Repr
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