Plasma GitLab Archive
Projects Blog Knowledge

Module Uq_resolver


module Uq_resolver: sig .. end
Support for pluggable resolvers


A resolver maps several kinds of names to addresses, or vice versa. Currently, only DNS host lookups are supported (but this can be extended if needed).

The plugin mechanism allows one to change the name resovler Ocamlnet uses. Resolvers can be both synchronous or asynchronous. Note however, that the default resolver is synchronous and simply bases on Unix.gethostbyname.

Asynchronous Interface



The following types are the same as in Uq_engines, here only redefined for systematic reasons

type 'a engine_state = [ `Aborted | `Done of 'a | `Error of exn | `Working of int ] 
class type ['a] engine = object .. end

Exceptions
exception Host_not_found of string
This host cannot be resolved

The type of resolvers:
class type resolver = object .. end

Synchronous Interface


val get_host_by_name : ?resolver:resolver -> string -> Unix.host_entry
Look up the host, and return the host entry or raise the exception Host_not_found.

If a resolver is passed, this resolver is used, otherwise the pluggable resolver is used.

val sockaddr_of_socksymbol : ?resolver:resolver -> Netsockaddr.socksymbol -> Unix.sockaddr
Use the resolver to look up names in Netsockaddr.socksymbol, and convert the symbol to a Unix.sockaddr only containing IP addresses.

If a resolver is passed, this resolver is used, otherwise the pluggable resolver is used.


Plugins


val current_resolver : unit -> resolver
Returns the pluggable resolver
val set_current_resolver : resolver -> unit
Set the pluggable resolver
This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml