package dns-client

  1. Overview
  2. Docs
DNS client API

Install

dune-project
 Dependency

Authors

Maintainers

Sources

dns-10.2.1.tbz
sha256=b488cf4c514fd57d4a2cb29b99d4234ae6845eff0d5e79b1059f779f7342478a
sha512=85a7607aee53e5e8a585938c2ab2405a702a1cafbadb609261f27bc7657af8f852d79e9fa014ff79fb1d143e2a77eb7e9c675cdef17b8e9a231295fdb8ce7d79

doc/dns-client/Dns_client/Pure/index.html

Module Dns_client.PureSource

The pure interface to the client part of uDns.

Various helper modules to do with side effects are available from Dns_client_lwt, Dns_client_unix and so forth.

Sourcetype 'key query_state constraint 'key = 'a Dns.Rr_map.key

query_state is parameterized over the query type, so the type of the representation of the answer depends on what the name server was asked to provide. See Dns.Rr_map.k for a list of response types. The first element (the int32) in most of the tuples is the Time-To-Live (TTL) field returned from the server, which you can use to calculate when you should request fresh information in case you are writing a long-running application.

Sourceval make_query : (int -> string) -> Dns.proto -> ?dnssec:bool -> [ `None | `Auto | `Manual of Dns.Edns.t ] -> 'a Domain_name.t -> 'query_type Dns.Rr_map.key -> string * 'query_type Dns.Rr_map.key query_state

make_query rng protocol name query_type is query, query_state where query is the serialized DNS query to send to the name server, and query_state is the information required to validate the response.

Sourceval parse_response : 'query_type Dns.Rr_map.key query_state -> string -> (Dns.Packet.reply, [ `Partial | `Msg of string ]) result

parse_response query_state response is the information contained in response parsed using query_state when the query was successful, or an `Msg message if the response did not match the query_state (or if the query failed).

In a TCP usage context the `Partial means there are more bytes to be read in order to parse correctly. This can happen due to short reads or if the server (or something along the route) chunks its responses into multiple individual packets. In that case you should concatenate response and the next received data and call this function again.

In a UDP usage context the `Partial means information was lost, due to an incomplete packet.

Sourceval handle_response : 'query_type Dns.Rr_map.key query_state -> string -> ([ `Data of 'query_type | `Partial | `No_data of [ `raw ] Domain_name.t * Dns.Soa.t | `No_domain of [ `raw ] Domain_name.t * Dns.Soa.t ], [ `Msg of string ]) result

handle_response query_state response is the information contained in response parsed using query_state when the query was successful, or an `Msg message if the response did not match the query_state (or if the query failed).

In a TCP usage context the `Partial means there are more bytes to be read in order to parse correctly. This can happen due to short reads or if the server (or something along the route) chunks its responses into multiple individual packets. In that case you should concatenate response and the next received data and call this function again.

In a UDP usage context the `Partial means information was lost, due to an incomplete packet.