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 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 Ds_set : Stdlib.Set.S with type elt = Ds.t
module Rrsig_set : Stdlib.Set.S with type elt = Rrsig.t
module Loc_set : Stdlib.Set.S with type elt = Loc.t
module Null_set : Stdlib.Set.S with type elt = Null.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 : Ipaddr.V4.Set.t with_ttl rr
  6. | Aaaa : Ipaddr.V6.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. | Ds : Ds_set.t with_ttl rr
  15. | Rrsig : Rrsig_set.t with_ttl rr
  16. | Nsec : Nsec.t with_ttl rr
  17. | Nsec3 : Nsec3.t with_ttl rr
  18. | Loc : Loc_set.t with_ttl rr
  19. | Null : Null_set.t with_ttl rr
  20. | 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 of_int : ?off:int -> int -> (k, [> `Malformed of int * string ]) Stdlib.result

of_int ~off i constructs a k of the provided integer.

val to_int : 'a key -> int

to_int k is the integer representing the key k.

val of_string : string -> (k, [> `Msg of string ]) Stdlib.result

of_string i constructs a k of the provided string.

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 ttl : 'a key -> 'a -> int32

get_ttl k v returns the time-to-live of v.

val with_ttl : 'a key -> 'a -> int32 -> 'a

with_ttl k v ttl updates ttl in v.

val prep_for_sig : [ `raw ] Domain_name.t -> Rrsig.t -> 'a key -> 'a -> ([ `raw ] Domain_name.t * Cstruct.t, [ `Msg of string ]) Stdlib.result
val canonical_encoded_name : [ `raw ] Domain_name.t -> Cstruct.t
OCaml

Innovation. Community. Security.