netwerk/dns/nsIEffectiveTLDService.idl

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "nsISupports.idl"
     8 interface nsIURI;
    10 [scriptable, uuid(68067eb5-ad8d-43cb-a043-1cc85ebe06e7)]
    11 interface nsIEffectiveTLDService : nsISupports
    12 {
    13     /**
    14      * Returns the public suffix of a URI. A public suffix is the highest-level domain
    15      * under which individual domains may be registered; it may therefore contain one
    16      * or more dots. For example, the public suffix for "www.bbc.co.uk" is "co.uk",
    17      * because the .uk TLD does not allow the registration of domains at the
    18      * second level ("bbc.uk" is forbidden).
    19      *
    20      * The public suffix will be returned encoded in ASCII/ACE and will be normalized
    21      * according to RFC 3454, i.e. the same encoding returned by nsIURI::GetAsciiHost().
    22      * If consumers wish to compare the result of this method against the host from
    23      * another nsIURI, the host should be obtained using nsIURI::GetAsciiHost().
    24      * In the case of nested URIs, the innermost URI will be used.
    25      *
    26      * @param   aURI   The URI to be analyzed
    27      *
    28      * @returns the public suffix
    29      *
    30      * @throws NS_ERROR_UNEXPECTED 
    31      *         or other error returned by nsIIDNService::normalize when 
    32      *         the hostname contains characters disallowed in URIs
    33      * @throws NS_ERROR_HOST_IS_IP_ADDRESS
    34      *         if the host is a numeric IPv4 or IPv6 address (as determined by
    35      *         the success of a call to PR_StringToNetAddr()).
    36      */
    37     ACString getPublicSuffix(in nsIURI aURI);
    39     /**
    40      * Returns the base domain of a URI; that is, the public suffix with a given
    41      * number of additional domain name parts. For example, the result of this method
    42      * for "www.bbc.co.uk", depending on the value of aAdditionalParts parameter, will
    43      * be:
    44      *
    45      *    0 (default) -> bbc.co.uk
    46      *    1           -> www.bbc.co.uk
    47      *
    48      * Similarly, the public suffix for "www.developer.mozilla.org" is "org", and the base
    49      * domain will be:
    50      *
    51      *    0 (default) -> mozilla.org
    52      *    1           -> developer.mozilla.org
    53      *    2           -> www.developer.mozilla.org
    54      *
    55      * The base domain will be returned encoded in ASCII/ACE and will be normalized
    56      * according to RFC 3454, i.e. the same encoding returned by nsIURI::GetAsciiHost().
    57      * If consumers wish to compare the result of this method against the host from
    58      * another nsIURI, the host should be obtained using nsIURI::GetAsciiHost().
    59      * In the case of nested URIs, the innermost URI will be used.
    60      *
    61      * @param   aURI               The URI to be analyzed
    62      * @param   aAdditionalParts   Number of domain name parts to be
    63      *                             returned in addition to the public suffix
    64      *
    65      * @returns the base domain (public suffix plus the requested number of additional parts)
    66      *
    67      * @throws NS_ERROR_UNEXPECTED 
    68      *         or other error returned by nsIIDNService::normalize when 
    69      *         the hostname contains characters disallowed in URIs
    70      * @throws NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS
    71      *         when there are insufficient subdomain levels in the hostname to satisfy the
    72      *         requested aAdditionalParts value.
    73      * @throws NS_ERROR_HOST_IS_IP_ADDRESS
    74      *         if aHost is a numeric IPv4 or IPv6 address (as determined by
    75      *         the success of a call to PR_StringToNetAddr()).
    76      *
    77      * @see    getPublicSuffix()
    78      */
    79     ACString getBaseDomain(in nsIURI aURI, [optional] in uint32_t aAdditionalParts);
    81     /**
    82      * NOTE: It is strongly recommended to use getPublicSuffix() above if a suitable
    83      * nsIURI is available. Only use this method if this is not the case.
    84      *
    85      * Returns the public suffix of a host string. Otherwise identical to getPublicSuffix().
    86      *
    87      * @param   aHost   The host to be analyzed. Any additional parts (e.g. scheme,
    88      *                  port, or path) will cause this method to throw. ASCII/ACE and
    89      *                  UTF8 encodings are acceptable as input; normalization will
    90      *                  be performed as specified in getBaseDomain().
    91      *
    92      * @see     getPublicSuffix()
    93      */
    94     ACString getPublicSuffixFromHost(in AUTF8String aHost);
    96     /**
    97      * NOTE: It is strongly recommended to use getBaseDomain() above if a suitable
    98      * nsIURI is available. Only use this method if this is not the case.
    99      *
   100      * Returns the base domain of a host string. Otherwise identical to getBaseDomain().
   101      *
   102      * @param   aHost   The host to be analyzed. Any additional parts (e.g. scheme,
   103      *                  port, or path) will cause this method to throw. ASCII/ACE and
   104      *                  UTF8 encodings are acceptable as input; normalization will
   105      *                  be performed as specified in getBaseDomain().
   106      *
   107      * @see     getBaseDomain()
   108      */
   109     ACString getBaseDomainFromHost(in AUTF8String aHost, [optional] in uint32_t aAdditionalParts);
   111     /**
   112      * Returns the parent sub-domain of a host string. If the host is a base
   113      * domain, it will throw NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS.
   114      *
   115      * For example: "player.bbc.co.uk" would return "bbc.co.uk" and
   116      *              "bbc.co.uk" would throw NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS.
   117      *
   118      * @param   aHost   The host to be analyzed. Any additional parts (e.g. scheme,
   119      *                  port, or path) will cause this method to throw. ASCII/ACE and
   120      *                  UTF8 encodings are acceptable as input; normalization will
   121      *                  be performed as specified in getBaseDomain().
   122      */
   123     ACString getNextSubDomain(in AUTF8String aHost);
   124 };

mercurial