2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-06-12 06:53:21 +04:00
|
|
|
|
2005-04-06 05:33:28 +04:00
|
|
|
#include "nsISupports.idl"
|
1999-06-12 06:53:21 +04:00
|
|
|
|
2005-04-06 05:33:28 +04:00
|
|
|
interface nsICancelable;
|
|
|
|
interface nsIEventTarget;
|
|
|
|
interface nsIDNSRecord;
|
|
|
|
interface nsIDNSListener;
|
1999-06-12 06:53:21 +04:00
|
|
|
|
2003-09-12 00:32:33 +04:00
|
|
|
/**
|
|
|
|
* nsIDNSService
|
|
|
|
*/
|
2012-01-21 03:14:46 +04:00
|
|
|
[scriptable, uuid(F6E05CC3-8A13-463D-877F-D59B20B59724)]
|
1999-06-12 06:53:21 +04:00
|
|
|
interface nsIDNSService : nsISupports
|
|
|
|
{
|
2001-03-23 05:19:37 +03:00
|
|
|
/**
|
2003-09-12 00:32:33 +04:00
|
|
|
* kicks off an asynchronous host lookup.
|
|
|
|
*
|
|
|
|
* @param aHostName
|
|
|
|
* the hostname or IP-address-literal to resolve.
|
2004-09-01 23:55:58 +04:00
|
|
|
* @param aFlags
|
|
|
|
* a bitwise OR of the RESOLVE_ prefixed constants defined below.
|
2003-09-12 00:32:33 +04:00
|
|
|
* @param aListener
|
|
|
|
* the listener to be notified when the result is available.
|
2006-05-10 21:30:15 +04:00
|
|
|
* @param aListenerTarget
|
2003-09-12 00:32:33 +04:00
|
|
|
* optional parameter (may be null). if non-null, this parameter
|
2006-05-10 21:30:15 +04:00
|
|
|
* specifies the nsIEventTarget of the thread on which the
|
|
|
|
* listener's onLookupComplete should be called. however, if this
|
|
|
|
* parameter is null, then onLookupComplete will be called on an
|
|
|
|
* unspecified thread (possibly recursively).
|
2003-09-12 00:32:33 +04:00
|
|
|
*
|
2005-04-06 05:33:28 +04:00
|
|
|
* @return An object that can be used to cancel the host lookup.
|
2003-09-12 00:32:33 +04:00
|
|
|
*/
|
2006-05-10 21:30:15 +04:00
|
|
|
nsICancelable asyncResolve(in AUTF8String aHostName,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in nsIDNSListener aListener,
|
|
|
|
in nsIEventTarget aListenerTarget);
|
2001-03-23 05:19:37 +03:00
|
|
|
|
2012-01-21 03:14:46 +04:00
|
|
|
/**
|
|
|
|
* Attempts to cancel a previously requested async DNS lookup
|
|
|
|
*
|
|
|
|
* @param aHostName
|
|
|
|
* the hostname or IP-address-literal to resolve.
|
|
|
|
* @param aFlags
|
|
|
|
* a bitwise OR of the RESOLVE_ prefixed constants defined below.
|
|
|
|
* @param aListener
|
|
|
|
* the original listener which was to be notified about the host lookup
|
|
|
|
* result - used to match request information to requestor.
|
|
|
|
* @param aReason
|
|
|
|
* nsresult reason for the cancellation
|
|
|
|
*
|
|
|
|
* @return An object that can be used to cancel the host lookup.
|
|
|
|
*/
|
|
|
|
void cancelAsyncResolve(in AUTF8String aHostName,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in nsIDNSListener aListener,
|
|
|
|
in nsresult aReason);
|
|
|
|
|
2000-08-01 01:24:55 +04:00
|
|
|
/**
|
2012-09-29 08:50:59 +04:00
|
|
|
* Called to synchronously resolve a hostname. This method will fail
|
|
|
|
* if called from the main thread.
|
2003-09-12 00:32:33 +04:00
|
|
|
*
|
|
|
|
* @param aHostName
|
|
|
|
* the hostname or IP-address-literal to resolve.
|
2004-09-01 23:55:58 +04:00
|
|
|
* @param aFlags
|
|
|
|
* a bitwise OR of the RESOLVE_ prefixed constants defined below.
|
2003-09-12 00:32:33 +04:00
|
|
|
*
|
|
|
|
* @return DNS record corresponding to the given hostname.
|
|
|
|
* @throws NS_ERROR_UNKNOWN_HOST if host could not be resolved.
|
|
|
|
*/
|
2004-09-01 23:55:58 +04:00
|
|
|
nsIDNSRecord resolve(in AUTF8String aHostName,
|
|
|
|
in unsigned long aFlags);
|
2000-08-01 01:24:55 +04:00
|
|
|
|
2003-09-12 00:32:33 +04:00
|
|
|
/**
|
|
|
|
* @return the hostname of the operating system.
|
|
|
|
*/
|
|
|
|
readonly attribute AUTF8String myHostName;
|
2004-09-01 23:55:58 +04:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* Listed below are the various flags that may be OR'd together to form
|
|
|
|
* the aFlags parameter passed to asyncResolve() and resolve().
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* if set, this flag suppresses the internal DNS lookup cache.
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_BYPASS_CACHE = (1 << 0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* if set, the canonical name of the specified host will be queried.
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_CANONICAL_NAME = (1 << 1);
|
2008-11-08 02:00:26 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* if set, the query is given lower priority. Medium takes precedence
|
|
|
|
* if both are used.
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_PRIORITY_MEDIUM = (1 << 2);
|
|
|
|
const unsigned long RESOLVE_PRIORITY_LOW = (1 << 3);
|
2009-05-07 01:26:33 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* if set, indicates request is speculative. Speculative requests
|
|
|
|
* return errors if prefetching is disabled by configuration.
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_SPECULATE = (1 << 4);
|
2011-07-04 13:47:09 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If set, only IPv4 addresses will be returned from resolve/asyncResolve.
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_DISABLE_IPV6 = (1 << 5);
|
2012-09-18 03:45:10 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If set, only literals and cached entries will be returned from resolve/
|
|
|
|
* asyncResolve.
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_OFFLINE = (1 << 6);
|
1999-06-12 06:53:21 +04:00
|
|
|
};
|