Up

module Trie

: sig

Interface to 256-way radix trie for DNS lookups. Non-standard behaviour:

  1. We don't support '\000' as a character in labels (because it has a special meaning in the internal radix trie keys).
  2. We don't support RFC2673 bitstring labels. Could be done but they're not worth the bother: nobody uses them.
Author Tim Deegan
#
exception TrieCorrupt

Missing data from a SOA/cut node.

#
type dnstrie

Node of the trie

#
val new_trie : unit -> dnstrie

Make a new, empty trie.

#
val simple_lookup : Name.key -> dnstrie -> RR.dnsnode option

Simple lookup function: just walk the trie.

#
val lookup : Name.key -> dnstrie -> mdns:bool -> [>
| `Delegated of bool * RR.dnsnode
| `Found of bool * RR.dnsnode * RR.dnsnode
| `NXDomain of RR.dnsnode
| `NXDomainNSEC of RR.dnsnode * RR.dnsnode * RR.dnsnode
| `NoError of RR.dnsnode
| `NoErrorNSEC of RR.dnsnode * RR.dnsnode
| `Wildcard of RR.dnsnode * RR.dnsnode
| `WildcardNSEC of RR.dnsnode * RR.dnsnode * RR.dnsnode
]

Look up a DNS entry in the trie, with full return.

#
val lookup_or_insert : Name.key -> dnstrie -> ?parent:dnstrie -> (unit -> RR.dnsnode) -> RR.dnsnode

Return the data mapped from this key, making new data if there is none there yet.

#
val fix_flags : Name.key -> dnstrie -> unit

Sort out flags for a key's node: call after adding or removing NS, SOA and KEY RRs

#
val iter : (RR.dnsnode -> unit) -> dnstrie -> unit

Iterate over all of the nodes in the trie.

end