package mirage-protocols-lwt

  1. Overview
  2. Docs
type error = private [>
  1. | Mirage_protocols.Ethif.error
]

The type for ethernet interface errors.

val pp_error : error Fmt.t

pp_error is the pretty-printer for errors.

type buffer = Cstruct.t

The type for memory buffers.

type macaddr = Macaddr.t

The type for unique MAC identifiers.

include Mirage_device.S with type 'a io = 'a Lwt.t
type 'a io = 'a Lwt.t

The type for potentially blocking I/O operation

type t

The type representing the internal state of the device

val disconnect : t -> unit io

Disconnect from the device. While this might take some time to complete, it can never result in an error.

val write : t -> buffer -> (unit, error) Stdlib.result io

write nf buf outputs buf to netfront nf.

val writev : t -> buffer list -> (unit, error) Stdlib.result io

writev nf bufs output a list of buffers to netfront nf as a single packet.

val mac : t -> macaddr

mac nf is the MAC address of nf.

val mtu : t -> int

mtu nf is the Maximum Transmission Unit of the nf i.e. the maximum size of the payload, not including the ethernet frame header.

val input : arpv4:(buffer -> unit io) -> ipv4:(buffer -> unit io) -> ipv6:(buffer -> unit io) -> t -> buffer -> unit io

listen nf fn is a blocking operation that calls fn buf with every packet that is read from the interface. The function can be stopped by calling disconnect in the device layer.

OCaml

Innovation. Community. Security.