package mirage-net

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A network interface that serves Ethernet frames.

type error = private [>
  1. | Mirage_device.error
]

The type for network errors.

val pp_error : error Fmt.t

pp_error is the pretty-printer for errors.

type page_aligned_buffer

The type for page-aligned memory buffers.

type buffer

The type for memory buffers.

type macaddr

The type for unique MAC identifiers for the device.

include Mirage_device.S
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, error) Result.result io

write nf buf outputs buf to netfront nf.

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

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

val listen : t -> (buffer -> unit io) -> (unit, error) Result.result 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.

XXX: listen currently runs forever (documentation wrong)!

val mac : t -> macaddr

mac nf is the MAC address of nf.

val get_stats_counters : t -> stats

Obtain the most recent snapshot of the device statistics.

val reset_stats_counters : t -> unit

Reset the statistics associated with this device to their defaults.

OCaml

Innovation. Community. Security.