michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: %{ C++ michael@0: namespace mozilla { michael@0: namespace net { michael@0: union NetAddr; michael@0: } michael@0: } michael@0: %} michael@0: native NetAddr(mozilla::net::NetAddr); michael@0: interface nsINetAddr; michael@0: michael@0: /** michael@0: * nsIDNSRecord michael@0: * michael@0: * this interface represents the result of a DNS lookup. since a DNS michael@0: * query may return more than one resolved IP address, the record acts michael@0: * like an enumerator, allowing the caller to easily step through the michael@0: * list of IP addresses. michael@0: */ michael@0: [scriptable, uuid(95ced6f3-44b4-4427-a149-c9a1e033d852)] michael@0: interface nsIDNSRecord : nsISupports michael@0: { michael@0: /** michael@0: * @return the canonical hostname for this record. this value is empty if michael@0: * the record was not fetched with the RESOLVE_CANONICAL_NAME flag. michael@0: * michael@0: * e.g., www.mozilla.org --> rheet.mozilla.org michael@0: */ michael@0: readonly attribute ACString canonicalName; michael@0: michael@0: /** michael@0: * this function copies the value of the next IP address into the michael@0: * given NetAddr struct and increments the internal address iterator. michael@0: * michael@0: * @param aPort michael@0: * A port number to initialize the NetAddr with. michael@0: * michael@0: * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in michael@0: * the record. michael@0: */ michael@0: [noscript] NetAddr getNextAddr(in uint16_t aPort); michael@0: michael@0: /** michael@0: * this function returns the value of the next IP address as a michael@0: * scriptable address and increments the internal address iterator. michael@0: * michael@0: * @param aPort michael@0: * A port number to initialize the nsINetAddr with. michael@0: * michael@0: * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in michael@0: * the record. michael@0: */ michael@0: nsINetAddr getScriptableNextAddr(in uint16_t aPort); michael@0: michael@0: /** michael@0: * this function returns the value of the next IP address as a michael@0: * string and increments the internal address iterator. michael@0: * michael@0: * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in michael@0: * the record. michael@0: */ michael@0: ACString getNextAddrAsString(); michael@0: michael@0: /** michael@0: * this function returns true if there is another address in the record. michael@0: */ michael@0: boolean hasMore(); michael@0: michael@0: /** michael@0: * this function resets the internal address iterator to the first michael@0: * address in the record. michael@0: */ michael@0: void rewind(); michael@0: michael@0: /** michael@0: * This function indicates that the last address obtained via getNextAddr*() michael@0: * was not usuable and should be skipped in future uses of this michael@0: * record if other addresses are available. michael@0: * michael@0: * @param aPort is the port number associated with the failure, if any. michael@0: * It may be zero if not applicable. michael@0: */ michael@0: void reportUnusable(in uint16_t aPort); michael@0: };