package mirage-types

  1. Overview
  2. Docs
On This Page
  1. Ethernet stack

Ethernet stack

An Ethernet stack that parses frames from a network device and can associate them with IP address via ARP.

type buffer

The type for memory buffers.

type netif

The type for ethernet network interfaces.

type error = [
  1. | `Unknown of string
    (*

    an undiagnosed error

    *)
  2. | `Unimplemented
    (*

    operation not yet implemented in the code

    *)
  3. | `Disconnected
    (*

    the device has been previously disconnected

    *)
]

The type for IO operation errors.

type macaddr

The type for unique MAC identifiers.

include DEVICE with type error := error and type id := netif
type +'a io

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 io

write nf buf outputs buf to netfront nf.

val writev : t -> buffer list -> unit 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 input : arpv4:(buffer -> unit io) -> ipv4:(buffer -> unit io) -> ipv6:(buffer -> unit io) -> t -> buffer -> unit io

FIXME listen nf fn is a blocking operation that calls fn buf with every packet that is read from the interface. It returns as soon as it has initialised, and the function can be stopped by calling disconnect in the device layer.

OCaml

Innovation. Community. Security.