dns

DNS client and server implementation in pure OCaml
Library dns
Module Dns . RR
type serial = int32

DNS serial number -- 32 bits.

type cstr = string Hashcons.hash_consed

DNS Hashconsd character string.

and dnsnode = {
owner : Name.t Hashcons.hash_consed;(*

The name for which the node contains memoised attributes.

*)
mutable rrsets : rrset list;(*

The set of attributes as resource records.

*)
}

A node in the trie.

and rrset = {
ttl : int32;
rdata : rdata;
}

An RRset, comprising a 32 bit TTL and an rdata record.

and rrsig = {
rrsig_type : Packet.rr_type;
rrsig_alg : Packet.dnssec_alg;
rrsig_labels : char;
rrsig_ttl : int32;
rrsig_expiry : int32;
rrsig_incept : int32;
rrsig_keytag : int;
rrsig_name : Name.t;
rrsig_sig : string;
}

The DNSSEC signature of an rrset

and rdata =
| A of Ipaddr.V4.t list
| AAAA of Ipaddr.V6.t list
| AFSDB of (Cstruct.uint16 * dnsnode) list
| CNAME of dnsnode list
| HINFO of (cstr * cstr) list
| ISDN of (cstr * cstr option) list
| MB of dnsnode list
| MG of dnsnode list
| MINFO of (dnsnode * dnsnode) list
| MR of dnsnode list
| MX of (Cstruct.uint16 * dnsnode) list
| NS of dnsnode list
| PTR of dnsnode list
| RP of (dnsnode * dnsnode) list
| RT of (Cstruct.uint16 * dnsnode) list
| SOA of (dnsnode * dnsnode * serial * int32 * int32 * int32 * int32) list
| SRV of (Cstruct.uint16 * Cstruct.uint16 * Cstruct.uint16 * dnsnode) list
| TXT of cstr list list
| Unknown of int * cstr list
| WKS of (Ipaddr.V4.t * Cstruct.byte * cstr) list
| X25 of cstr list
| DNSKEY of (int * int * cstr) list
| DS of (int * Packet.dnssec_alg * Packet.digest_alg * cstr) list
| RRSIG of rrsig list

A resource record.

NB. These are as stored in the DNS trie, which associates lists of payloads with each type in an attempt at a compact representation. As only one payload of each type can be marshalled into an RR in a packet, this necessitates a two-phase marshalling process. To prevent type collisions, Packet represents each RR as a variant type with the same name.

val rdata_to_string : rdata -> string