package dns

  1. Overview
  2. Docs

How to build up a DNS trie from separate RRs.

  • author Tim Deegan <tjd\@phlegethon.org>
  • author Richard Mortier <mort\@cantab.net>
type db = {
  1. trie : Trie.dnstrie;
  2. mutable names : (Name.key, RR.dnsnode) Hashtbl.t;
}

Loader database: the DNS trie plus a hash table of other names in use.

val new_db : unit -> db

Make a new, empty database.

val no_more_updates : db -> unit

Call when guaranteed there will be no more updates.

Insert RRs in the database: args are rdata, ttl, owner, db.

val add_generic_rr : int -> string -> int32 -> Name.t -> db -> unit
val add_a_rr : Ipaddr.V4.t -> int32 -> Name.t -> db -> unit
val add_aaaa_rr : Ipaddr.V6.t -> int32 -> Name.t -> db -> unit
val add_ns_rr : Name.t -> int32 -> Name.t -> db -> unit
val add_cname_rr : Name.t -> int32 -> Name.t -> db -> unit
val add_soa_rr : Name.t -> Name.t -> RR.serial -> int32 -> int32 -> int32 -> int32 -> int32 -> Name.t -> db -> unit
val add_mb_rr : Name.t -> int32 -> Name.t -> db -> unit
val add_mg_rr : Name.t -> int32 -> Name.t -> db -> unit
val add_mr_rr : Name.t -> int32 -> Name.t -> db -> unit
val add_wks_rr : Ipaddr.V4.t -> Cstruct.byte -> string -> int32 -> Name.t -> db -> unit
val add_ptr_rr : Name.t -> int32 -> Name.t -> db -> unit
val add_hinfo_rr : string -> string -> int32 -> Name.t -> db -> unit
val add_minfo_rr : Name.t -> Name.t -> int32 -> Name.t -> db -> unit
val add_mx_rr : int -> Name.t -> int32 -> Name.t -> db -> unit
val add_txt_rr : string list -> int32 -> Name.t -> db -> unit
val add_rp_rr : Name.t -> Name.t -> int32 -> Name.t -> db -> unit
val add_afsdb_rr : int -> Name.t -> int32 -> Name.t -> db -> unit
val add_x25_rr : string -> int32 -> Name.t -> db -> unit
val add_isdn_rr : string -> string option -> int32 -> Name.t -> db -> unit
val add_rt_rr : int -> Name.t -> int32 -> Name.t -> db -> unit
val add_srv_rr : int -> int -> int -> Name.t -> int32 -> Name.t -> db -> unit
val add_dnskey_rr : int -> int -> string -> int32 -> Name.t -> db -> unit
val add_ds_rr : int -> int -> int -> string -> int32 -> Name.t -> db -> unit
val add_rrsig_rr : string -> int -> int -> int32 -> int32 -> int32 -> int -> Name.t -> string -> int32 -> Name.t -> db -> unit
exception TTLMismatch

Raised if we already had an RRSet for this name and type, but with a different TTL. Also possible: Trie.BadName.

N.B. If TTLMismatch is raised, the RR was successfully added, and the RRSet now has the new ttl.

OCaml

Innovation. Community. Security.