2012-05-21 11:12:37 +00: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 02:53:21 +00:00
|
|
|
|
2005-04-06 01:33:28 +00:00
|
|
|
#include "nsISupports.idl"
|
1999-06-12 02:53:21 +00:00
|
|
|
|
2017-02-15 03:53:37 +00:00
|
|
|
%{ C++
|
|
|
|
#include "mozilla/BasePrincipal.h"
|
|
|
|
%}
|
|
|
|
|
2005-04-06 01:33:28 +00:00
|
|
|
interface nsICancelable;
|
|
|
|
interface nsIEventTarget;
|
|
|
|
interface nsIDNSRecord;
|
|
|
|
interface nsIDNSListener;
|
1999-06-12 02:53:21 +00:00
|
|
|
|
2012-12-10 14:13:55 +00:00
|
|
|
%{C++
|
2016-07-20 15:29:36 +00:00
|
|
|
#include "nsTArrayForwardDeclare.h"
|
2012-12-10 14:13:55 +00:00
|
|
|
namespace mozilla { namespace net {
|
|
|
|
struct DNSCacheEntries;
|
|
|
|
} }
|
|
|
|
%}
|
|
|
|
|
|
|
|
[ptr] native EntriesArray(nsTArray<mozilla::net::DNSCacheEntries>);
|
2017-02-15 03:53:37 +00:00
|
|
|
[ref] native OriginAttributes(const mozilla::OriginAttributes);
|
2012-12-10 14:13:55 +00:00
|
|
|
|
2003-09-11 20:32:33 +00:00
|
|
|
/**
|
|
|
|
* nsIDNSService
|
|
|
|
*/
|
2015-02-19 05:14:00 +00:00
|
|
|
[scriptable, uuid(de5642c6-61fc-4fcf-9a47-03226b0d4e21)]
|
1999-06-12 02:53:21 +00:00
|
|
|
interface nsIDNSService : nsISupports
|
|
|
|
{
|
2001-03-23 02:19:37 +00:00
|
|
|
/**
|
2003-09-11 20:32:33 +00:00
|
|
|
* kicks off an asynchronous host lookup.
|
|
|
|
*
|
|
|
|
* @param aHostName
|
|
|
|
* the hostname or IP-address-literal to resolve.
|
2004-09-01 19:55:58 +00:00
|
|
|
* @param aFlags
|
|
|
|
* a bitwise OR of the RESOLVE_ prefixed constants defined below.
|
2003-09-11 20:32:33 +00:00
|
|
|
* @param aListener
|
|
|
|
* the listener to be notified when the result is available.
|
2006-05-10 17:30:15 +00:00
|
|
|
* @param aListenerTarget
|
2003-09-11 20:32:33 +00:00
|
|
|
* optional parameter (may be null). if non-null, this parameter
|
2006-05-10 17:30:15 +00: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).
|
2017-02-15 03:53:37 +00:00
|
|
|
* @param aOriginAttributes
|
|
|
|
* the originAttribute for this resolving, the DNS cache will be
|
|
|
|
* separated according to this originAttributes. This attribute is
|
|
|
|
* optional to avoid breaking add-ons.
|
2003-09-11 20:32:33 +00:00
|
|
|
*
|
2005-04-06 01:33:28 +00:00
|
|
|
* @return An object that can be used to cancel the host lookup.
|
2003-09-11 20:32:33 +00:00
|
|
|
*/
|
2017-02-15 03:53:37 +00:00
|
|
|
[implicit_jscontext, optional_argc]
|
2006-05-10 17:30:15 +00:00
|
|
|
nsICancelable asyncResolve(in AUTF8String aHostName,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in nsIDNSListener aListener,
|
2017-02-15 03:53:37 +00:00
|
|
|
in nsIEventTarget aListenerTarget,
|
|
|
|
[optional] in jsval aOriginAttributes);
|
|
|
|
|
|
|
|
[notxpcom]
|
|
|
|
nsresult asyncResolveNative(in AUTF8String aHostName,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in nsIDNSListener aListener,
|
|
|
|
in nsIEventTarget aListenerTarget,
|
|
|
|
in OriginAttributes aOriginAttributes,
|
|
|
|
out nsICancelable aResult);
|
2001-03-23 02:19:37 +00:00
|
|
|
|
2012-01-20 23:14:46 +00: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
|
2017-02-15 03:53:37 +00:00
|
|
|
* @param aOriginAttributes
|
|
|
|
* the originAttribute for this resolving. This attribute is optional
|
|
|
|
* to avoid breaking add-ons.
|
2012-01-20 23:14:46 +00:00
|
|
|
*
|
|
|
|
* @return An object that can be used to cancel the host lookup.
|
|
|
|
*/
|
2017-02-15 03:53:37 +00:00
|
|
|
[implicit_jscontext, optional_argc]
|
2012-01-20 23:14:46 +00:00
|
|
|
void cancelAsyncResolve(in AUTF8String aHostName,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in nsIDNSListener aListener,
|
2017-02-15 03:53:37 +00:00
|
|
|
in nsresult aReason,
|
|
|
|
[optional] in jsval aOriginAttributes);
|
|
|
|
|
|
|
|
[notxpcom]
|
|
|
|
nsresult cancelAsyncResolveNative(in AUTF8String aHostName,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in nsIDNSListener aListener,
|
|
|
|
in nsresult aReason,
|
|
|
|
in OriginAttributes aOriginAttributes);
|
2015-02-19 05:14:00 +00:00
|
|
|
|
2000-07-31 21:24:55 +00:00
|
|
|
/**
|
2013-01-22 16:59:01 +00:00
|
|
|
* called to synchronously resolve a hostname. warning this method may
|
|
|
|
* block the calling thread for a long period of time. it is extremely
|
|
|
|
* unwise to call this function on the UI thread of an application.
|
2003-09-11 20:32:33 +00:00
|
|
|
*
|
|
|
|
* @param aHostName
|
|
|
|
* the hostname or IP-address-literal to resolve.
|
2004-09-01 19:55:58 +00:00
|
|
|
* @param aFlags
|
|
|
|
* a bitwise OR of the RESOLVE_ prefixed constants defined below.
|
2017-02-15 03:53:37 +00:00
|
|
|
* @param aOriginAttributes
|
|
|
|
* the originAttribute for this resolving, the DNS cache will be
|
|
|
|
* separated according to this originAttributes. This attribute is
|
|
|
|
* optional to avoid breaking add-ons.
|
2003-09-11 20:32:33 +00:00
|
|
|
*
|
|
|
|
* @return DNS record corresponding to the given hostname.
|
|
|
|
* @throws NS_ERROR_UNKNOWN_HOST if host could not be resolved.
|
|
|
|
*/
|
2017-02-15 03:53:37 +00:00
|
|
|
[implicit_jscontext, optional_argc]
|
2004-09-01 19:55:58 +00:00
|
|
|
nsIDNSRecord resolve(in AUTF8String aHostName,
|
2017-02-15 03:53:37 +00:00
|
|
|
in unsigned long aFlags,
|
|
|
|
[optional] in jsval aOriginAttributes);
|
|
|
|
|
|
|
|
[notxpcom]
|
|
|
|
nsresult resolveNative(in AUTF8String aHostName,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in OriginAttributes aOriginAttributes,
|
|
|
|
out nsIDNSRecord aResult);
|
2000-07-31 21:24:55 +00:00
|
|
|
|
2015-02-19 05:14:00 +00:00
|
|
|
/**
|
|
|
|
* kicks off an asynchronous host lookup.
|
|
|
|
*
|
|
|
|
* This function is identical to asyncResolve except an additional
|
|
|
|
* parameter aNetwortInterface. If parameter aNetworkInterface is an empty
|
|
|
|
* string function will return the same result as asyncResolve.
|
2017-08-12 00:45:18 +00:00
|
|
|
* Setting aNetworkInterface is deprecated.
|
2015-02-19 05:14:00 +00:00
|
|
|
*/
|
2017-02-15 03:53:37 +00:00
|
|
|
[implicit_jscontext, optional_argc]
|
2015-02-19 05:14:00 +00:00
|
|
|
nsICancelable asyncResolveExtended(in AUTF8String aHostName,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in AUTF8String aNetworkInterface,
|
|
|
|
in nsIDNSListener aListener,
|
2017-02-15 03:53:37 +00:00
|
|
|
in nsIEventTarget aListenerTarget,
|
|
|
|
[optional] in jsval aOriginAttributes);
|
|
|
|
|
|
|
|
[notxpcom]
|
|
|
|
nsresult asyncResolveExtendedNative(in AUTF8String aHostName,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in AUTF8String aNetworkInterface,
|
|
|
|
in nsIDNSListener aListener,
|
|
|
|
in nsIEventTarget aListenerTarget,
|
|
|
|
in OriginAttributes aOriginAttributes,
|
|
|
|
out nsICancelable aResult);
|
2015-02-19 05:14:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Attempts to cancel a previously requested async DNS lookup
|
|
|
|
* This is an extended versin with a additional parameter aNetworkInterface
|
|
|
|
*/
|
2017-02-15 03:53:37 +00:00
|
|
|
[implicit_jscontext, optional_argc]
|
2015-02-19 05:14:00 +00:00
|
|
|
void cancelAsyncResolveExtended(in AUTF8String aHostName,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in AUTF8String aNetworkInterface,
|
|
|
|
in nsIDNSListener aListener,
|
2017-02-15 03:53:37 +00:00
|
|
|
in nsresult aReason,
|
|
|
|
[optional] in jsval aOriginAttributes);
|
|
|
|
|
|
|
|
[notxpcom]
|
|
|
|
nsresult cancelAsyncResolveExtendedNative(in AUTF8String aHostName,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in AUTF8String aNetworkInterface,
|
|
|
|
in nsIDNSListener aListener,
|
|
|
|
in nsresult aReason,
|
|
|
|
in OriginAttributes aOriginAttributes);
|
2015-02-19 05:14:00 +00:00
|
|
|
|
2012-12-10 14:13:55 +00:00
|
|
|
/**
|
|
|
|
* The method takes a pointer to an nsTArray
|
|
|
|
* and fills it with cache entry data
|
|
|
|
* Called by the networking dashboard
|
|
|
|
*/
|
|
|
|
[noscript] void getDNSCacheEntries(in EntriesArray args);
|
|
|
|
|
2003-09-11 20:32:33 +00:00
|
|
|
/**
|
|
|
|
* @return the hostname of the operating system.
|
|
|
|
*/
|
|
|
|
readonly attribute AUTF8String myHostName;
|
2004-09-01 19:55:58 +00: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-07 23:00:26 +00: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-06 21:26:33 +00:00
|
|
|
|
|
|
|
/**
|
2016-07-20 15:29:36 +00:00
|
|
|
* if set, indicates request is speculative. Speculative requests
|
2009-05-06 21:26:33 +00:00
|
|
|
* return errors if prefetching is disabled by configuration.
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_SPECULATE = (1 << 4);
|
2011-07-04 09:47:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If set, only IPv4 addresses will be returned from resolve/asyncResolve.
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_DISABLE_IPV6 = (1 << 5);
|
2012-09-17 23:45:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If set, only literals and cached entries will be returned from resolve/
|
|
|
|
* asyncResolve.
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_OFFLINE = (1 << 6);
|
2013-01-29 22:49:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If set, only IPv6 addresses will be returned from resolve/asyncResolve.
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_DISABLE_IPV4 = (1 << 7);
|
2015-05-08 18:18:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If set, allow name collision results (127.0.53.53) which are normally filtered.
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_ALLOW_NAME_COLLISION = (1 << 8);
|
1999-06-12 02:53:21 +00:00
|
|
|
};
|