Module Mdns_responder

Multicast DNS (RFC 6762) Responder.

This is roughly the mDNS equivalent of Dns_server, in that it accepts mDNS query packets and responds with the matching records from a zone file.

The simplest usage is with shared resource records only, which requires the following steps:

  1. Create a module from a zone buffer using the "Make" functor.
  2. Call the module's "announce" function to announce the records.
  3. After announcement completes, call the "process" function for each received packet.

The use of unique resource records requires alternative steps:

  1. Create a module from a zone buffer using the "Make" functor.
  2. Call "add_unique_hostname" to add the a unique "A" record.
  3. Call the module's "first_probe" function to probe for uniqueness of the hostname. The name will be changed to something unique in the event of a conflict.
  4. After probing completes, call the module's "announce" function.
  5. After announcement completes, call the "process" function for each received packet.

As per RFC 6762 section 9, if at any time the responder observes a response that conflicts with a record that was previously already confirmed as unique, it restarts the probing sequence. Therefore, it is necessary to invoke the "stop_probe" function to shut down the responder.

type ip_endpoint = Ipaddr.V4.t * int

An endpoint address consisting of an IPv4 address and a UDP port number.

module type TRANSPORT : sig ... end

Encapsulates the dependencies that the responder requires for performing I/O.

module Make : functor (Transport : TRANSPORT) -> sig ... end

Creates an mDNS responder module given a module that provides I/O functions.