1*3f982cf4SFabien Sanglard# Discovery 2*3f982cf4SFabien Sanglard 3*3f982cf4SFabien SanglardThis discovery module is an implementation of the mDNS and DNS-SD protocols as 4*3f982cf4SFabien Sanglarddefined in [RFC 6762](https://tools.ietf.org/html/rfc6762) and 5*3f982cf4SFabien Sanglard[RFC 6763](https://tools.ietf.org/html/rfc6763). The protocols have been fully 6*3f982cf4SFabien Sanglardimplemented, with the exceptions called out below. 7*3f982cf4SFabien Sanglard 8*3f982cf4SFabien SanglardOther modules in Open Screen use this module to advertise and discover 9*3f982cf4SFabien Sanglardpresentation displays. If you wish to provide your own implementation of DNS-SD, 10*3f982cf4SFabien Sanglardimplement the 11*3f982cf4SFabien Sanglard[DNS-SD public interfaces](https://chromium.googlesource.com/openscreen/+/refs/heads/master/discovery/dnssd/public) 12*3f982cf4SFabien Sanglardand updating the linker rules. In this case, the 13*3f982cf4SFabien Sanglard[public discovery layer](https://chromium.googlesource.com/openscreen/+/refs/heads/master/discovery/public) 14*3f982cf4SFabien Sanglardwill continue to function as described below. 15*3f982cf4SFabien Sanglard 16*3f982cf4SFabien SanglardNote that this DNS-SD implementation is fully generic and can be used for 17*3f982cf4SFabien Sanglardadvertisement and discovery of any RFC 6763 compliant services. 18*3f982cf4SFabien Sanglard 19*3f982cf4SFabien Sanglard 20*3f982cf4SFabien Sanglard## How To Use This Module 21*3f982cf4SFabien Sanglard 22*3f982cf4SFabien SanglardIn order to use the discovery module, embedders should only need to reference 23*3f982cf4SFabien Sanglardthe 24*3f982cf4SFabien Sanglard[public](https://chromium.googlesource.com/openscreen/+/refs/heads/master/discovery/public) 25*3f982cf4SFabien Sanglardand 26*3f982cf4SFabien Sanglard[common](https://chromium.googlesource.com/openscreen/+/refs/heads/master/discovery/common) 27*3f982cf4SFabien Sanglarddirectories. The 28*3f982cf4SFabien Sanglard[DNS-SD](https://chromium.googlesource.com/openscreen/+/refs/heads/master/discovery/dnssd) 29*3f982cf4SFabien Sanglardand 30*3f982cf4SFabien Sanglard[mDNS](https://chromium.googlesource.com/openscreen/+/refs/heads/master/discovery/mdns) 31*3f982cf4SFabien Sanglardlayers should not be accessed. In order to encourage this behavior, DEPS rules 32*3f982cf4SFabien Sanglardhave been defined. 33*3f982cf4SFabien Sanglard 34*3f982cf4SFabien SanglardThe config directory provides parameters needed to configure the discovery 35*3f982cf4SFabien Sanglardmodule. Specifically: 36*3f982cf4SFabien Sanglard 37*3f982cf4SFabien Sanglard* The 38*3f982cf4SFabien Sanglard[openscreen::discovery::Config struct](https://chromium.googlesource.com/openscreen/+/refs/heads/master/discovery/common/config.h) 39*3f982cf4SFabien Sanglardprovides the required data to publish or discover service 40*3f982cf4SFabien Sanglardinstances, such as a list of valid network interfaces or constants used to 41*3f982cf4SFabien Sanglardconfigure the underlying stack. 42*3f982cf4SFabien Sanglard* The 43*3f982cf4SFabien Sanglard[openscreen::discovery::ReportingClient](https://chromium.googlesource.com/openscreen/+/refs/heads/master/discovery/common/reporting_client.h) 44*3f982cf4SFabien Sanglardprovides a way for embedders to receive callbacks for errors which occur inside 45*3f982cf4SFabien Sanglardthe discovery implementation. 46*3f982cf4SFabien Sanglard 47*3f982cf4SFabien SanglardThe public directory provides wrappers around the DNS-SD protocol to simplify 48*3f982cf4SFabien Sanglardinteracting with the internals of this module: 49*3f982cf4SFabien Sanglard 50*3f982cf4SFabien Sanglard* The 51*3f982cf4SFabien Sanglard[openscreen::discovery::DnsSdServicePublisher](https://chromium.googlesource.com/openscreen/+/refs/heads/master/discovery/public/dns_sd_service_publisher.h) 52*3f982cf4SFabien Sanglardprovides a simple interface for registering, updating, and de-registering DNS-SD 53*3f982cf4SFabien Sanglardservice instances. 54*3f982cf4SFabien Sanglard* The 55*3f982cf4SFabien Sanglard[openscreen::discovery::DnsSdServiceWatcher](https://chromium.googlesource.com/openscreen/+/refs/heads/master/discovery/public/dns_sd_service_watcher.h) 56*3f982cf4SFabien Sanglardprovides an interface to begin and end querying for service types, providing 57*3f982cf4SFabien Sanglardcallbacks for the embedder to be notified whenever an instance is discovered, 58*3f982cf4SFabien Sanglardchanged, or deleted. 59*3f982cf4SFabien Sanglard 60*3f982cf4SFabien SanglardFor an example use case of this module, see the 61*3f982cf4SFabien Sanglard[standalone sender](https://chromium.googlesource.com/openscreen/+/refs/heads/master/cast/standalone_sender/main.cc) 62*3f982cf4SFabien Sanglardand 63*3f982cf4SFabien Sanglard[standalone receiver](https://chromium.googlesource.com/openscreen/+/refs/heads/master/cast/standalone_receiver/main.cc) 64*3f982cf4SFabien Sanglardcode. 65*3f982cf4SFabien Sanglard 66*3f982cf4SFabien Sanglard 67*3f982cf4SFabien Sanglard## Limitations 68*3f982cf4SFabien Sanglard 69*3f982cf4SFabien SanglardThis implementation has been created to fulfill the role of discovery for the 70*3f982cf4SFabien SanglardCastV2 protocol. For this reason, some details or optimizations called out in 71*3f982cf4SFabien Sanglardthe RFC documents had cost or additional required complexity that outweighed the 72*3f982cf4SFabien Sanglardadded benefit they provided. As such, the following have not been fully 73*3f982cf4SFabien Sanglardimplemented: 74*3f982cf4SFabien Sanglard 75*3f982cf4SFabien Sanglard* [Selective Instance Enumeration](https://tools.ietf.org/html/rfc6763#section-7.1) 76*3f982cf4SFabien Sanglardis not supported. 77*3f982cf4SFabien Sanglard* [Multiple SRV records](https://tools.ietf.org/html/rfc6763#section-5) for a 78*3f982cf4SFabien Sanglardsingle service instance are not supported. 79*3f982cf4SFabien Sanglard* [Multiple TXT records](https://tools.ietf.org/html/rfc6763#section-6.8) for a 80*3f982cf4SFabien Sanglardsingle service instance are not supported. 81*3f982cf4SFabien Sanglard* Hosts which publish [no TXT record](https://tools.ietf.org/html/rfc6763#section-6.1) 82*3f982cf4SFabien Sanglardare treated as invalid. However, hosts which publish 83*3f982cf4SFabien Sanglard[an empty TXT record](https://tools.ietf.org/html/rfc6763#section-6.1) are 84*3f982cf4SFabien Sanglardvalid. 85*3f982cf4SFabien Sanglard* [Duplicate Question Suppression](https://tools.ietf.org/html/rfc6762#section-7.3) 86*3f982cf4SFabien Sanglardhas not been implemented. 87*3f982cf4SFabien Sanglard 88*3f982cf4SFabien SanglardAdditionally, the following limitations should be noted: 89*3f982cf4SFabien Sanglard 90*3f982cf4SFabien Sanglard* If network interface information is changed, the discovery stack must be 91*3f982cf4SFabien Sanglardre-initialized. 92*3f982cf4SFabien Sanglard* If a 93*3f982cf4SFabien Sanglard[fatal error](https://chromium.googlesource.com/openscreen/+/refs/heads/master/discovery/common/reporting_client.h#25) 94*3f982cf4SFabien Sanglardoccurs, the discovery stack must be re-initialized. 95