Function capsules::net::sixlowpan_compression::compress
[−]
[src]
pub fn compress(
ctx_store: &ContextStore,
ip6_datagram: &[u8],
src_mac_addr: MacAddress,
dst_mac_addr: MacAddress,
buf: &mut [u8]
) -> Result<(usize, usize), ()>
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() - consumed
bytes must still be copied over to buf
.