From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA26316 for caml-redistribution@pauillac.inria.fr; Tue, 21 Mar 2000 15:34:34 +0100 (MET) Resent-Message-Id: <200003211434.PAA26316@pauillac.inria.fr> Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA08269 for ; Mon, 20 Mar 2000 18:16:10 +0100 (MET) Received: from mail2.microsoft.com (mail2.microsoft.com [131.107.3.124]) by nez-perce.inria.fr (8.8.7/8.8.7) with SMTP id SAA28024 for ; Mon, 20 Mar 2000 18:16:09 +0100 (MET) Received: from 157.54.9.104 by mail2.microsoft.com (InterScan E-Mail VirusWall NT); Mon, 20 Mar 2000 09:15:47 -0800 (Pacific Standard Time) Received: by INET-IMC-02 with Internet Mail Service (5.5.2651.58) id ; Mon, 20 Mar 2000 09:15:47 -0800 Message-ID: <783D93998201D311B0CF00805FEAA07B7E9175@RED-MSG-42> From: Manuel Fahndrich To: "'Julian Assange'" , "'caml-list@inria.fr'" Subject: RE: multi-threaded udp resolver Date: Mon, 20 Mar 2000 09:15:44 -0800 X-Mailer: Internet Mail Service (5.5.2651.58) Resent-From: weis@pauillac.inria.fr Resent-Date: Tue, 21 Mar 2000 15:34:34 +0100 Resent-To: caml-redistribution@pauillac.inria.fr Have a look at Satish Chandra and Peter J. McCann, "Packet Types", in the Second Workshop on Compiler Support for Systems Software (WCSSS), May 1999. The paper tries to formalize the structure of self-describing data structures such as network packets. Not that this is implemented in OCaml, but maybe a CAMLp4 prepass would help. -Manuel -----Original Message----- From: Julian Assange [mailto:proff@iq.org] Sent: Saturday, March 18, 2000 9:57 AM To: caml-redistribution@pauillac.inria.fr Cc: proff@iq.org Subject: multi-threaded udp resolver 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].