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