package macaddr-cstruct

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Convert to and from Cstructs and MAC address.

val of_cstruct : Cstruct.t -> (Macaddr.t, [> `Msg of string ]) Stdlib.result

of_cstruct c parses the 6 octets of c into a MAC address.

val of_cstruct_exn : Cstruct.t -> Macaddr.t

of_cstruct_exn parses the 6 octets of c into a MAC address. Raises Macaddr.Parse_failure on error.

val to_cstruct : ?allocator:(int -> Cstruct.t) -> Macaddr.t -> Cstruct.t

to_cstruct mac is a cstruct of length 4 encoding ipv4. The cstruct is allocated using allocator. If allocator is not provided, Cstruct.create is used.

val write_cstruct_exn : Macaddr.t -> Cstruct.t -> unit

write_cstruct_exn mac cs writes 6 bytes into cs representing the mac address octets. Raises Macaddr.Parse_error if cs is not 6 bytes long.

OCaml

Innovation. Community. Security.