pub struct SixlowpanIphcRepr {
pub src_addr: Address,
pub ll_src_addr: Option<Address>,
pub dst_addr: Address,
pub ll_dst_addr: Option<Address>,
pub next_header: NextHeader,
pub hop_limit: u8,
pub ecn: Option<u8>,
pub dscp: Option<u8>,
pub flow_label: Option<u16>,
}Expand description
The fields of a 6LoWPAN IPHC header.
The link-layer addresses decide how much of each IPv6 address is elided,
so they are part of the header’s fields: parse restores
elided bits from them and emit elides against them.
The header always starts 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 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+The fields that are not fully elided follow it inline.
Fields§
§src_addr: Address§ll_src_addr: Option<Address>§dst_addr: Address§ll_dst_addr: Option<Address>§next_header: NextHeader§hop_limit: u8§ecn: Option<u8>§dscp: Option<u8>§flow_label: Option<u16>Implementations§
Source§impl Repr
impl Repr
Sourcepub fn parse(
buf: &[u8],
ll_src_addr: Option<LlAddress>,
ll_dst_addr: Option<LlAddress>,
addr_context: &[AddressContext],
) -> Result<(Self, usize)>
pub fn parse( buf: &[u8], ll_src_addr: Option<LlAddress>, ll_dst_addr: Option<LlAddress>, addr_context: &[AddressContext], ) -> Result<(Self, usize)>
Parse an IPHC header from the front of buf.
Returns the header and its length. ll_src_addr and ll_dst_addr are
the link-layer addresses of the frame the header arrived in, and
addr_context the address contexts, indexed by context identifier.
Elided address bits are restored from them.
Errors:
Errorif the buffer is too short, is not an IPHC header, an encoding is reserved or unsupported, or an address refers to a context or link-layer address that is not there.
Sourcepub fn buffer_len(&self) -> usize
pub fn buffer_len(&self) -> usize
Return the length of the header this will emit.
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. The traffic
class and flow label are always elided.
§Panics
Panics if buf is shorter than buffer_len.