Multicast DNS


Detailed Description

As networked devices become smaller, more portable, and more ubiquitous, the ability to operate with less configured infrastructure is increasingly important.

In particular, the ability to look up DNS resource record data types (including, but not limited to, host names) in the absence of a conventional managed DNS server, is becoming essential.

Multicast DNS (mDNS) provides the ability to do DNS-like operations on the local link in the absence of any conventional unicast DNS server. In addition, mDNS designates a portion of the DNS namespace to be free for local use, without the need to pay any annual fee, and without the need to set up delegations or otherwise configure a conventional DNS server to answer for those names (Source: Abstract of the Multicast DNS internet draft from 2006).

DNS Service Discovery is a way of using standard DNS programming interfaces, servers, and packet formats to browse the network for services (Source: www.dns-sd.org).

References and recommended reading: RFC 1034, RFC 1035, Internet drafts for mDNS and DNS-SD.


Files

file  mdns.c
 Multicast Domain Name System (MDNS) implementation file for the Netzer application.
file  mdns.h
 MDNS Client Module Header file for the application.

Modules

 Resolving records
 The module include functions for resolving unique records like hostname or service records.

Defines

#define MDNS_PORT   5353u
 The MDNS UDP port.
#define DNS_PORT   53u
 The DNS UDP port.
#define DNS_TYPE_A   (0x0001u)
 DNS type for hostnames.
#define DNS_TYPE_PTR   (0x000cu)
 DNS type for pointer records.
#define DNS_TYPE_MX   (0x000fu)
 DNS type for mailbox records.
#define DNS_TYPE_SRV   (0x0021u)
 DNS type for service records.
#define DNS_TYPE_TXT   (0x0010u)
 DNS type for text records.
#define DNS_TYPE_ANY   (0x00FFu)
 DNS type for all records.

Enumerations

enum  _MDNS_STATE { MDNS_HAS_STOPPED = 0, MDNS_IS_STARTING_UP, MDNS_IS_RUNNING }
 Possible states of the MDNS responder service. More...

Functions

BOOL bInitMDNSResponder (WORD HTTPPort)
 The function initializes the MDNS service.
void StartMDNSResponder (void)
 The service is started by a call of this function.
void StopMDNSResponder (void)
 The service is stopped by a call of this function.
void MDNSResponder (void)
 The function implements the state machine of the MDNS responder.
void MDNSProcessFrame (NODE_INFO *remoteNode, IP_ADDR *localIP)
 In the MDNS module the state machine and the receiption of frames are divorced.
MDNS_STATE eGetMDNSState (void)
 The function retrieves the state of the MDNS responder.


Enumeration Type Documentation

Possible states of the MDNS responder service.

The state of the service can be requested by the eGetMDNSState function.

Enumerator:
MDNS_HAS_STOPPED  The MDNS service has stopped.
MDNS_IS_STARTING_UP  The service is starting.
MDNS_IS_RUNNING  The service is running.


Function Documentation

BOOL bInitMDNSResponder ( WORD  HTTPPort  ) 

The function initializes the MDNS service.

The application must call this function at least once before starting and using the service. After the sucessful init the application can start the service with StartMDNSResponder. Every time the network interface changes, the application must call this function to ensure the correct functionality of the service.

Parameters:
HTTPPort The currently used port of the HTTP service.
Return values:
TRUE The initialization was successful.
FALSE The initialization was not successful and therefore the service can not be used.
Precondition:
First call this function after got the IP address and checked the validness.

MDNS_STATE eGetMDNSState ( void   ) 

The function retrieves the state of the MDNS responder.

For a simplified API only a few states from the internal MDNS state machine are returned.

Returns:
The state of the MDNS responder.

void MDNSProcessFrame ( NODE_INFO remoteNode,
IP_ADDR *  localIP 
)

In the MDNS module the state machine and the receiption of frames are divorced.

The receiption of frames is handled stateless and answers will be promptly generated. For quick processing the UDP module should check for the MDNS socket or event he MDNS port in received messages and call this function directly. With the given parameters the function filters for relevant frames.

Precondition:
The responder must be initialzed by a bInitMDNSResponder call and started by a StartMDNSResponder call.
Parameters:
remoteNode Extracted information about the remote node (MAC and IP).
localIP The IP address where the frame was send to (can be a unicast or multicast address).

void MDNSResponder ( void   ) 

The function implements the state machine of the MDNS responder.

The application must call this function periodically. The state machine handles the starting and the resolve procedures.

Precondition:
The responder must be initialzed by a bInitMDNSResponder call and started by a StartMDNSResponder call.

void StartMDNSResponder ( void   ) 

The service is started by a call of this function.

The application should check the state of the service with eGetMDNSState if the service was started successfully. The starting procedure can take some milliseconds or seconds. The procedure includes a so called probing, where all the unique DNS records (see MDNS draft for a detailed discussion about unique and shared records). will be announced to the network. The procedures fails, if the network knows some of this unique records (i.e. the hostname is already taken by another host).

Precondition:
The responder must be initialzed by a bInitMDNSResponder call.

void StopMDNSResponder ( void   ) 

The service is stopped by a call of this function.

This function is called automatically in case the starting procedure fails. If the starting procedure was successful and the service is running before the call so-called "goodbye" announcements (see MDNS draft for details) for shared records will be send.

Precondition:
The responder must be initialzed by a bInitMDNSResponder call.


Generated on Fri Mar 29 10:34:28 2013 for Netzer by  doxygen 1.5.5