package dns

  1. Overview
  2. Docs

A map whose keys are record types and their values are the time-to-live and the record set. The relation between key and value type is restricted by the below defined GADT.

module Mx_set : Stdlib.Set.S with type elt = Mx.t
module Txt_set : Stdlib.Set.S with type elt = Txt.t
module Ipv4_set : Stdlib.Set.S with type elt = A.t
module Ipv6_set : Stdlib.Set.S with type elt = Aaaa.t
module Srv_set : Stdlib.Set.S with type elt = Srv.t
module Dnskey_set : Stdlib.Set.S with type elt = Dnskey.t
module Caa_set : Stdlib.Set.S with type elt = Caa.t
module Tlsa_set : Stdlib.Set.S with type elt = Tlsa.t
module Sshfp_set : Stdlib.Set.S with type elt = Sshfp.t
module I : sig ... end
type 'a with_ttl = int32 * 'a

A tuple type whose first component is a time-to-live counter in seconds.

type _ rr =
  1. | Soa : Soa.t rr
  2. | Ns : Domain_name.Host_set.t with_ttl rr
  3. | Mx : Mx_set.t with_ttl rr
  4. | Cname : Cname.t with_ttl rr
  5. | A : Ipv4_set.t with_ttl rr
  6. | Aaaa : Ipv6_set.t with_ttl rr
  7. | Ptr : Ptr.t with_ttl rr
  8. | Srv : Srv_set.t with_ttl rr
  9. | Dnskey : Dnskey_set.t with_ttl rr
  10. | Caa : Caa_set.t with_ttl rr
  11. | Tlsa : Tlsa_set.t with_ttl rr
  12. | Sshfp : Sshfp_set.t with_ttl rr
  13. | Txt : Txt_set.t with_ttl rr
  14. | Unknown : I.t -> Txt_set.t with_ttl rr
    (*

    The type of resource record sets, as GADT: the value depends on the specific constructor. There may only be a single SOA and Cname and Ptr record, while other constructors, such as address (A), contain a set of the respective types. The Unknown constructor is used for not specifically supported records. These resource records are usually persisted to disk by a server or resolver. Resource records that are only meant for a single transaction (such as EDNS or TSIG) are not in this GADT, neither is the query type ANY (which answer is computed on the fly), or zone transfer operations (AXFR/IXFR).

    *)
module K : Gmap.KEY with type 'a t = 'a rr
include Gmap.S with type 'a key = 'a rr
type !'a key = 'a rr
type t
val empty : t
val singleton : 'a key -> 'a -> t
val is_empty : t -> bool
val cardinal : t -> int
val mem : 'a key -> t -> bool
val find : 'a key -> t -> 'a option
val get : 'a key -> t -> 'a
val add_unless_bound : 'a key -> 'a -> t -> t option
val add : 'a key -> 'a -> t -> t
val remove : 'a key -> t -> t
val update : 'a key -> ('a option -> 'a option) -> t -> t
type b =
  1. | B : 'a key * 'a -> b
val min_binding : t -> b option
val max_binding : t -> b option
val any_binding : t -> b option
val bindings : t -> b list
type eq = {
  1. f : 'a. 'a key -> 'a -> 'a -> bool;
}
val equal : eq -> t -> t -> bool
type mapper = {
  1. f : 'a. 'a key -> 'a -> 'a;
}
val map : mapper -> t -> t
val iter : (b -> unit) -> t -> unit
val fold : (b -> 'a -> 'a) -> t -> 'a -> 'a
val for_all : (b -> bool) -> t -> bool
val exists : (b -> bool) -> t -> bool
val filter : (b -> bool) -> t -> t
type merger = {
  1. f : 'a. 'a key -> 'a option -> 'a option -> 'a option;
}
val merge : merger -> t -> t -> t
type unionee = {
  1. f : 'a. 'a key -> 'a -> 'a -> 'a option;
}
val union : unionee -> t -> t -> t
val equal_rr : 'a key -> 'a -> 'a -> bool

equal_rr k v v' is true if v = v', false otherwise.

val equalb : b -> b -> bool

equalb b b' is true if the bindings are equal.

type k =
  1. | K : 'a key -> k
    (*

    The monomorphic type of keys.

    *)
val comparek : k -> k -> int

comparek k k' compares k with k' using the defined ordering.

val ppk : k Fmt.t

ppk ppf k pretty-prints k.

val names : 'a key -> 'a -> Domain_name.Host_set.t

names k v are the referenced domain names in the given binding.

val pp_b : b Fmt.t

pp_b ppf b pretty-prints the binding b.

val text_b : ?origin:'a Domain_name.t -> ?default_ttl:int32 -> 'b Domain_name.t -> b -> string

text_b ~origin ~default_ttl domain-name binding is the zone file format of binding using domain-name.

val remove_rr : 'a key -> 'a -> 'a -> 'a option

remove_rr k v rem removes rem from v. If the result is an empty set, None is returned.

val union_rr : 'a key -> 'a -> 'a -> 'a

union_rr k l r builds the union of l with r. A potential r Soa or Cname overwrites its l counterpart.

val unionee : 'a key -> 'a -> 'a -> 'a option

unionee k l r unions l with r using union_rr.

val diff : old:t -> t -> t option * t option

diff ~old m computes the difference between old and m. The left projection are the deleted entries, the right projection are the added entries. Soa entries are ignored.

val text : ?origin:'a Domain_name.t -> ?default_ttl:int32 -> 'b Domain_name.t -> 'c rr -> 'c -> string

text ~origin ~default_ttl name k v is the zone file data for k, v.

val get_ttl : b -> int32

get_ttl b returns the time-to-live of b.

val with_ttl : b -> int32 -> b

with_ttl b ttl updates ttl in b.

OCaml

Innovation. Community. Security.