package dns

  1. Overview
  2. Docs

Datatypes and handling for DNS Resource Records and RRSets.

  • author Tim Deegan
  • author Richard Mortier <mort\@cantab.net> (documentation)
type serial = int32

DNS serial number -- 32 bits.

type cstr = string Hashcons.hash_consed

DNS Hashconsd character string.

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

    The name for which the node contains memoised attributes.

    *)
  2. mutable rrsets : rrset list;
    (*

    The set of attributes as resource records.

    *)
}

A node in the trie.

and rrset = {
  1. ttl : int32;
  2. rdata : rdata;
}

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

and rrsig = {
  1. rrsig_type : Packet.rr_type;
  2. rrsig_alg : Packet.dnssec_alg;
  3. rrsig_labels : char;
  4. rrsig_ttl : int32;
  5. rrsig_expiry : int32;
  6. rrsig_incept : int32;
  7. rrsig_keytag : int;
  8. rrsig_name : Name.t;
  9. rrsig_sig : string;
}

The DNSSEC signature of an rrset

and rdata =
  1. | A of Ipaddr.V4.t list
  2. | AAAA of Ipaddr.V6.t list
  3. | AFSDB of (Cstruct.uint16 * dnsnode) list
  4. | CNAME of dnsnode list
  5. | HINFO of (cstr * cstr) list
  6. | ISDN of (cstr * cstr option) list
  7. | MB of dnsnode list
  8. | MG of dnsnode list
  9. | MINFO of (dnsnode * dnsnode) list
  10. | MR of dnsnode list
  11. | MX of (Cstruct.uint16 * dnsnode) list
  12. | NS of dnsnode list
  13. | PTR of dnsnode list
  14. | RP of (dnsnode * dnsnode) list
  15. | RT of (Cstruct.uint16 * dnsnode) list
  16. | SOA of (dnsnode * dnsnode * serial * int32 * int32 * int32 * int32) list
  17. | SRV of (Cstruct.uint16 * Cstruct.uint16 * Cstruct.uint16 * dnsnode) list
  18. | TXT of cstr list list
  19. | Unknown of int * cstr list
  20. | WKS of (Ipaddr.V4.t * Cstruct.byte * cstr) list
  21. | X25 of cstr list
  22. | DNSKEY of (int * int * cstr) list
  23. | DS of (int * Packet.dnssec_alg * Packet.digest_alg * cstr) list
  24. | 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