package dns

  1. Overview
  2. Docs
type commfn = {
  1. txfn : Dns.Buf.t -> unit Lwt.t;
    (*

    txfn buf resolves when buf has been transmitted.

    *)
  2. rxfn : (Dns.Buf.t -> Dns.Packet.t option) -> Dns.Packet.t Lwt.t;
    (*

    rxfn parse resolves to a packet processed by parse after it has been received.

    *)
  3. timerfn : unit -> unit Lwt.t;
    (*

    timerfn () resolves when a request should be timed out.

    *)
  4. cleanfn : unit -> unit Lwt.t;
    (*

    cleanfn () resolves after any resources used by the rest of the commfn have been released.

    *)
}

A commfn value describes the means by which datagram transmission and reception occur as well as providing functions to timeout requests and clean up any resources used.

val resolve_pkt : (module Dns.Protocol.CLIENT) -> ?alloc:(unit -> Dns.Buf.t) -> commfn -> Dns.Packet.t -> Dns.Packet.t Lwt.t

resolve_pkt client ?alloc commfn packet will attempt resolution of the query contained in packet via the protocol client client and using the utilities of commfn. alloc may be provided to control how buffers are allocated.

client may issue multiple network transactions for the same query simultaneously. The first received successful response will be returned. If no responses are successful or received before commfn.timerfn resolves, the Lwt.t value will fail with a Dns.Protocol.Dns_resolve_error exception which contains a list of all of the errors encountered during resolution.

val resolve : (module Dns.Protocol.CLIENT) -> ?alloc:(unit -> Dns.Buf.t) -> ?dnssec:bool -> commfn -> Dns.Packet.q_class -> Dns.Packet.q_type -> Dns.Name.t -> Dns.Packet.t Lwt.t

resolve client ?alloc ?dnssec commfn q_class q_type name will construct a query packet from dnssec, q_class, q_type, and name and then attempt to resolve it by calling resolve_pkt.

val gethostbyname : ?alloc:(unit -> Dns.Buf.t) -> ?q_class:Dns.Packet.q_class -> ?q_type:Dns.Packet.q_type -> commfn -> string -> Ipaddr.t list Lwt.t
val gethostbyaddr : ?alloc:(unit -> Dns.Buf.t) -> ?q_class:Dns.Packet.q_class -> ?q_type:Dns.Packet.q_type -> commfn -> Ipaddr.V4.t -> string list Lwt.t
OCaml

Innovation. Community. Security.