multi-threaded udp resolver

From: Julian Assange (proff@iq.org)
Date: Thu Mar 09 2000 - 23:34:47 MET

  • Next message: Christophe Raffalli: "Re: Syntax for label, NEW SOLUTION"

    I've previously written a multi-threaded udp dns resolver in c (not
    threads so much as a fsm emulating threads). I'd like to, if possible
    write one in ocaml directly, rather than simply hooking into the C
    code (which wouldn't be that simple anyway, due to the various timers,
    management of fd's etc it needs).

    While ocaml provides appropriate udp send/receive functions, the best
    mechanism for understanding the structure of dns packets is unknown to
    me. DNS packets are `loosely' structured. That is, there are many
    different structural elements (including arrays of those elements),
    and exactly how they are crammed into a packet can only be determined
    by reading the structure. i.e the first part of the structure
    describes the type (but not structure) of the next strucural element
    and so on.

    Vixie's named/bind daemon doesn't even attempt to describe the
    structure in any sort of data form, but rather uses the code flow
    itself to describe the structure (e.g pulling 16 bits, assigning it to
    a variable, advancing the interpretation pointer by 16 bits, testing
    the variable, pulling 32 bits etc). This method is incredibly
    error-prone, and it's hard to see a good way of fitting it in with
    ocaml's type system. Any ideas on the best way to approach this problem?

    Cheers,
    Julian.

    -- 
    Stefan Kahrs in [Kah96] discusses the
       notion of completeness--programs which never go wrong can be
       type-checked--which complements Milner's notion of
       soundness--type-checked programs never go wrong [Mil78].
    



    This archive was generated by hypermail 2b29 : Sat Mar 18 2000 - 19:33:23 MET