netwerk/dns/nsIDNSService.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/dns/nsIDNSService.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,141 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsISupports.idl"
     1.9 +
    1.10 +interface nsICancelable;
    1.11 +interface nsIEventTarget;
    1.12 +interface nsIDNSRecord;
    1.13 +interface nsIDNSListener;
    1.14 +
    1.15 +%{C++
    1.16 +template<class T> class nsTArray;
    1.17 +namespace mozilla { namespace net {
    1.18 +    struct DNSCacheEntries;
    1.19 +} }
    1.20 +%}
    1.21 +
    1.22 +[ptr] native EntriesArray(nsTArray<mozilla::net::DNSCacheEntries>);
    1.23 +
    1.24 +/**
    1.25 + * nsIDNSService
    1.26 + */
    1.27 +[scriptable, uuid(f1971942-19db-44bf-81e8-d15df220a39f)]
    1.28 +interface nsIDNSService : nsISupports
    1.29 +{
    1.30 +    /**
    1.31 +     * kicks off an asynchronous host lookup.
    1.32 +     *
    1.33 +     * @param aHostName
    1.34 +     *        the hostname or IP-address-literal to resolve.
    1.35 +     * @param aFlags
    1.36 +     *        a bitwise OR of the RESOLVE_ prefixed constants defined below.
    1.37 +     * @param aListener
    1.38 +     *        the listener to be notified when the result is available.
    1.39 +     * @param aListenerTarget
    1.40 +     *        optional parameter (may be null).  if non-null, this parameter
    1.41 +     *        specifies the nsIEventTarget of the thread on which the
    1.42 +     *        listener's onLookupComplete should be called.  however, if this
    1.43 +     *        parameter is null, then onLookupComplete will be called on an
    1.44 +     *        unspecified thread (possibly recursively).
    1.45 +     *
    1.46 +     * @return An object that can be used to cancel the host lookup.
    1.47 +     */
    1.48 +    nsICancelable asyncResolve(in AUTF8String       aHostName,
    1.49 +                               in unsigned long     aFlags,
    1.50 +                               in nsIDNSListener    aListener,
    1.51 +                               in nsIEventTarget    aListenerTarget);
    1.52 +
    1.53 +    /**
    1.54 +     * Attempts to cancel a previously requested async DNS lookup
    1.55 +     *
    1.56 +     * @param aHostName
    1.57 +     *        the hostname or IP-address-literal to resolve.
    1.58 +     * @param aFlags
    1.59 +     *        a bitwise OR of the RESOLVE_ prefixed constants defined below.
    1.60 +     * @param aListener
    1.61 +     *        the original listener which was to be notified about the host lookup
    1.62 +     *        result - used to match request information to requestor.
    1.63 +     * @param aReason
    1.64 +     *        nsresult reason for the cancellation
    1.65 +     *
    1.66 +     * @return An object that can be used to cancel the host lookup.
    1.67 +     */
    1.68 +    void cancelAsyncResolve(in AUTF8String       aHostName,
    1.69 +                            in unsigned long     aFlags,
    1.70 +                            in nsIDNSListener    aListener,
    1.71 +                            in nsresult          aReason);
    1.72 +    
    1.73 +    /**
    1.74 +     * called to synchronously resolve a hostname.  warning this method may
    1.75 +     * block the calling thread for a long period of time.  it is extremely
    1.76 +     * unwise to call this function on the UI thread of an application.
    1.77 +     *
    1.78 +     * @param aHostName
    1.79 +     *        the hostname or IP-address-literal to resolve.
    1.80 +     * @param aFlags
    1.81 +     *        a bitwise OR of the RESOLVE_ prefixed constants defined below.
    1.82 +     *
    1.83 +     * @return DNS record corresponding to the given hostname.
    1.84 +     * @throws NS_ERROR_UNKNOWN_HOST if host could not be resolved.
    1.85 +     */
    1.86 +    nsIDNSRecord resolve(in AUTF8String   aHostName,
    1.87 +                         in unsigned long aFlags);
    1.88 +
    1.89 +    /**
    1.90 +     * The method takes a pointer to an nsTArray
    1.91 +     * and fills it with cache entry data
    1.92 +     * Called by the networking dashboard
    1.93 +     */
    1.94 +    [noscript] void getDNSCacheEntries(in EntriesArray args);
    1.95 +
    1.96 +    /**
    1.97 +     * @return the hostname of the operating system.
    1.98 +     */
    1.99 +    readonly attribute AUTF8String myHostName;
   1.100 +
   1.101 +    /*************************************************************************
   1.102 +     * Listed below are the various flags that may be OR'd together to form
   1.103 +     * the aFlags parameter passed to asyncResolve() and resolve().
   1.104 +     */
   1.105 +
   1.106 +    /**
   1.107 +     * if set, this flag suppresses the internal DNS lookup cache.
   1.108 +     */
   1.109 +    const unsigned long RESOLVE_BYPASS_CACHE = (1 << 0);
   1.110 +
   1.111 +    /**
   1.112 +     * if set, the canonical name of the specified host will be queried.
   1.113 +     */
   1.114 +    const unsigned long RESOLVE_CANONICAL_NAME = (1 << 1);
   1.115 +
   1.116 +    /**
   1.117 +     * if set, the query is given lower priority. Medium takes precedence
   1.118 +     * if both are used.
   1.119 +     */
   1.120 +    const unsigned long RESOLVE_PRIORITY_MEDIUM = (1 << 2);
   1.121 +    const unsigned long RESOLVE_PRIORITY_LOW    = (1 << 3);
   1.122 +
   1.123 +    /**
   1.124 +     * if set, indicates request is speculative. Speculative requests 
   1.125 +     * return errors if prefetching is disabled by configuration.
   1.126 +     */
   1.127 +    const unsigned long RESOLVE_SPECULATE = (1 << 4);
   1.128 +
   1.129 +    /**
   1.130 +     * If set, only IPv4 addresses will be returned from resolve/asyncResolve.
   1.131 +     */
   1.132 +    const unsigned long RESOLVE_DISABLE_IPV6 = (1 << 5);
   1.133 +
   1.134 +    /**
   1.135 +     * If set, only literals and cached entries will be returned from resolve/
   1.136 +     * asyncResolve.
   1.137 +     */
   1.138 +    const unsigned long RESOLVE_OFFLINE = (1 << 6);
   1.139 +
   1.140 +    /**
   1.141 +     * If set, only IPv6 addresses will be returned from resolve/asyncResolve.
   1.142 +     */
   1.143 +    const unsigned long RESOLVE_DISABLE_IPV4 = (1 << 7);
   1.144 +};

mercurial