Ethernet II frame header codec
README.md

nox-ethernet #

Warning. This is a work-in-progress experimental fork of ethernet. Do not use it in production; use ethernet instead.

Encode and decode Ethernet II frame headers (destination MAC, source MAC, EtherType) in pure OCaml.

A network stack written in OCaml, such as one inside a unikernel, needs to frame what it sends and to route each received frame to ARP, IPv4 or IPv6 by its EtherType. nox-ethernet is the I/O-free header codec: Ethernet.decode reads a header and returns the payload as a view without copying, and Ethernet.to_rope prepends a header to an outgoing payload. The nox-ethernet-eio package drives it over a raw network device, with one fibre reading the device and handing each frame to the handler registered for its EtherType.

Installation #

Install with opam:

$ opam install nox-ethernet

If opam cannot find the package, it may not yet be released in the public opam-repository. Add the overlay repository, then install it:

$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install nox-ethernet

Credits #

Forked from mirage/ethernet, written by Anil Madhavapeddy, Balraj Singh and the MirageOS team and released under the ISC licence. The cstruct codec is replaced by the wire library. The original copyright notices are kept in LICENSE.md.