Module Basic_backend.Make

type 'a io = 'a Lwt.t
type buffer = Cstruct.t
type id = int
type macaddr = Macaddr.t
type t
val create : ?⁠yield:(unit -> unit io) -> ?⁠use_async_readers:bool -> unit -> t
val register : t -> (idMirage_net.Net.error) Stdlib.result
val unregister : t -> id -> unit io

Unregister the listener and callback function

val unregister_and_flush : t -> id -> unit io

Unregister the listener, then block until all callbacks return for this * id. Useful when listeners are called in async.

val mac : t -> id -> macaddr
val write : t -> id -> size:int -> (buffer -> int) -> (unit, Mirage_net.Net.error) Stdlib.result io
val set_listen_fn : t -> id -> (buffer -> unit io) -> unit