michael@0: /* vim: et ts=4 sw=4 tw=80 michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: %{ C++ michael@0: namespace mozilla { michael@0: namespace net { michael@0: union NetAddr; michael@0: } michael@0: } michael@0: %} michael@0: native NetAddr(mozilla::net::NetAddr); michael@0: michael@0: /** michael@0: * nsINetAddr michael@0: * michael@0: * This interface represents a native NetAddr struct in a readonly michael@0: * interface. michael@0: */ michael@0: [scriptable, uuid(652B9EC5-D159-45D7-9127-50BB559486CD)] michael@0: interface nsINetAddr : nsISupports michael@0: { michael@0: /** michael@0: * @return the address family of the network address, which corresponds to michael@0: * one of the FAMILY_ constants. michael@0: */ michael@0: readonly attribute unsigned short family; michael@0: michael@0: /** michael@0: * @return Either the IP address (FAMILY_INET, FAMILY_INET6) or the path michael@0: * (FAMILY_LOCAL) in string form. IP addresses are in the format produced by michael@0: * mozilla::net::NetAddrToString. michael@0: * michael@0: * Note: Paths for FAMILY_LOCAL may have length limitations which are michael@0: * implementation dependent and not documented as part of this interface. michael@0: */ michael@0: readonly attribute AUTF8String address; michael@0: michael@0: /** michael@0: * @return the port number for a FAMILY_INET or FAMILY_INET6 address. michael@0: * michael@0: * @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET or michael@0: * FAMILY_INET6. michael@0: */ michael@0: readonly attribute unsigned short port; michael@0: michael@0: /** michael@0: * @return the flow label for a FAMILY_INET6 address. michael@0: * michael@0: * @see http://www.ietf.org/rfc/rfc3697.txt michael@0: * michael@0: * @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET6 michael@0: */ michael@0: readonly attribute unsigned long flow; michael@0: michael@0: /** michael@0: * @return the address scope of a FAMILY_INET6 address. michael@0: * michael@0: * @see http://tools.ietf.org/html/rfc4007 michael@0: * michael@0: * @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET6 michael@0: */ michael@0: readonly attribute unsigned long scope; michael@0: michael@0: /** michael@0: * @return whether a FAMILY_INET6 address is mapped from FAMILY_INET. michael@0: * michael@0: * @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET6 michael@0: */ michael@0: readonly attribute boolean isV4Mapped; michael@0: michael@0: /** michael@0: * Network address families. These correspond to all the network address michael@0: * families supported by the NetAddr struct. michael@0: */ michael@0: const unsigned long FAMILY_INET = 1; michael@0: const unsigned long FAMILY_INET6 = 2; michael@0: const unsigned long FAMILY_LOCAL = 3; michael@0: michael@0: /** michael@0: * @return the underlying NetAddr struct. michael@0: */ michael@0: [noscript] NetAddr getNetAddr(); michael@0: };