package tcpip

  1. Overview
  2. Docs
include Mirage_protocols_lwt.ICMPV4
type 'a io = 'a Lwt.t
type t
val disconnect : t -> unit io
type ipaddr = Ipaddr.V4.t
type buffer = Cstruct.t
type error
val pp_error : error Fmt.t
val input : t -> src:ipaddr -> dst:ipaddr -> buffer -> unit io
val write : t -> dst:ipaddr -> buffer -> (unit, error) Stdlib.result io
val connect : unit -> t io
val listen : t -> ipaddr -> (buffer -> unit io) -> unit io

listen t addr fn attempts to create an unprivileged listener on IP address addr.

When a packet is received, the callback fn will be called in a fresh background thread. The callback will be provided a buffer containing an IP datagram with an ICMP payload inside.

The thread returned by listen blocks until the stack is disconnected.


Innovation. Community. Security.