|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #include "nsISupports.idl" |
|
6 |
|
7 %{ C++ |
|
8 namespace mozilla { |
|
9 namespace net { |
|
10 union NetAddr; |
|
11 } |
|
12 } |
|
13 %} |
|
14 native NetAddr(mozilla::net::NetAddr); |
|
15 interface nsINetAddr; |
|
16 |
|
17 /** |
|
18 * nsIDNSRecord |
|
19 * |
|
20 * this interface represents the result of a DNS lookup. since a DNS |
|
21 * query may return more than one resolved IP address, the record acts |
|
22 * like an enumerator, allowing the caller to easily step through the |
|
23 * list of IP addresses. |
|
24 */ |
|
25 [scriptable, uuid(95ced6f3-44b4-4427-a149-c9a1e033d852)] |
|
26 interface nsIDNSRecord : nsISupports |
|
27 { |
|
28 /** |
|
29 * @return the canonical hostname for this record. this value is empty if |
|
30 * the record was not fetched with the RESOLVE_CANONICAL_NAME flag. |
|
31 * |
|
32 * e.g., www.mozilla.org --> rheet.mozilla.org |
|
33 */ |
|
34 readonly attribute ACString canonicalName; |
|
35 |
|
36 /** |
|
37 * this function copies the value of the next IP address into the |
|
38 * given NetAddr struct and increments the internal address iterator. |
|
39 * |
|
40 * @param aPort |
|
41 * A port number to initialize the NetAddr with. |
|
42 * |
|
43 * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in |
|
44 * the record. |
|
45 */ |
|
46 [noscript] NetAddr getNextAddr(in uint16_t aPort); |
|
47 |
|
48 /** |
|
49 * this function returns the value of the next IP address as a |
|
50 * scriptable address and increments the internal address iterator. |
|
51 * |
|
52 * @param aPort |
|
53 * A port number to initialize the nsINetAddr with. |
|
54 * |
|
55 * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in |
|
56 * the record. |
|
57 */ |
|
58 nsINetAddr getScriptableNextAddr(in uint16_t aPort); |
|
59 |
|
60 /** |
|
61 * this function returns the value of the next IP address as a |
|
62 * string and increments the internal address iterator. |
|
63 * |
|
64 * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in |
|
65 * the record. |
|
66 */ |
|
67 ACString getNextAddrAsString(); |
|
68 |
|
69 /** |
|
70 * this function returns true if there is another address in the record. |
|
71 */ |
|
72 boolean hasMore(); |
|
73 |
|
74 /** |
|
75 * this function resets the internal address iterator to the first |
|
76 * address in the record. |
|
77 */ |
|
78 void rewind(); |
|
79 |
|
80 /** |
|
81 * This function indicates that the last address obtained via getNextAddr*() |
|
82 * was not usuable and should be skipped in future uses of this |
|
83 * record if other addresses are available. |
|
84 * |
|
85 * @param aPort is the port number associated with the failure, if any. |
|
86 * It may be zero if not applicable. |
|
87 */ |
|
88 void reportUnusable(in uint16_t aPort); |
|
89 }; |