[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] hdhcpd working.

On 25 Aug 2015, at 15:11, Christiano F. Haesbaert <haesbaert@xxxxxxxxxxxxx> wrote:

After converting, I guess there won't be any parameters except
verbosity to be passed (not considering the interfaces), but I do need
to pass the configuration file somehow.
Since I'm still not saving the lease database to disk, which I do
intend to do with irmin, the only thing I'd need is passing this
configuration file.

So I released rawlink on opam and hdhcp should work now.

Fantastic!  The Rawlink compiles great on OSX for me.

I had started to convert the code to mirage and I have some questions.

How exactly should the distribution be ? Should I release a package in opam that exports a "dhcp server module" ? Should I include something like a unikernel config.ml skeleton and friends ? Should it be included inside an existing mirage library ?

Good questions all.  In general, the libraries I've done are structured like this:

- a core platform independent parsing/logic library
- a Lwt (or Async, or both) layer that includes concurrency and sequencing logic.  This can also include Lwt_unix, which, when combined with cmdliner gives a nice CLI version out of the box.
- a Mirage functor, so in this case it would be a Dhcp_server module.  It helps to define a "Dhcp.S" module that defines the module type for the interface, and then use that signature when defining the functor.  See https://github.com/mirage/ocaml-cohttp/blob/master/lib/s.mli for an example of a module type for Cohttp.

My idea so far was to release hdhcp as a library, having a Dhcp_server module, and another package with a mirage usage of this module as a functor. Basically it needs to be specialized on how to send/receive packets and read/write to disk.

I think that's spot on.  The functor only needs to be parameterised by modules for which there is genuinely more than one implementation.  So for example, config file parsing doesnt need to be there as it can be represented by a record type and supplied to the library.  If you post some patches/branch I can take a look.

MirageOS-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.