nsINetAddr.idl 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* vim: et ts=4 sw=4 tw=80
  2. */
  3. /* This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. #include "nsISupports.idl"
  7. %{ C++
  8. namespace mozilla {
  9. namespace net {
  10. union NetAddr;
  11. }
  12. }
  13. %}
  14. native NetAddr(mozilla::net::NetAddr);
  15. /**
  16. * nsINetAddr
  17. *
  18. * This interface represents a native NetAddr struct in a readonly
  19. * interface.
  20. */
  21. [scriptable, uuid(652B9EC5-D159-45D7-9127-50BB559486CD)]
  22. interface nsINetAddr : nsISupports
  23. {
  24. /**
  25. * @return the address family of the network address, which corresponds to
  26. * one of the FAMILY_ constants.
  27. */
  28. readonly attribute unsigned short family;
  29. /**
  30. * @return Either the IP address (FAMILY_INET, FAMILY_INET6) or the path
  31. * (FAMILY_LOCAL) in string form. IP addresses are in the format produced by
  32. * mozilla::net::NetAddrToString.
  33. *
  34. * Note: Paths for FAMILY_LOCAL may have length limitations which are
  35. * implementation dependent and not documented as part of this interface.
  36. */
  37. readonly attribute AUTF8String address;
  38. /**
  39. * @return the port number for a FAMILY_INET or FAMILY_INET6 address.
  40. *
  41. * @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET or
  42. * FAMILY_INET6.
  43. */
  44. readonly attribute unsigned short port;
  45. /**
  46. * @return the flow label for a FAMILY_INET6 address.
  47. *
  48. * @see http://www.ietf.org/rfc/rfc3697.txt
  49. *
  50. * @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET6
  51. */
  52. readonly attribute unsigned long flow;
  53. /**
  54. * @return the address scope of a FAMILY_INET6 address.
  55. *
  56. * @see http://tools.ietf.org/html/rfc4007
  57. *
  58. * @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET6
  59. */
  60. readonly attribute unsigned long scope;
  61. /**
  62. * @return whether a FAMILY_INET6 address is mapped from FAMILY_INET.
  63. *
  64. * @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET6
  65. */
  66. readonly attribute boolean isV4Mapped;
  67. /**
  68. * Network address families. These correspond to all the network address
  69. * families supported by the NetAddr struct.
  70. */
  71. const unsigned long FAMILY_INET = 1;
  72. const unsigned long FAMILY_INET6 = 2;
  73. const unsigned long FAMILY_LOCAL = 3;
  74. /**
  75. * @return the underlying NetAddr struct.
  76. */
  77. [noscript] NetAddr getNetAddr();
  78. };