Subject: [dnsext] Code generator for DNS RR parsing/emitting

From: Phillip Hallam-Baker <[email-masked]>
Date: Fri, 3 May 2013 10:44:23 -0400

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/