The following classes and interfaces describe the architecture of the mDNS module.
MDNS Admin Interface
The MDNSAdmin interface is the main entry point for managing services over IP network using mDNS and DNS-SD. The mDNS is used for resolving hostnames and DNS-SD is used for publishing and discovering services. Under this interface an OSGi service having specific implementation should be registered.
Currently, the only available implementation is the one over JmDNS. Once registered the MDNSAdmin implementation over JmDNS initializes the underlying JmDNS module.
The MDNSAdmin interface contains the following methods:
register – Starts a registration for a new service
list – Lists all known service instances
browse – Scans the network for mDNS services with the specified type
resolve – Sends resolve request for the specified mDNS service with the specified type and name
getServiceTypes – Lists the currently known service types
getServiceInstance – Gets a known service instance
Service Instance
The ServiceInstance class represents physical instance of a service. A service must have descriptor and must be bound to specific domain, host name port and network interface.
There is a property location showing if the service is running on the same process, on the same machine or on a remote machine.
Each service instance has the following properties:
serviceDescriptor – Contains service information
domain – Specifies the domain on which to publish the service
port – Specifies port number on which the service is running
host – Specifies the target hostname on which to publish the service
inetAddresses – Contains a list of network interfaces on which the service is bound to
location – Shows if the service is running on the same process, on the same machine or on a remote machine
fullyQualifiedType – Contains fully qualified service type, following the mDNS specification. For example: _http._tcp.local
Service Instance Registration
The ServiceInstanceRegistration interface provides means for managing service after it has been populated for registering.
The following methods are present here:
updateTXTRecord – Updates TXT Record with new values. After update re-announce of this service should happen. Re-announce is notified by events with topic MDNSConstants.TOPIC_SERVICE_INSTANCE_RESOLVED} through OSGi Event Admin