package tcpip

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

into_cstruct t buf writes a 14-byte ethernet header representing t.ethertype, t.src_mac, and t.dst_mac to buf at offset 0. Returns Ok () on success and Error error on failure. Currently, the only possibility for failure is a buf too small to contain the header; to avoid this, provide a buffer of size at least 14.

val make_cstruct : t -> Cstruct.t

given a t, construct and return an Ethernet header representing t.ethertype, t.source, and t.destination. make_cstruct will allocate a new 14 bytes for the Ethernet header it returns.