Struct smoltcp::wire::SixlowpanIphcPacket
source · pub struct SixlowpanIphcPacket<T: AsRef<[u8]>> { /* private fields */ }
Expand description
A read/write wrapper around a 6LoWPAN IPHC header. RFC 6282 § 3.1 specifies the format of the header.
The header always start with the following base format (from RFC 6282 § 3.1.1):
0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 0 | 1 | 1 | TF |NH | HLIM |CID|SAC| SAM | M |DAC| DAM |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
With:
- TF: Traffic Class and Flow Label
- NH: Next Header
- HLIM: Hop Limit
- CID: Context Identifier Extension
- SAC: Source Address Compression
- SAM: Source Address Mode
- M: Multicast Compression
- DAC: Destination Address Compression
- DAM: Destination Address Mode
Depending on the flags in the base format, the following fields are added to the header:
- Traffic Class and Flow Label
- Next Header
- Hop Limit
- IPv6 source address
- IPv6 destinatino address
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 IPHC 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 next_header(&self) -> NextHeader
pub fn next_header(&self) -> NextHeader
Return the Next Header field.
sourcepub fn src_context_id(&self) -> Option<u8>
pub fn src_context_id(&self) -> Option<u8>
Return the Source Context Identifier.
sourcepub fn dst_context_id(&self) -> Option<u8>
pub fn dst_context_id(&self) -> Option<u8>
Return the Destination Context Identifier.
sourcepub fn dscp_field(&self) -> Option<u8>
pub fn dscp_field(&self) -> Option<u8>
Return the DSCP field (when it is inlined).
sourcepub fn flow_label_field(&self) -> Option<u16>
pub fn flow_label_field(&self) -> Option<u16>
Return the flow label field (when it is inlined).
sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Return the length of the header.