netwerk/dns/nsIEffectiveTLDService.idl

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

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

mercurial