nsIDNSRecord.idl 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. #include "nsISupports.idl"
  5. %{ C++
  6. namespace mozilla {
  7. namespace net {
  8. union NetAddr;
  9. }
  10. }
  11. #include "nsTArrayForwardDeclare.h"
  12. %}
  13. native NetAddr(mozilla::net::NetAddr);
  14. [ref] native nsNetAddrTArrayRef(nsTArray<mozilla::net::NetAddr>);
  15. interface nsINetAddr;
  16. /**
  17. * nsIDNSRecord
  18. *
  19. * this interface represents the result of a DNS lookup. since a DNS
  20. * query may return more than one resolved IP address, the record acts
  21. * like an enumerator, allowing the caller to easily step through the
  22. * list of IP addresses.
  23. */
  24. [scriptable, uuid(f92228ae-c417-4188-a604-0830a95e7eb9)]
  25. interface nsIDNSRecord : nsISupports
  26. {
  27. /**
  28. * @return the canonical hostname for this record. this value is empty if
  29. * the record was not fetched with the RESOLVE_CANONICAL_NAME flag.
  30. *
  31. * e.g., www.mozilla.org --> rheet.mozilla.org
  32. */
  33. readonly attribute ACString canonicalName;
  34. /**
  35. * this function copies the value of the next IP address into the
  36. * given NetAddr struct and increments the internal address iterator.
  37. *
  38. * @param aPort
  39. * A port number to initialize the NetAddr with.
  40. *
  41. * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in
  42. * the record.
  43. */
  44. [noscript] NetAddr getNextAddr(in uint16_t aPort);
  45. /**
  46. * this function copies the value of all working members of the RR
  47. * set into the output array.
  48. *
  49. * @param aAddressArray
  50. * The result set
  51. */
  52. [noscript] void getAddresses(out nsNetAddrTArrayRef aAddressArray);
  53. /**
  54. * this function returns the value of the next IP address as a
  55. * scriptable address and increments the internal address iterator.
  56. *
  57. * @param aPort
  58. * A port number to initialize the nsINetAddr with.
  59. *
  60. * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in
  61. * the record.
  62. */
  63. nsINetAddr getScriptableNextAddr(in uint16_t aPort);
  64. /**
  65. * this function returns the value of the next IP address as a
  66. * string and increments the internal address iterator.
  67. *
  68. * @throws NS_ERROR_NOT_AVAILABLE if there is not another IP address in
  69. * the record.
  70. */
  71. ACString getNextAddrAsString();
  72. /**
  73. * this function returns true if there is another address in the record.
  74. */
  75. boolean hasMore();
  76. /**
  77. * this function resets the internal address iterator to the first
  78. * address in the record.
  79. */
  80. void rewind();
  81. /**
  82. * This function indicates that the last address obtained via getNextAddr*()
  83. * was not usuable and should be skipped in future uses of this
  84. * record if other addresses are available.
  85. *
  86. * @param aPort is the port number associated with the failure, if any.
  87. * It may be zero if not applicable.
  88. */
  89. void reportUnusable(in uint16_t aPort);
  90. };