netwerk/dns/nsIEffectiveTLDService.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/dns/nsIEffectiveTLDService.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,125 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +interface nsIURI;
    1.12 +
    1.13 +[scriptable, uuid(68067eb5-ad8d-43cb-a043-1cc85ebe06e7)]
    1.14 +interface nsIEffectiveTLDService : nsISupports
    1.15 +{
    1.16 +    /**
    1.17 +     * Returns the public suffix of a URI. A public suffix is the highest-level domain
    1.18 +     * under which individual domains may be registered; it may therefore contain one
    1.19 +     * or more dots. For example, the public suffix for "www.bbc.co.uk" is "co.uk",
    1.20 +     * because the .uk TLD does not allow the registration of domains at the
    1.21 +     * second level ("bbc.uk" is forbidden).
    1.22 +     *
    1.23 +     * The public suffix will be returned encoded in ASCII/ACE and will be normalized
    1.24 +     * according to RFC 3454, i.e. the same encoding returned by nsIURI::GetAsciiHost().
    1.25 +     * If consumers wish to compare the result of this method against the host from
    1.26 +     * another nsIURI, the host should be obtained using nsIURI::GetAsciiHost().
    1.27 +     * In the case of nested URIs, the innermost URI will be used.
    1.28 +     *
    1.29 +     * @param   aURI   The URI to be analyzed
    1.30 +     *
    1.31 +     * @returns the public suffix
    1.32 +     *
    1.33 +     * @throws NS_ERROR_UNEXPECTED 
    1.34 +     *         or other error returned by nsIIDNService::normalize when 
    1.35 +     *         the hostname contains characters disallowed in URIs
    1.36 +     * @throws NS_ERROR_HOST_IS_IP_ADDRESS
    1.37 +     *         if the host is a numeric IPv4 or IPv6 address (as determined by
    1.38 +     *         the success of a call to PR_StringToNetAddr()).
    1.39 +     */
    1.40 +    ACString getPublicSuffix(in nsIURI aURI);
    1.41 +
    1.42 +    /**
    1.43 +     * Returns the base domain of a URI; that is, the public suffix with a given
    1.44 +     * number of additional domain name parts. For example, the result of this method
    1.45 +     * for "www.bbc.co.uk", depending on the value of aAdditionalParts parameter, will
    1.46 +     * be:
    1.47 +     *
    1.48 +     *    0 (default) -> bbc.co.uk
    1.49 +     *    1           -> www.bbc.co.uk
    1.50 +     *
    1.51 +     * Similarly, the public suffix for "www.developer.mozilla.org" is "org", and the base
    1.52 +     * domain will be:
    1.53 +     *
    1.54 +     *    0 (default) -> mozilla.org
    1.55 +     *    1           -> developer.mozilla.org
    1.56 +     *    2           -> www.developer.mozilla.org
    1.57 +     *
    1.58 +     * The base domain will be returned encoded in ASCII/ACE and will be normalized
    1.59 +     * according to RFC 3454, i.e. the same encoding returned by nsIURI::GetAsciiHost().
    1.60 +     * If consumers wish to compare the result of this method against the host from
    1.61 +     * another nsIURI, the host should be obtained using nsIURI::GetAsciiHost().
    1.62 +     * In the case of nested URIs, the innermost URI will be used.
    1.63 +     *
    1.64 +     * @param   aURI               The URI to be analyzed
    1.65 +     * @param   aAdditionalParts   Number of domain name parts to be
    1.66 +     *                             returned in addition to the public suffix
    1.67 +     *
    1.68 +     * @returns the base domain (public suffix plus the requested number of additional parts)
    1.69 +     *
    1.70 +     * @throws NS_ERROR_UNEXPECTED 
    1.71 +     *         or other error returned by nsIIDNService::normalize when 
    1.72 +     *         the hostname contains characters disallowed in URIs
    1.73 +     * @throws NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS
    1.74 +     *         when there are insufficient subdomain levels in the hostname to satisfy the
    1.75 +     *         requested aAdditionalParts value.
    1.76 +     * @throws NS_ERROR_HOST_IS_IP_ADDRESS
    1.77 +     *         if aHost is a numeric IPv4 or IPv6 address (as determined by
    1.78 +     *         the success of a call to PR_StringToNetAddr()).
    1.79 +     *
    1.80 +     * @see    getPublicSuffix()
    1.81 +     */
    1.82 +    ACString getBaseDomain(in nsIURI aURI, [optional] in uint32_t aAdditionalParts);
    1.83 +
    1.84 +    /**
    1.85 +     * NOTE: It is strongly recommended to use getPublicSuffix() above if a suitable
    1.86 +     * nsIURI is available. Only use this method if this is not the case.
    1.87 +     *
    1.88 +     * Returns the public suffix of a host string. Otherwise identical to getPublicSuffix().
    1.89 +     *
    1.90 +     * @param   aHost   The host to be analyzed. Any additional parts (e.g. scheme,
    1.91 +     *                  port, or path) will cause this method to throw. ASCII/ACE and
    1.92 +     *                  UTF8 encodings are acceptable as input; normalization will
    1.93 +     *                  be performed as specified in getBaseDomain().
    1.94 +     *
    1.95 +     * @see     getPublicSuffix()
    1.96 +     */
    1.97 +    ACString getPublicSuffixFromHost(in AUTF8String aHost);
    1.98 +
    1.99 +    /**
   1.100 +     * NOTE: It is strongly recommended to use getBaseDomain() above if a suitable
   1.101 +     * nsIURI is available. Only use this method if this is not the case.
   1.102 +     *
   1.103 +     * Returns the base domain of a host string. Otherwise identical to getBaseDomain().
   1.104 +     *
   1.105 +     * @param   aHost   The host to be analyzed. Any additional parts (e.g. scheme,
   1.106 +     *                  port, or path) will cause this method to throw. ASCII/ACE and
   1.107 +     *                  UTF8 encodings are acceptable as input; normalization will
   1.108 +     *                  be performed as specified in getBaseDomain().
   1.109 +     *
   1.110 +     * @see     getBaseDomain()
   1.111 +     */
   1.112 +    ACString getBaseDomainFromHost(in AUTF8String aHost, [optional] in uint32_t aAdditionalParts);
   1.113 +
   1.114 +    /**
   1.115 +     * Returns the parent sub-domain of a host string. If the host is a base
   1.116 +     * domain, it will throw NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS.
   1.117 +     *
   1.118 +     * For example: "player.bbc.co.uk" would return "bbc.co.uk" and
   1.119 +     *              "bbc.co.uk" would throw NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS.
   1.120 +     *
   1.121 +     * @param   aHost   The host to be analyzed. Any additional parts (e.g. scheme,
   1.122 +     *                  port, or path) will cause this method to throw. ASCII/ACE and
   1.123 +     *                  UTF8 encodings are acceptable as input; normalization will
   1.124 +     *                  be performed as specified in getBaseDomain().
   1.125 +     */
   1.126 +    ACString getNextSubDomain(in AUTF8String aHost);
   1.127 +};
   1.128 +

mercurial