/**@class android.net.nsd.NsdManager
@extends java.lang.Object

 The Network Service Discovery Manager class provides the API to discover services
 on a network. As an example, if device A and device B are connected over a Wi-Fi
 network, a game registered on device A can be discovered by a game on device
 B. Another example use case is an application discovering printers on the network.

 <p> The API currently supports DNS based service discovery and discovery is currently
 limited to a local network over Multicast DNS. DNS service discovery is described at
 http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt

 <p> The API is asynchronous and responses to requests from an application are on listener
 callbacks on a seperate internal thread.

 <p> There are three main operations the API supports - registration, discovery and resolution.
 <pre>
                          Application start
                                 |
                                 |
                                 |                  onServiceRegistered()
                     Register any local services  /
                      to be advertised with       \
                       registerService()            onRegistrationFailed()
                                 |
                                 |
                          discoverServices()
                                 |
                      Maintain a list to track
                        discovered services
                                 |
                                 |--------->
                                 |          |
                                 |      onServiceFound()
                                 |          |
                                 |     add service to list
                                 |          |
                                 |<----------
                                 |
                                 |--------->
                                 |          |
                                 |      onServiceLost()
                                 |          |
                                 |   remove service from list
                                 |          |
                                 |<----------
                                 |
                                 |
                                 | Connect to a service
                                 | from list ?
                                 |
                          resolveService()
                                 |
                         onServiceResolved()
                                 |
                     Establish connection to service
                     with the host and port information

 </pre>
 An application that needs to advertise itself over a network for other applications to
 discover it can do so with a call to {@link #registerService}. If Example is a http based
 application that can provide HTML data to peer services, it can register a name "Example"
 with service type "_http._tcp". A successful registration is notified with a callback to
 {@link android.net.nsd.NsdManager.RegistrationListener#onServiceRegistered} and a failure to register is notified
 over {@link android.net.nsd.NsdManager.RegistrationListener#onRegistrationFailed}

 <p> A peer application looking for http services can initiate a discovery for "_http._tcp"
 with a call to {@link #discoverServices}. A service found is notified with a callback
 to {@link android.net.nsd.NsdManager.DiscoveryListener#onServiceFound} and a service lost is notified on
 {@link android.net.nsd.NsdManager.DiscoveryListener#onServiceLost}.

 <p> Once the peer application discovers the "Example" http service, and either needs to read the
 attributes of the service or wants to receive data from the "Example" application, it can
 initiate a resolve with {@link #resolveService} to resolve the attributes, host, and port
 details. A successful resolve is notified on {@link android.net.nsd.NsdManager.ResolveListener#onServiceResolved} and a
 failure is notified on {@link android.net.nsd.NsdManager.ResolveListener#onResolveFailed}.

 Applications can reserve for a service type at
 http://www.iana.org/form/ports-service. Existing services can be found at
 http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml

 {@see NsdServiceInfo}
*/
var NsdManager = {

/** Broadcast intent action to indicate whether network service discovery is
 enabled or disabled. An extra {@link #EXTRA_NSD_STATE} provides the state
 information as int.

 @see #EXTRA_NSD_STATE
*/
ACTION_NSD_STATE_CHANGED : "android.net.nsd.STATE_CHANGED",
/** The lookup key for an int that indicates whether network service discovery is enabled
 or disabled. Retrieve it with {@link android.content.Intent#getIntExtra(String,int)}.

 @see #NSD_STATE_DISABLED
 @see #NSD_STATE_ENABLED
*/
EXTRA_NSD_STATE : "nsd_state",
/** Network service discovery is disabled

 @see #ACTION_NSD_STATE_CHANGED
*/
NSD_STATE_DISABLED : "1",
/** Network service discovery is enabled

 @see #ACTION_NSD_STATE_CHANGED
*/
NSD_STATE_ENABLED : "2",
/**@hide */
DISCOVER_SERVICES : "393217",
/**@hide */
DISCOVER_SERVICES_STARTED : "393218",
/**@hide */
DISCOVER_SERVICES_FAILED : "393219",
/**@hide */
SERVICE_FOUND : "393220",
/**@hide */
SERVICE_LOST : "393221",
/**@hide */
STOP_DISCOVERY : "393222",
/**@hide */
STOP_DISCOVERY_FAILED : "393223",
/**@hide */
STOP_DISCOVERY_SUCCEEDED : "393224",
/**@hide */
REGISTER_SERVICE : "393225",
/**@hide */
REGISTER_SERVICE_FAILED : "393226",
/**@hide */
REGISTER_SERVICE_SUCCEEDED : "393227",
/**@hide */
UNREGISTER_SERVICE : "393228",
/**@hide */
UNREGISTER_SERVICE_FAILED : "393229",
/**@hide */
UNREGISTER_SERVICE_SUCCEEDED : "393230",
/**@hide */
RESOLVE_SERVICE : "393234",
/**@hide */
RESOLVE_SERVICE_FAILED : "393235",
/**@hide */
RESOLVE_SERVICE_SUCCEEDED : "393236",
/**@hide */
ENABLE : "393240",
/**@hide */
DISABLE : "393241",
/**@hide */
NATIVE_DAEMON_EVENT : "393242",
/**Dns based service discovery protocol */
PROTOCOL_DNS_SD : "1",
/** Failures are passed with {@link android.net.nsd.NsdManager.RegistrationListener#onRegistrationFailed},
 {@link android.net.nsd.NsdManager.RegistrationListener#onUnregistrationFailed},
 {@link android.net.nsd.NsdManager.DiscoveryListener#onStartDiscoveryFailed},
 {@link android.net.nsd.NsdManager.DiscoveryListener#onStopDiscoveryFailed} or {@link android.net.nsd.NsdManager.ResolveListener#onResolveFailed}.

 Indicates that the operation failed due to an internal error.
*/
FAILURE_INTERNAL_ERROR : "0",
/** Indicates that the operation failed because it is already active.
*/
FAILURE_ALREADY_ACTIVE : "3",
/** Indicates that the operation failed because the maximum outstanding
 requests from the applications have reached.
*/
FAILURE_MAX_LIMIT : "4",
/**
@hide 
*/
nameOf : function(  ) {},

/**
@hide 
*/
disconnect : function(  ) {},

/**Register a service to be discovered by other services.

 <p> The function call immediately returns after sending a request to register service
 to the framework. The application is notified of a successful registration
 through the callback {@link android.net.nsd.NsdManager.RegistrationListener#onServiceRegistered} or a failure
 through {@link android.net.nsd.NsdManager.RegistrationListener#onRegistrationFailed}.

 <p> The application should call {@link #unregisterService} when the service
 registration is no longer required, and/or whenever the application is stopped.
@param {Object {NsdServiceInfo}} serviceInfo The service being registered
@param {Number} protocolType The service discovery protocol
@param {Object {NsdManager.RegistrationListener}} listener The listener notifies of a successful registration and is used to
 unregister this service through a call on {@link #unregisterService}. Cannot be null.
 Cannot be in use for an active service registration.
*/
registerService : function(  ) {},

/**Unregister a service registered through {@link #registerService}. A successful
 unregister is notified to the application with a call to
 {@link android.net.nsd.NsdManager.RegistrationListener#onServiceUnregistered}.
@param {Object {NsdManager.RegistrationListener}} listener This should be the listener object that was passed to
 {@link #registerService}. It identifies the service that should be unregistered
 and notifies of a successful or unsuccessful unregistration via the listener
 callbacks.  In API versions 20 and above, the listener object may be used for
 another service registration once the callback has been called.  In API versions <= 19,
 there is no entirely reliable way to know when a listener may be re-used, and a new
 listener should be created for each service registration request.
*/
unregisterService : function(  ) {},

/**Initiate service discovery to browse for instances of a service type. Service discovery
 consumes network bandwidth and will continue until the application calls
 {@link #stopServiceDiscovery}.

 <p> The function call immediately returns after sending a request to start service
 discovery to the framework. The application is notified of a success to initiate
 discovery through the callback {@link android.net.nsd.NsdManager.DiscoveryListener#onDiscoveryStarted} or a failure
 through {@link android.net.nsd.NsdManager.DiscoveryListener#onStartDiscoveryFailed}.

 <p> Upon successful start, application is notified when a service is found with
 {@link android.net.nsd.NsdManager.DiscoveryListener#onServiceFound} or when a service is lost with
 {@link android.net.nsd.NsdManager.DiscoveryListener#onServiceLost}.

 <p> Upon failure to start, service discovery is not active and application does
 not need to invoke {@link #stopServiceDiscovery}

 <p> The application should call {@link #stopServiceDiscovery} when discovery of this
 service type is no longer required, and/or whenever the application is paused or
 stopped.
@param {String} serviceType The service type being discovered. Examples include "_http._tcp" for
 http services or "_ipp._tcp" for printers
@param {Number} protocolType The service discovery protocol
@param {Object {NsdManager.DiscoveryListener}} listener  The listener notifies of a successful discovery and is used
 to stop discovery on this serviceType through a call on {@link #stopServiceDiscovery}.
 Cannot be null. Cannot be in use for an active service discovery.
*/
discoverServices : function(  ) {},

/**Stop service discovery initiated with {@link #discoverServices}.  An active service
 discovery is notified to the application with {@link android.net.nsd.NsdManager.DiscoveryListener#onDiscoveryStarted}
 and it stays active until the application invokes a stop service discovery. A successful
 stop is notified to with a call to {@link android.net.nsd.NsdManager.DiscoveryListener#onDiscoveryStopped}.

 <p> Upon failure to stop service discovery, application is notified through
 {@link android.net.nsd.NsdManager.DiscoveryListener#onStopDiscoveryFailed}.
@param {Object {NsdManager.DiscoveryListener}} listener This should be the listener object that was passed to {@link #discoverServices}.
 It identifies the discovery that should be stopped and notifies of a successful or
 unsuccessful stop.  In API versions 20 and above, the listener object may be used for
 another service discovery once the callback has been called.  In API versions <= 19,
 there is no entirely reliable way to know when a listener may be re-used, and a new
 listener should be created for each service discovery request.
*/
stopServiceDiscovery : function(  ) {},

/**Resolve a discovered service. An application can resolve a service right before
 establishing a connection to fetch the IP and port details on which to setup
 the connection.
@param {Object {NsdServiceInfo}} serviceInfo service to be resolved
@param {Object {NsdManager.ResolveListener}} listener to receive callback upon success or failure. Cannot be null.
 Cannot be in use for an active service resolution.
*/
resolveService : function(  ) {},

/**Internal use only @hide
*/
setEnabled : function(  ) {},


};