/home/set/tech/maradns/maradns-0.9.24/doc/en/misc/describing_dns_rrs.html

# A format which describes DNS resource records

DNS is designed to store a number of record types; each type has its own format for storing data. However, DNS does not have a mechanism for parsing resource record types which are not hard-coded in the DNS server attempting to parse the data in question.

The purpose of this document is to start to alleviate this issue. The most important reason for this is so that new DNS record types can be potentially decompressed without needing to recode legacy DNS servers which do not have knowledge of a new resource record.

DNS compression is designed so that, if a DNS server does not know where compressible DNS labels are in the RDDATA for a given record, the server will not be able to decompress the label in question. Since it is desirable to have new record types be decompressed, there needs to be a way to easily inform DNS servers of the format for resource records.

This document only describes a way of describing resource records in a machine-parsable format; it will not discuss possible ways of having DNS servers receive this data over a network connection from remote DNS servers which the local DNS server can not necessarily trust.

What the format describes

The format will describe the data format a given DNS RR type will contain, the symbolic name for the record in question, whether domain labels in the RR should be compressed, and a text description of the purpose of the data in the resource record.

The data format is as follows:

1. colon symbol (describes beginning of RR)
2. Number for this RR (e.g. 1 for A, 2 for NS, 5 for CNAME, etc.)
3. pipe symbol
4. Symbolic name for this RR (using UTF-8)
5. pipe symbol
6. Description of data in the RR (described in more detail below)
7. pipe symbol
8. Whether this data can be compressed (C: Compress; N: do not compress)
9. pipe symbol
10. Two letter language symbol which the RR's description is in.
11. semicolon
12. Description of the RR, in UTF-8 format, with any symbol besides a semicolon
13. semicolon
14. Data not parsed until the next colon symbol

Description of data in the RR

The description of RR is one or more atoms delimited by semicolons; semicolon delimiters are only used when there is more than one data atom. The data atom describes are the data is formatted; the atom does not attempt to place significance on the data.

The following atoms are supported:

- 1: This describes a number represented by a single octet
- 2: This represents numerical data represented by two octets in big-endian format
- 4: This represents numerical data represented by four octets in big-endian or dotted-decimal format
- 8: This represents numerical data represented by eight octets in big-endian format
- 16: This represents numerical data represented by sixteen octets in big-endian or any ipv6 address presentation
- Any number represents numerical data represented by that many octets in big-endian format.
- D: This represents a domain name label
- T: This represents a text record; a single octet indicating the length of a string followed by the string in question
- V: This represents variable-length data not to be parsed; this can only be the last or only atom in an RR.

Example Description file

A description file is a string of one or more RR descriptions. Here is one which covers all of the RRs which MaraDNS currently can decompress or parse:

    :1|A|4|N|en;IPv4 Addresses [RFC 1035];
    :2|NS|D|C|en;NS (name server) records [RFC 1035];
    :3|MD|D|N|en;[RFC 1035];
    :4|MF|D|N|en;[RFC 1035];
    :5|CNAME|D|C|en;CNAME records [RFC 1035];
    :6|SOA|D;D;4;4;4;4;4|C|en;SOA records [RFC 1035];
    :7|MB|D|N|en;[RFC 1035];
    :8|MG|D|N|en;[RFC 1035];
    :9|MR|D|N|en;[RFC 1035];
    :12|PTR|D|C|en;Reverse DNS lookup records [RFC 1035];
    :14|MINFO|D|N|en;[RFC 1035];
    :15|MX|2;D|C|en;Mail exchanger records [RFC 1035];
    :16|TXT|T;V|N|en;Text data [RFC 1035];
    :17|RP|D|N|en;[RFC 1183];
    :18|AFSDB|2;D|N|en;[RFC 1183];
    :21|RT|2;D|N|en;[RFC 1183];
    :33|SRV|2;2;2;D|N|en;Service [RFC 2052];