unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Rohan Prinja <rohan.prinja@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: [GSoC] Introduction + question about dmd
Date: Thu, 05 Mar 2015 11:51:03 +0100	[thread overview]
Message-ID: <87mw3ryay0.fsf@gnu.org> (raw)
In-Reply-To: <CAAT4Lc5JecePpuFYpxqT-O37YVxYBzUjpv00Nu989UrngUO_Vw@mail.gmail.com> (Rohan Prinja's message of "Wed, 4 Mar 2015 19:38:11 +0530")

Hello!

Rohan Prinja <rohan.prinja@gmail.com> skribis:

> The project I'm interested in working on for GNU GSoC this year is to
> implement a DHCP client library in Guile. The end result, as I discussed
> with Ludovic, would be a package installable via Guix. This would make
> available a command roughly equivalent to ISC's dhclient. The library
> should also implement a service that dmd can run.

Specifically, the library’s functionality should be available in a way
that makes it easy to integrate in some event loop.

> Things I've done so far - read the dmd manual, started learning Guile (I've
> programmed in Racket before, but not Guile), reading up on the DHCP
> protocol, and started looking at ISC's implementation of dhclient (I used
> the one obtained by apt-get source isc-dhcp-client).

(Alternately, you can get it with ‘guix build -S isc-dhclient’.  ;-))

This is a good start.  You might want to look at
<https://www.ietf.org/rfc/rfc2131.txt> more than at the actual
implementation.

> @Ludovic: continuing our discussion - could you please explain what you
> mean by the dmd event loop? I searched in the manual as well the dmd-0.2
> source but couldn't find any reference to it. Is this something planned to
> be added to dmd? How will it look like?

It’s something planned.  Basically dmd has to react to various events;
currently, the only events that happen in practice are SIGCHLD,
connections made by the client programs (‘deco’, ‘reboot’, etc.), and
commands sent on open connections by these clients.

Currently, in lieu of an full-blown even loop, there’s just this naive
loop in the (dmd) module:

          (let next-command ()
            (match (accept sock)
              ((command-source . client-address)
               (process-connection command-source))
              (_ #f))
            (next-command))

That doesn’t scale well and isn’t safe though, because a client could
wait forever and thus lead dmd to wait forever as well (although that’s
slightly beyond the adversary model we would think of.)

More importantly, we would like dmd to be able to handle other kinds of
events.  For instance, I would like it to run a “REPL server” (info
"(guile) REPL Servers"); that means it will also have to check for
events occurring on the REPL server socket.

Other types of events could include network reconfigurations (which
could be detected via a PF_NETLINK/NETLINK_ROUTE socket), device
additions/removal, events related to the DHCP client process, etc.

To be able to handle these events, dmd needs a usual event loop.  It
doesn’t have it yet, but that’s something I’m planning to add (I say “I”
but anyone reading this message is welcome to help ;-)).

Does it clarify things a bit?

Thanks,
Ludo’.

  reply	other threads:[~2015-03-05 10:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04 14:08 [GSoC] Introduction + question about dmd Rohan Prinja
2015-03-05 10:51 ` Ludovic Courtès [this message]
2015-03-05 13:44   ` Jonas Rebmann
2015-03-05 19:01     ` Rohan Prinja
2015-03-07  2:01   ` Rohan Prinja
2015-03-10 12:47     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mw3ryay0.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=rohan.prinja@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).