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
|
|
|
|
*/
|
2019-05-13 19:51:49 +00:00
|
|
|
[scriptable, builtinclass, 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
|
|
|
|
2018-09-22 20:54:11 +00:00
|
|
|
/**
|
|
|
|
* kicks off an asynchronous host lookup by type, e.g. TXT.
|
|
|
|
*
|
|
|
|
* @param aHostName
|
|
|
|
* the hostname or IP-address-literal to resolve.
|
|
|
|
* @param aType
|
|
|
|
* one of RESOLVE_TYPE_*.
|
|
|
|
* @param aFlags
|
|
|
|
* a bitwise OR of the RESOLVE_ prefixed constants defined below
|
|
|
|
* except RESOLVE_CANONICAL_NAME, RESOLVE_DISABLE_IPV6 and
|
|
|
|
* RESOLVE_DISABLE_IPV4.
|
|
|
|
* @param aListener
|
|
|
|
* the listener to be notified when the result is available.
|
|
|
|
* @param aListenerTarget
|
|
|
|
* optional parameter (may be null). if non-null, this parameter
|
|
|
|
* 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).
|
|
|
|
* @param aOriginAttributes
|
|
|
|
* the originAttribute for this resolving, the DNS cache will be
|
|
|
|
* separated according to this originAttributes.
|
|
|
|
*
|
|
|
|
* @return An object that can be used to cancel the host lookup.
|
|
|
|
*/
|
|
|
|
[implicit_jscontext, optional_argc]
|
|
|
|
nsICancelable asyncResolveByType(in AUTF8String aHostName,
|
|
|
|
in unsigned short aType,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in nsIDNSListener aListener,
|
|
|
|
in nsIEventTarget aListenerTarget,
|
|
|
|
in jsval aOriginAttributes);
|
|
|
|
|
|
|
|
[notxpcom]
|
|
|
|
nsresult asyncResolveByTypeNative(in AUTF8String aHostName,
|
|
|
|
in unsigned short aType,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in nsIDNSListener aListener,
|
|
|
|
in nsIEventTarget aListenerTarget,
|
|
|
|
in OriginAttributes aOriginAttributes,
|
|
|
|
out nsICancelable aResult);
|
|
|
|
|
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
|
|
|
*/
|
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
|
|
|
|
2018-09-22 20:54:11 +00:00
|
|
|
/**
|
|
|
|
* Attempts to cancel a previously requested async DNS lookup
|
|
|
|
*
|
|
|
|
* @param aHostName
|
|
|
|
* the hostname or IP-address-literal to resolve.
|
|
|
|
* @param aType
|
|
|
|
* one of RESOLVE_TYPE_*.
|
|
|
|
* @param aFlags
|
|
|
|
* a bitwise OR of the RESOLVE_ prefixed constants defined below
|
|
|
|
* except RESOLVE_CANONICAL_NAME, RESOLVE_DISABLE_IPV6 and
|
|
|
|
* RESOLVE_DISABLE_IPV4.
|
|
|
|
* @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
|
|
|
|
* @param aOriginAttributes
|
|
|
|
* the originAttribute for this resolving. This attribute is optional
|
|
|
|
* to avoid breaking add-ons.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
[implicit_jscontext, optional_argc]
|
|
|
|
void cancelAsyncResolveByType(in AUTF8String aHostName,
|
|
|
|
in unsigned short aType,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in nsIDNSListener aListener,
|
|
|
|
in nsresult aReason,
|
|
|
|
in jsval aOriginAttributes);
|
|
|
|
|
|
|
|
[notxpcom]
|
|
|
|
nsresult cancelAsyncResolveByTypeNative(in AUTF8String aHostName,
|
|
|
|
in unsigned short aType,
|
|
|
|
in unsigned long aFlags,
|
|
|
|
in nsIDNSListener aListener,
|
|
|
|
in nsresult aReason,
|
|
|
|
in OriginAttributes aOriginAttributes);
|
|
|
|
|
2000-07-31 21:24:55 +00:00
|
|
|
/**
|
2017-09-11 02:13:42 +00:00
|
|
|
* called to synchronously resolve a hostname.
|
|
|
|
*
|
|
|
|
* Since this method may block the calling thread for a long period of
|
|
|
|
* time, it may not be accessed from the main thread.
|
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-09-11 02:13:42 +00:00
|
|
|
* @throws NS_ERROR_NOT_AVAILABLE if accessed from the main thread.
|
2003-09-11 20:32:33 +00:00
|
|
|
*/
|
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
|
|
|
|
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);
|
|
|
|
|
2019-03-21 12:41:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears the DNS cache.
|
|
|
|
* @param aTrrToo
|
|
|
|
* If true we will clear TRR cached entries too. Since these
|
|
|
|
* are resolved remotely it's not necessary to clear them when
|
|
|
|
* the network status changes, but it's sometimes useful to do so
|
|
|
|
* for tests or other situations.
|
|
|
|
*/
|
|
|
|
void clearCache(in boolean aTrrToo);
|
|
|
|
|
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);
|
2018-02-01 09:20:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If set, do not use TRR for resolving the host name.
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_DISABLE_TRR = (1 << 9);
|
|
|
|
|
2018-03-06 13:50:21 +00:00
|
|
|
/**
|
|
|
|
* if set (together with RESOLVE_BYPASS_CACHE), invalidate the DNS
|
|
|
|
* existing cache entry first (if existing) then make a new resolve.
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_REFRESH_CACHE = (1 << 10);
|
2018-09-22 20:54:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This ure dns request types that are currently supported.
|
|
|
|
* RESOLVE_TYPE_DEFAULT is standard A/AAAA lookup
|
|
|
|
* The others (currently only TXT supported) are wireformat types
|
|
|
|
*/
|
|
|
|
const unsigned long RESOLVE_TYPE_DEFAULT = 0;
|
|
|
|
const unsigned long RESOLVE_TYPE_TXT = 16;
|
1999-06-12 02:53:21 +00:00
|
|
|
};
|