[dnsext] Code generator for DNS RR parsing/emitting

Phillip Hallam-Baker <hallam@gmail.com> Fri, 03 May 2013 14:44 UTC

Return-Path: <hallam@gmail.com>
X-Original-To: dnsext@ietfa.amsl.com
Delivered-To: dnsext@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 8A5AE21F8766 for <dnsext@ietfa.amsl.com>; Fri, 3 May 2013 07:44:28 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.47
X-Spam-Level:
X-Spam-Status: No, score=-2.47 tagged_above=-999 required=5 tests=[AWL=0.129, BAYES_00=-2.599, HTML_MESSAGE=0.001, NO_RELAYS=-0.001]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Pb7YWj-rinsS for <dnsext@ietfa.amsl.com>; Fri, 3 May 2013 07:44:27 -0700 (PDT)
Received: from mail-wg0-x231.google.com (mail-wg0-x231.google.com [IPv6:2a00:1450:400c:c00::231]) by ietfa.amsl.com (Postfix) with ESMTP id 5A6CD21F86E4 for <dnsext@ietf.org>; Fri, 3 May 2013 07:44:27 -0700 (PDT)
Received: by mail-wg0-f49.google.com with SMTP id j13so1638657wgh.4 for <dnsext@ietf.org>; Fri, 03 May 2013 07:44:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=4vcJ40CkZSC+GkS9ryUTUCHp4pHiMBlpHx2mYsL8ako=; b=jcRJMsF9HdlnXWZ+PXKq4OTWrf6R4bXYwjo8zWhp2s0pslsdysNyQHmeWH9fCXPnmn AouXTiLIL5Wot+lDQXZQ8djdARVTewKiYi+5X07kqJEgTKNV4ys7/iG05J67D2H+T7qk qMdg6blh819XFqQ4RShbrLur5J8Utk0cyCFNKtHfTFleSwo9v7t20q5C3M0IwaHlO9ue he2u858lzCoNjd4IKHbcQUc6oBAkUDZHKqkdSDVsXvVEjDUJVJB9qXxGDoPEPpeXCi+i LBQcPU0Xw/90EVO+6Voe8PMYBP4CvHwlsgpMtjQfagDxtVZJQQ2YeTfPr8NI7ZTo2NLZ mW7A==
MIME-Version: 1.0
X-Received: by 10.180.188.198 with SMTP id gc6mr13712340wic.14.1367592263942; Fri, 03 May 2013 07:44:23 -0700 (PDT)
Received: by 10.194.121.161 with HTTP; Fri, 3 May 2013 07:44:23 -0700 (PDT)
Date: Fri, 03 May 2013 10:44:23 -0400
Message-ID: <CAMm+Lwj-XpAc=vzUQVsdqaQa714pcYFjmPa2A9K96fzX8E25Lw@mail.gmail.com>
From: Phillip Hallam-Baker <hallam@gmail.com>
To: "dnsext@ietf.org" <dnsext@ietf.org>
Content-Type: multipart/alternative; boundary="001a11c389a4170a1304dbd163ad"
Subject: [dnsext] Code generator for DNS RR parsing/emitting
X-BeenThere: dnsext@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: DNS Extensions working group discussion list <dnsext.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dnsext>, <mailto:dnsext-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/dnsext>
List-Post: <mailto:dnsext@ietf.org>
List-Help: <mailto:dnsext-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dnsext>, <mailto:dnsext-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 03 May 2013 14:44:28 -0000

Folk may be interested in the following Open Source project:

https://sourceforge.net/projects/omnidiscovery/

The code is not 100% complete but it does support many of the most commonly
used DNS RRs right now.


The synthesizer generates code to parse/emit DNS RRs from an abstract
description file. Here are the first three entries:

RR	A			1		"Host address"	"RFC1035"
	IPv4			Address
	
RR	NS			2		"Authoritative name server" "RFC1035"
	Domain			NSDNAME
		
RR	MD			3		"Mail destination" "RFC1035"
	Domain			MADNAME
	Obsolete

[100+ other RR definitions omitted]

This abstract description is then used to produce an API to allow
applications to handle the RRs in any language someone cares to write a
back end for. The synthesizer is implemented in Goedel which is an open
source synthesizer for writing synthesizers.

At present the only output language supported is C#. The reason I am doing
C# is that there isn't a good library for DNS API support out there right
now and that is the language I prefer to work in. Generating C, Objective C
or Java would be fairly straightforward. I don't plan to support anything
beyond posibly doing C.

The code has been tested on Windows, OSX and Linux (under Mono). It works
the same on all platforms to the extent that it works.


Writing support for DNS RR types is pretty much a template filling
operation. If someone wanted to they could use Goedel to fill in the
templates that BIND has in its code.

As you will see above, the obsolete MD RR has a description but it is
marked as obsolete. This allows the code generator to be used to generate a
'fat' API for use implementing a tool like digg and a thin API that only
supports the exact calls required for some embedded device.

The synth could even be used to generate a HTML or Windows Forms interface
for managing DNS RRs.


Working this way does not actually save a lot of time on a project like
this but it does improve accuracy a great deal and thus reduces
maintenance. Using the synth effectively reduces the number of code paths
at issue. So if you can get the code to work at all and pass a modest
number of test cases it is very likely correct.

Adding extra RR types takes 5 mins.

-- 
Website: http://hallambaker.com/