package tcpip

  1. Overview
  2. Docs
type error = string
val into_cstruct : t -> Cstruct.t -> payload:Cstruct.t -> (unit, error) result

into_cstruct t buf ~payload generates an ICMPv4 header from t and writes it into buf at offset 0. payload is used to calculate the ICMPv4 header checksum, but is not included in the generated buffer. into_cstruct may fail if the buffer is of insufficient size.

val make_cstruct : t -> payload:Cstruct.t -> Cstruct.t

make_cstruct t ~payload allocates, fills, and returns a Cstruct.t with the header information from t. The payload is used to calculate the ICMPv4 header checksum, but is not included in the generated buffer. make_cstruct allocates 8 bytes for the ICMPv4 header.

OCaml

Innovation. Community. Security.