tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsIDNSRecord.idl (4956B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 #include "nsISupports.idl"
      6 #include "nsIRequest.idl"
      7 #include "nsITRRSkipReason.idl"
      8 
      9 %{ C++
     10 namespace mozilla {
     11 class TimeStamp;
     12 namespace net {
     13 union NetAddr;
     14 }
     15 }
     16 #include "nsTArrayForwardDeclare.h"
     17 %}
     18 native NetAddr(mozilla::net::NetAddr);
     19 [ref] native nsNetAddrTArrayRef(nsTArray<mozilla::net::NetAddr>);
     20 native TimeStamp(mozilla::TimeStamp);
     21 interface nsINetAddr;
     22 
     23 /**
     24 * nsIDNSRecord
     25 *
     26 * this interface represents the result of a DNS lookup.  since a DNS
     27 * query may return more than one resolved IP address, the record acts
     28 * like an enumerator, allowing the caller to easily step through the
     29 * list of IP addresses.
     30 */
     31 [scriptable, builtinclass, uuid(f92228ae-c417-4188-a604-0830a95e7eb9)]
     32 interface nsIDNSRecord : nsISupports
     33 {
     34 };
     35 
     36 [scriptable, builtinclass, uuid(cb260e20-943f-4309-953b-78c90d3a7638)]
     37 interface nsIDNSAddrRecord : nsIDNSRecord
     38 {
     39    /**
     40     * @return the canonical hostname for this record.  this value is empty if
     41     * the record was not fetched with the RESOLVE_CANONICAL_NAME flag.
     42     *
     43     * e.g., www.mozilla.org --> rheet.mozilla.org
     44     *
     45     * That the result, if IDN will be returned as punycode.
     46     * e.g., élève.w3c-test.org --> xn--lve-6lad.w3c-test.org
     47     */
     48    readonly attribute ACString canonicalName;
     49 
     50    /**
     51     * this function copies the value of the next IP address into the
     52     * given NetAddr struct and increments the internal address iterator.
     53     *
     54     * @param aPort
     55     *        A port number to initialize the NetAddr with.
     56     *
     57     * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in
     58     * the record.
     59     */
     60    [noscript] NetAddr getNextAddr(in uint16_t aPort);
     61 
     62    /**
     63     * this function copies the value of all working members of the RR
     64     * set into the output array.
     65     *
     66     * @param aAddressArray
     67     *        The result set
     68     */
     69    [noscript] void getAddresses(out nsNetAddrTArrayRef aAddressArray);
     70 
     71    /**
     72     * this function returns the value of the next IP address as a
     73     * scriptable address and increments the internal address iterator.
     74     *
     75     * @param aPort
     76     *        A port number to initialize the nsINetAddr with.
     77     *
     78     * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in
     79     * the record.
     80     */
     81    nsINetAddr getScriptableNextAddr(in uint16_t aPort);
     82 
     83    /**
     84     * this function returns the value of the next IP address as a
     85     * string and increments the internal address iterator.
     86     *
     87     * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in
     88     * the record.
     89     */
     90    ACString getNextAddrAsString();
     91 
     92    /**
     93     * this function returns true if there is another address in the record.
     94     */
     95    boolean hasMore();
     96 
     97    /**
     98     * this function resets the internal address iterator to the first
     99     * address in the record.
    100     */
    101    void rewind();
    102 
    103    /**
    104     * This function indicates that the last address obtained via getNextAddr*()
    105     * was not usuable and should be skipped in future uses of this
    106     * record if other addresses are available.
    107     *
    108     * @param aPort is the port number associated with the failure, if any.
    109     *        It may be zero if not applicable.
    110     */
    111    void reportUnusable(in uint16_t aPort);
    112 
    113    /**
    114     * Record retreived with TRR.
    115     */
    116    boolean IsTRR();
    117 
    118    /**
    119     * Record is resolved in socket process.
    120     */
    121    boolean resolvedInSocketProcess();
    122 
    123    /**
    124     * This attribute is only set if TRR is used and it measures time between
    125     * asyncOpen on a channel and the time parsing of response if done.
    126     * Thee time is measured in milliseconds.
    127     */
    128    readonly attribute double trrFetchDuration;
    129 
    130    /**
    131     * This attribute is only set if TRR is used and it measures time between
    132     * sending a request and the time response is received from the network.
    133     * This time is similat to the time above, but exludes a time needed to
    134     * make a connection and a time neededto parse results (this also does not
    135     * include delays that may be introduce because parsing is perform on the main
    136     * thread).
    137     * Thee time is measured in milliseconds.
    138     */
    139    readonly attribute double trrFetchDurationNetworkOnly;
    140 
    141    /**
    142     * The TRR mode this record is used.
    143     */
    144    readonly attribute nsIRequest_TRRMode effectiveTRRMode;
    145 
    146    /**
    147     * If the DNS request didn't use TRR, this value
    148     * contains the reason why that was skipped.
    149     */
    150    readonly attribute nsITRRSkipReason_value trrSkipReason;
    151 
    152    /**
    153     * Returns the ttl of this record.
    154     */
    155    readonly attribute uint32_t ttl;
    156 
    157     /**
    158     * Returns the timestamp when this record is updated.
    159     */
    160    [noscript] readonly attribute TimeStamp lastUpdate;
    161 };