Crate mles_utils [] [src]

Mles utils library is provided for Mles client and server implementations for easy handling of proper header and message structures.

Structs

Msg

Msg structure

MsgConn

Msg connection structure

ResyncMsg

ResyncMsg structure

Constants

CIDL

CIDL defines the size of the connection id

HDRKEYL

HDRKEYL defines the size of the header + key

HDRL

HDRL defines the size of the header including version, length and timestamp

KEYL

KEYL defines the size of the key

MSGMAXSIZE

Max message size

Functions

addr2str

Do a valid UTF-8 string from a SocketAddr.

do_hash

Do a valid hash for Mles over provided UTF-8 String list.

has_peer

Check if an peer is defined

read_cid_from_hdr

Read a connection id from header.

read_hdr_len

Read received buffer header len.

read_hdr_type

Read received buffer header type.

read_key

Read a key from buffer.

read_key_from_hdr

Read a key from header.

select_cid

Return a connection id from key.

server_run

Run an Mles server

write_cid

Write a random connection id in network byte order.

write_cid_to_hdr

Write a connection id in network byte order to the header.

write_hdr

Write a valid Mles header with specified length to network byte order.

write_hdr_with_key

Write a valid Mles header with specified length and key to network byte order.

write_hdr_without_cid

Write a valid Mles header with specified length to network byte order without cid.

write_key

Write a valid key to network byte order.

write_len_to_hdr

Write a length in network byte order to the header.