package charrua-client

  1. Overview
  2. Docs
DHCP client implementation

Install

dune-project
 Dependency

Authors

Maintainers

Sources

charrua-3.1.0.tbz
sha256=2def09a9bef7d7b733c786754a67b1502ab62ed14906ab1e72cd2fb63cca7cb3
sha512=53761f002825a14532a708c91a1e54f8e3933f0b406c637042b0dc299244de2c81af406279ee5256935b06a98bd1d2e106fd9cc8618594e116449c3b27e26397

doc/charrua-client.mirage/Dhcp_ipv4/Proj_ipv4/argument-1-T/Net/index.html

Module T.Net

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 t

The type representing the internal state of the network device.

val disconnect : t -> unit Lwt.t

Disconnect from the network device. While this might take some time to complete, it can never result in an error.

val write : t -> size:int -> (Cstruct.t -> int) -> (unit, error) result Lwt.t

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 -> (Cstruct.t -> unit Lwt.t) -> (unit, error) result Lwt.t

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.

val mac : t -> Macaddr.t

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.