netwerk/base/public/nsINetAddr.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/base/public/nsINetAddr.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,88 @@
     1.4 +/* vim: et ts=4 sw=4 tw=80 
     1.5 + */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "nsISupports.idl"
    1.11 +
    1.12 +%{ C++
    1.13 +namespace mozilla {
    1.14 +namespace net {
    1.15 +union NetAddr;
    1.16 +}
    1.17 +}
    1.18 +%}
    1.19 +native NetAddr(mozilla::net::NetAddr);
    1.20 +
    1.21 +/**
    1.22 + * nsINetAddr
    1.23 + *
    1.24 + * This interface represents a native NetAddr struct in a readonly
    1.25 + * interface.
    1.26 + */
    1.27 +[scriptable, uuid(652B9EC5-D159-45D7-9127-50BB559486CD)]
    1.28 +interface nsINetAddr : nsISupports
    1.29 +{
    1.30 +    /**
    1.31 +     * @return the address family of the network address, which corresponds to
    1.32 +     * one of the FAMILY_ constants.
    1.33 +     */
    1.34 +    readonly attribute unsigned short family;
    1.35 +
    1.36 +    /**
    1.37 +     * @return Either the IP address (FAMILY_INET, FAMILY_INET6) or the path
    1.38 +     * (FAMILY_LOCAL) in string form. IP addresses are in the format produced by
    1.39 +     * mozilla::net::NetAddrToString.
    1.40 +     *
    1.41 +     * Note: Paths for FAMILY_LOCAL may have length limitations which are
    1.42 +     * implementation dependent and not documented as part of this interface.
    1.43 +     */
    1.44 +    readonly attribute AUTF8String address;
    1.45 +
    1.46 +    /**
    1.47 +     * @return the port number for a FAMILY_INET or FAMILY_INET6 address.
    1.48 +     *
    1.49 +     * @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET or
    1.50 +     * FAMILY_INET6.
    1.51 +     */
    1.52 +    readonly attribute unsigned short port;
    1.53 +
    1.54 +    /**
    1.55 +     * @return the flow label for a FAMILY_INET6 address. 
    1.56 +     * 
    1.57 +     * @see http://www.ietf.org/rfc/rfc3697.txt
    1.58 +     *
    1.59 +     * @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET6
    1.60 +     */
    1.61 +    readonly attribute unsigned long flow;
    1.62 +
    1.63 +    /**
    1.64 +     * @return the address scope of a FAMILY_INET6 address.  
    1.65 +     *
    1.66 +     * @see http://tools.ietf.org/html/rfc4007
    1.67 +     *
    1.68 +     * @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET6
    1.69 +     */
    1.70 +    readonly attribute unsigned long scope;
    1.71 +
    1.72 +    /**
    1.73 +     * @return whether a FAMILY_INET6 address is mapped from FAMILY_INET.
    1.74 +     *
    1.75 +     * @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET6
    1.76 +     */
    1.77 +    readonly attribute boolean isV4Mapped;
    1.78 +
    1.79 +    /**
    1.80 +     * Network address families. These correspond to all the network address
    1.81 +     * families supported by the NetAddr struct.
    1.82 +     */
    1.83 +    const unsigned long FAMILY_INET = 1;
    1.84 +    const unsigned long FAMILY_INET6 = 2;
    1.85 +    const unsigned long FAMILY_LOCAL = 3;
    1.86 +
    1.87 +    /**
    1.88 +     * @return the underlying NetAddr struct.
    1.89 +     */
    1.90 +    [noscript] NetAddr getNetAddr();
    1.91 +};

mercurial