package tcpip

  1. Overview
  2. Docs
type page_aligned_buffer = Io_page.t

The type for page-aligned memory buffers.

type buffer = Cstruct.t

The type for memory buffers.

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 = Macaddr.t

The type for unique MAC identifiers for the device.

include V1.DEVICE with type error := error 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

type id

This type is no longer used and will be removed once other * modules stop using it in their type signatures.

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 listen : t -> (buffer -> unit io) -> unit io

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.

val mac : t -> macaddr

mac nf is the MAC address of nf.

type stats = {
  1. mutable rx_bytes : int64;
  2. mutable rx_pkts : int32;
  3. mutable tx_bytes : int64;
  4. mutable tx_pkts : int32;
}

The type for frame statistics to track the usage of the device.

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.