Function mles_utils::read_cid_from_hdr [] [src]

pub fn read_cid_from_hdr(hdrv: &[u8]) -> u32

Read a connection id from header.

Errors

If input vector length is smaller than needed, zero is returned.

Example

use mles_utils::{write_hdr_with_key, write_cid_to_hdr, read_cid_from_hdr};

let mut hdr: Vec<u8> = write_hdr_with_key(12, 0x3f3f3); //cid set to zero
let read_cid = read_cid_from_hdr(&hdr);
assert_eq!(0, read_cid);

hdr = write_cid_to_hdr(hdr);
let read_cid = read_cid_from_hdr(&hdr);
assert_ne!(0, read_cid);