Merge mozilla-central to autoland. CLOSED TREE
[gecko.git] / netwerk / base / nsINetworkLinkService.idl
blob29c7fab8361bc373456f8f9e7de3484c2d50375d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* vim:expandtab:shiftwidth=4:tabstop=4:
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #include "nsISupports.idl"
9 interface nsINetAddr;
11 %{ C++
12 #include "nsTArrayForwardDeclare.h"
13 namespace mozilla {
14 namespace net {
15 union NetAddr;
19 native NetAddr(mozilla::net::NetAddr);
21 /**
22 * Network link status monitoring service.
24 [scriptable, uuid(103e5293-77b3-4b70-af59-6e9e4a1f994a)]
25 interface nsINetworkLinkService : nsISupports
27 /* Link type constants */
28 const unsigned long LINK_TYPE_UNKNOWN = 0;
29 const unsigned long LINK_TYPE_ETHERNET = 1;
30 const unsigned long LINK_TYPE_USB = 2;
31 const unsigned long LINK_TYPE_WIFI = 3;
32 const unsigned long LINK_TYPE_WIMAX = 4;
33 const unsigned long LINK_TYPE_MOBILE = 9;
35 /**
36 * This is set to true when the system is believed to have a usable
37 * network connection.
39 * The link is only up when network connections can be established. For
40 * example, the link is down during DHCP configuration (unless there
41 * is another usable interface already configured).
43 * If the link status is not currently known, we generally assume that
44 * it is up.
46 readonly attribute boolean isLinkUp;
48 /**
49 * This is set to true when we believe that isLinkUp is accurate.
51 readonly attribute boolean linkStatusKnown;
53 /**
54 * The type of network connection.
56 readonly attribute unsigned long linkType;
58 /**
59 * A string uniquely identifying the current active network interfaces.
60 * Empty when there are no active network interfaces.
62 readonly attribute ACString networkID;
64 /**
65 * The list of DNS suffixes for the currently active network interfaces.
67 readonly attribute Array<ACString> dnsSuffixList;
69 /**
70 * The IPs of the DNS resolvers currently used by the platform.
72 [noscript] readonly attribute Array<NetAddr> nativeResolvers;
74 /**
75 * Same as previous - returns the IPs of DNS resolvers but this time as
76 * XPCOM objects usable by extensions.
78 readonly attribute Array<nsINetAddr> resolvers;
80 const unsigned long NONE_DETECTED = 0;
81 const unsigned long VPN_DETECTED = 1 << 0;
82 const unsigned long PROXY_DETECTED = 1 << 1;
83 const unsigned long NRPT_DETECTED = 1 << 2;
85 /**
86 * A bitfield that encodes the platform attributes we detected which
87 * indicate that we should only use DNS, not TRR.
89 readonly attribute unsigned long platformDNSIndications;
92 %{C++
93 /**
94 * We send notifications through nsIObserverService with topic
95 * NS_NETWORK_LINK_TOPIC whenever one of isLinkUp or linkStatusKnown
96 * changes. We pass one of the NS_NETWORK_LINK_DATA_ constants below
97 * as the aData parameter of the notification.
99 #define NS_NETWORK_LINK_TOPIC "network:link-status-changed"
102 * isLinkUp is now true, linkStatusKnown is true.
104 #define NS_NETWORK_LINK_DATA_UP "up"
106 * isLinkUp is now false, linkStatusKnown is true.
108 #define NS_NETWORK_LINK_DATA_DOWN "down"
110 * isLinkUp is still true, but the network setup is modified.
111 * linkStatusKnown is true.
113 #define NS_NETWORK_LINK_DATA_CHANGED "changed"
115 * linkStatusKnown is now false.
117 #define NS_NETWORK_LINK_DATA_UNKNOWN "unknown"
120 * network ID has changed.
122 #define NS_NETWORK_ID_CHANGED_TOPIC "network:networkid-changed"
125 * DNS suffix list has updated.
127 #define NS_DNS_SUFFIX_LIST_UPDATED_TOPIC "network:dns-suffix-list-updated"
130 * We send notifications through nsIObserverService with topic
131 * NS_NETWORK_LINK_TYPE_TOPIC whenever the network connection type
132 * changes. We pass one of the valid connection type constants
133 * below as the aData parameter of the notification.
135 #define NS_NETWORK_LINK_TYPE_TOPIC "network:link-type-changed"
137 /** We were unable to determine the network connection type */
138 #define NS_NETWORK_LINK_TYPE_UNKNOWN "unknown"
140 /** A standard wired ethernet connection */
141 #define NS_NETWORK_LINK_TYPE_ETHERNET "ethernet"
143 /** A connection via a USB port */
144 #define NS_NETWORK_LINK_TYPE_USB "usb"
146 /** A connection via a WiFi access point (IEEE802.11) */
147 #define NS_NETWORK_LINK_TYPE_WIFI "wifi"
149 /** A connection via WiMax (IEEE802.16) */
150 #define NS_NETWORK_LINK_TYPE_WIMAX "wimax"
152 /** A mobile connection (e.g. 2G, 3G, etc) */
153 #define NS_NETWORK_LINK_TYPE_MOBILE "mobile"