Function capsules_extra::net::sixlowpan::sixlowpan_compression::compress

source ยท
pub fn compress<'a>(
    ctx_store: &dyn ContextStore,
    ip6_packet: &'a IP6Packet<'a>,
    src_mac_addr: MacAddress,
    dst_mac_addr: MacAddress,
    buf: &mut [u8],
) -> Result<(usize, usize), ()>
Expand description

Compresses an IPv6 header into a 6loWPAN header

Constructs a 6LoWPAN header in buf from the given IPv6 datagram and 16-bit MAC addresses. If the compression was successful, returns Ok((consumed, written)), where consumed is the number of header bytes consumed from the IPv6 datagram written is the number of compressed header bytes written into buf. Payload bytes and non-compressed next headers are not written, so the remaining `buf.len()

  • consumedbytes must still be copied over tobuf`.