package mirage-vnetif

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

Dummy interface for software bridge.

Parameters

module B : BACKEND

Signature

include Mirage_net_lwt.S
type error = private [>
  1. | Mirage_net.Net.error
]

The type for network 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 for the network interface.

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 -> size:int -> (buffer -> int) -> (unit, error) result io

write net ~size fill allocates a buffer of length size, where size must not exceed the interface maximum packet size (mtu plus Ethernet header). The allocated buffer is zeroed and passed to the fill function which returns the payload length, which may not exceed the length of the buffer. When fill returns, a sub buffer is put on the wire: the allocated buffer from index 0 to the returned length.

val listen : t -> header_size:int -> (buffer -> unit io) -> (unit, error) result io

listen ~header_size net fn waits for a packet with size at most header_size + mtu on the network device. When a packet is received, an asynchronous task is created in which fn packet is called. The ownership of packet is transferred to fn. The function can be stopped by calling disconnect in the device layer.

val mac : t -> macaddr

mac net is the MAC address of net.

val mtu : t -> int

mtu net is the Maximum Transmission Unit of net. This excludes the Ethernet header.

val get_stats_counters : t -> Mirage_net.stats

Obtain the most recent snapshot of the interface statistics.

val reset_stats_counters : t -> unit

Reset the statistics associated with this interface to their defaults.

val connect : ?size_limit:int -> B.t -> t Lwt.t
OCaml

Innovation. Community. Security.