1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/dns/nsIDNSRecord.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,89 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsISupports.idl" 1.9 + 1.10 +%{ C++ 1.11 +namespace mozilla { 1.12 +namespace net { 1.13 +union NetAddr; 1.14 +} 1.15 +} 1.16 +%} 1.17 +native NetAddr(mozilla::net::NetAddr); 1.18 +interface nsINetAddr; 1.19 + 1.20 +/** 1.21 + * nsIDNSRecord 1.22 + * 1.23 + * this interface represents the result of a DNS lookup. since a DNS 1.24 + * query may return more than one resolved IP address, the record acts 1.25 + * like an enumerator, allowing the caller to easily step through the 1.26 + * list of IP addresses. 1.27 + */ 1.28 +[scriptable, uuid(95ced6f3-44b4-4427-a149-c9a1e033d852)] 1.29 +interface nsIDNSRecord : nsISupports 1.30 +{ 1.31 + /** 1.32 + * @return the canonical hostname for this record. this value is empty if 1.33 + * the record was not fetched with the RESOLVE_CANONICAL_NAME flag. 1.34 + * 1.35 + * e.g., www.mozilla.org --> rheet.mozilla.org 1.36 + */ 1.37 + readonly attribute ACString canonicalName; 1.38 + 1.39 + /** 1.40 + * this function copies the value of the next IP address into the 1.41 + * given NetAddr struct and increments the internal address iterator. 1.42 + * 1.43 + * @param aPort 1.44 + * A port number to initialize the NetAddr with. 1.45 + * 1.46 + * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in 1.47 + * the record. 1.48 + */ 1.49 + [noscript] NetAddr getNextAddr(in uint16_t aPort); 1.50 + 1.51 + /** 1.52 + * this function returns the value of the next IP address as a 1.53 + * scriptable address and increments the internal address iterator. 1.54 + * 1.55 + * @param aPort 1.56 + * A port number to initialize the nsINetAddr with. 1.57 + * 1.58 + * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in 1.59 + * the record. 1.60 + */ 1.61 + nsINetAddr getScriptableNextAddr(in uint16_t aPort); 1.62 + 1.63 + /** 1.64 + * this function returns the value of the next IP address as a 1.65 + * string and increments the internal address iterator. 1.66 + * 1.67 + * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in 1.68 + * the record. 1.69 + */ 1.70 + ACString getNextAddrAsString(); 1.71 + 1.72 + /** 1.73 + * this function returns true if there is another address in the record. 1.74 + */ 1.75 + boolean hasMore(); 1.76 + 1.77 + /** 1.78 + * this function resets the internal address iterator to the first 1.79 + * address in the record. 1.80 + */ 1.81 + void rewind(); 1.82 + 1.83 + /** 1.84 + * This function indicates that the last address obtained via getNextAddr*() 1.85 + * was not usuable and should be skipped in future uses of this 1.86 + * record if other addresses are available. 1.87 + * 1.88 + * @param aPort is the port number associated with the failure, if any. 1.89 + * It may be zero if not applicable. 1.90 + */ 1.91 + void reportUnusable(in uint16_t aPort); 1.92 +};