netwerk/dns/nsIDNSService.idl

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #include "nsISupports.idl"
michael@0 6
michael@0 7 interface nsICancelable;
michael@0 8 interface nsIEventTarget;
michael@0 9 interface nsIDNSRecord;
michael@0 10 interface nsIDNSListener;
michael@0 11
michael@0 12 %{C++
michael@0 13 template<class T> class nsTArray;
michael@0 14 namespace mozilla { namespace net {
michael@0 15 struct DNSCacheEntries;
michael@0 16 } }
michael@0 17 %}
michael@0 18
michael@0 19 [ptr] native EntriesArray(nsTArray<mozilla::net::DNSCacheEntries>);
michael@0 20
michael@0 21 /**
michael@0 22 * nsIDNSService
michael@0 23 */
michael@0 24 [scriptable, uuid(f1971942-19db-44bf-81e8-d15df220a39f)]
michael@0 25 interface nsIDNSService : nsISupports
michael@0 26 {
michael@0 27 /**
michael@0 28 * kicks off an asynchronous host lookup.
michael@0 29 *
michael@0 30 * @param aHostName
michael@0 31 * the hostname or IP-address-literal to resolve.
michael@0 32 * @param aFlags
michael@0 33 * a bitwise OR of the RESOLVE_ prefixed constants defined below.
michael@0 34 * @param aListener
michael@0 35 * the listener to be notified when the result is available.
michael@0 36 * @param aListenerTarget
michael@0 37 * optional parameter (may be null). if non-null, this parameter
michael@0 38 * specifies the nsIEventTarget of the thread on which the
michael@0 39 * listener's onLookupComplete should be called. however, if this
michael@0 40 * parameter is null, then onLookupComplete will be called on an
michael@0 41 * unspecified thread (possibly recursively).
michael@0 42 *
michael@0 43 * @return An object that can be used to cancel the host lookup.
michael@0 44 */
michael@0 45 nsICancelable asyncResolve(in AUTF8String aHostName,
michael@0 46 in unsigned long aFlags,
michael@0 47 in nsIDNSListener aListener,
michael@0 48 in nsIEventTarget aListenerTarget);
michael@0 49
michael@0 50 /**
michael@0 51 * Attempts to cancel a previously requested async DNS lookup
michael@0 52 *
michael@0 53 * @param aHostName
michael@0 54 * the hostname or IP-address-literal to resolve.
michael@0 55 * @param aFlags
michael@0 56 * a bitwise OR of the RESOLVE_ prefixed constants defined below.
michael@0 57 * @param aListener
michael@0 58 * the original listener which was to be notified about the host lookup
michael@0 59 * result - used to match request information to requestor.
michael@0 60 * @param aReason
michael@0 61 * nsresult reason for the cancellation
michael@0 62 *
michael@0 63 * @return An object that can be used to cancel the host lookup.
michael@0 64 */
michael@0 65 void cancelAsyncResolve(in AUTF8String aHostName,
michael@0 66 in unsigned long aFlags,
michael@0 67 in nsIDNSListener aListener,
michael@0 68 in nsresult aReason);
michael@0 69
michael@0 70 /**
michael@0 71 * called to synchronously resolve a hostname. warning this method may
michael@0 72 * block the calling thread for a long period of time. it is extremely
michael@0 73 * unwise to call this function on the UI thread of an application.
michael@0 74 *
michael@0 75 * @param aHostName
michael@0 76 * the hostname or IP-address-literal to resolve.
michael@0 77 * @param aFlags
michael@0 78 * a bitwise OR of the RESOLVE_ prefixed constants defined below.
michael@0 79 *
michael@0 80 * @return DNS record corresponding to the given hostname.
michael@0 81 * @throws NS_ERROR_UNKNOWN_HOST if host could not be resolved.
michael@0 82 */
michael@0 83 nsIDNSRecord resolve(in AUTF8String aHostName,
michael@0 84 in unsigned long aFlags);
michael@0 85
michael@0 86 /**
michael@0 87 * The method takes a pointer to an nsTArray
michael@0 88 * and fills it with cache entry data
michael@0 89 * Called by the networking dashboard
michael@0 90 */
michael@0 91 [noscript] void getDNSCacheEntries(in EntriesArray args);
michael@0 92
michael@0 93 /**
michael@0 94 * @return the hostname of the operating system.
michael@0 95 */
michael@0 96 readonly attribute AUTF8String myHostName;
michael@0 97
michael@0 98 /*************************************************************************
michael@0 99 * Listed below are the various flags that may be OR'd together to form
michael@0 100 * the aFlags parameter passed to asyncResolve() and resolve().
michael@0 101 */
michael@0 102
michael@0 103 /**
michael@0 104 * if set, this flag suppresses the internal DNS lookup cache.
michael@0 105 */
michael@0 106 const unsigned long RESOLVE_BYPASS_CACHE = (1 << 0);
michael@0 107
michael@0 108 /**
michael@0 109 * if set, the canonical name of the specified host will be queried.
michael@0 110 */
michael@0 111 const unsigned long RESOLVE_CANONICAL_NAME = (1 << 1);
michael@0 112
michael@0 113 /**
michael@0 114 * if set, the query is given lower priority. Medium takes precedence
michael@0 115 * if both are used.
michael@0 116 */
michael@0 117 const unsigned long RESOLVE_PRIORITY_MEDIUM = (1 << 2);
michael@0 118 const unsigned long RESOLVE_PRIORITY_LOW = (1 << 3);
michael@0 119
michael@0 120 /**
michael@0 121 * if set, indicates request is speculative. Speculative requests
michael@0 122 * return errors if prefetching is disabled by configuration.
michael@0 123 */
michael@0 124 const unsigned long RESOLVE_SPECULATE = (1 << 4);
michael@0 125
michael@0 126 /**
michael@0 127 * If set, only IPv4 addresses will be returned from resolve/asyncResolve.
michael@0 128 */
michael@0 129 const unsigned long RESOLVE_DISABLE_IPV6 = (1 << 5);
michael@0 130
michael@0 131 /**
michael@0 132 * If set, only literals and cached entries will be returned from resolve/
michael@0 133 * asyncResolve.
michael@0 134 */
michael@0 135 const unsigned long RESOLVE_OFFLINE = (1 << 6);
michael@0 136
michael@0 137 /**
michael@0 138 * If set, only IPv6 addresses will be returned from resolve/asyncResolve.
michael@0 139 */
michael@0 140 const unsigned long RESOLVE_DISABLE_IPV4 = (1 << 7);
michael@0 141 };

mercurial