Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Conversion between wire and high-level data
There is a binary wire representation, and a high-level datatype. This module converts between the two. While decoding can result in an error, encoding can not.
type t = {
operation : Arp_wire.op;
source_mac : Macaddr.t;
source_ip : Ipaddr.V4.t;
target_mac : Macaddr.t;
target_ip : Ipaddr.V4.t;
}
The high-level ARP frame consisting of the two address pairs and an operation.
val pp : Stdlib.Format.formatter -> t -> unit
pp ppf t
prints the frame t
on ppf
.
The type of possible errors during decoding
Too_short
if the provided buffer is not long enoughUnusable
if the protocol or hardware address type is not IPv4 and EthernetUnknown_operation
if it is neither a request nor a replyval pp_error : Stdlib.Format.formatter -> error -> unit
pp_error ppf err
prints the error err
on ppf
.
decode buf
attempts to decode the buffer into an ARP frame t
.
val encode : t -> Cstruct.t
encode t
is a buf
, a freshly allocated buffer, which contains the encoded ARP frame t
.
val encode_into : t -> Cstruct.t -> unit
encode_into t buf
encodes t
into the buffer buf
at offset 0.