Source code

Revision control

Other Tools

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
7
#include "nsISupports.idl"
8
9
%{ C++
10
namespace mozilla {
11
namespace net {
12
union NetAddr;
13
}
14
}
15
%}
16
native NetAddr(mozilla::net::NetAddr);
17
18
/**
19
* nsINetAddr
20
*
21
* This interface represents a native NetAddr struct in a readonly
22
* interface.
23
*/
24
[scriptable, uuid(652B9EC5-D159-45D7-9127-50BB559486CD)]
25
interface nsINetAddr : nsISupports
26
{
27
/**
28
* @return the address family of the network address, which corresponds to
29
* one of the FAMILY_ constants.
30
*/
31
readonly attribute unsigned short family;
32
33
/**
34
* @return Either the IP address (FAMILY_INET, FAMILY_INET6) or the path
35
* (FAMILY_LOCAL) in string form. IP addresses are in the format produced by
36
* mozilla::net::NetAddrToString.
37
*
38
* Note: Paths for FAMILY_LOCAL may have length limitations which are
39
* implementation dependent and not documented as part of this interface.
40
*/
41
readonly attribute AUTF8String address;
42
43
/**
44
* @return the port number for a FAMILY_INET or FAMILY_INET6 address.
45
*
46
* @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET or
47
* FAMILY_INET6.
48
*/
49
readonly attribute unsigned short port;
50
51
/**
52
* @return the flow label for a FAMILY_INET6 address.
53
*
55
*
56
* @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET6
57
*/
58
readonly attribute unsigned long flow;
59
60
/**
61
* @return the address scope of a FAMILY_INET6 address.
62
*
64
*
65
* @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET6
66
*/
67
readonly attribute unsigned long scope;
68
69
/**
70
* @return whether a FAMILY_INET6 address is mapped from FAMILY_INET.
71
*
72
* @throws NS_ERROR_NOT_AVAILABLE if the address family is not FAMILY_INET6
73
*/
74
readonly attribute boolean isV4Mapped;
75
76
/**
77
* Network address families. These correspond to all the network address
78
* families supported by the NetAddr struct.
79
*/
80
const unsigned long FAMILY_INET = 1;
81
const unsigned long FAMILY_INET6 = 2;
82
const unsigned long FAMILY_LOCAL = 3;
83
84
/**
85
* @return the underlying NetAddr struct.
86
*/
87
[noscript] NetAddr getNetAddr();
88
};