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

Re: [MirageOS-devel] hdhcpd working.

On 26 August 2015 at 15:04, Anil Madhavapeddy <anil@xxxxxxxxxx> wrote:
> 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.

Awesome, I think I get it, I'll need something analogous to the IO
module of Cohttp, should be fairly easy.
After some more reading, the Dhcp_server should require only an "IO"
module and a "Logger" module.
By the way, although stdout and stderr work on Mirage-unix, I assume
it is only cause stdout and stderr are not closed ?
I believe that doesn't work on Xen, Or is somehow the stdout/stderr
output functions redirected to the default CONSOLE instance ?
If that is not the case, then I don't need to functorize over a Logger
module, I don't have a xen setup yet.

> 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.

Great, I'm shuffling some code in order to only need to functorize
over IO and possibly over a Logger module.
There isn't much stuff to do actually, the main issue is I'm just
getting familiar with mirage now.

By the way, I'm considering renaming the project to Charrua, a
reference to: https://en.wikipedia.org/wiki/CharrÃa_people

Hopefully I should have it all working by the weekend !

> cheers
> Anil

MirageOS-devel mailing list



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