nsINetworkLinkService.idl (4574B)
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/. */ 7 8 #include "nsISupports.idl" 9 interface nsINetAddr; 10 11 %{ C++ 12 #include "nsTArrayForwardDeclare.h" 13 namespace mozilla { 14 namespace net { 15 union NetAddr; 16 } 17 } 18 %} 19 native NetAddr(mozilla::net::NetAddr); 20 21 /** 22 * Network link status monitoring service. 23 */ 24 [scriptable, uuid(103e5293-77b3-4b70-af59-6e9e4a1f994a)] 25 interface nsINetworkLinkService : nsISupports 26 { 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; 34 35 /** 36 * This is set to true when the system is believed to have a usable 37 * network connection. 38 * 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). 42 * 43 * If the link status is not currently known, we generally assume that 44 * it is up. 45 */ 46 readonly attribute boolean isLinkUp; 47 48 /** 49 * This is set to true when we believe that isLinkUp is accurate. 50 */ 51 readonly attribute boolean linkStatusKnown; 52 53 /** 54 * The type of network connection. 55 */ 56 readonly attribute unsigned long linkType; 57 58 /** 59 * A string uniquely identifying the current active network interfaces. 60 * Empty when there are no active network interfaces. 61 */ 62 readonly attribute ACString networkID; 63 64 /** 65 * The list of DNS suffixes for the currently active network interfaces. 66 */ 67 readonly attribute Array<ACString> dnsSuffixList; 68 69 /** 70 * The IPs of the DNS resolvers currently used by the platform. 71 */ 72 [noscript] readonly attribute Array<NetAddr> nativeResolvers; 73 74 /** 75 * Same as previous - returns the IPs of DNS resolvers but this time as 76 * XPCOM objects usable by extensions. 77 */ 78 readonly attribute Array<nsINetAddr> resolvers; 79 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; 84 85 /** 86 * A bitfield that encodes the platform attributes we detected which 87 * indicate that we should only use DNS, not TRR. 88 */ 89 readonly attribute unsigned long platformDNSIndications; 90 91 %{C++ 92 static bool HasNonLocalIPv6Address(); 93 %} 94 }; 95 96 %{C++ 97 /** 98 * We send notifications through nsIObserverService with topic 99 * NS_NETWORK_LINK_TOPIC whenever one of isLinkUp or linkStatusKnown 100 * changes. We pass one of the NS_NETWORK_LINK_DATA_ constants below 101 * as the aData parameter of the notification. 102 */ 103 #define NS_NETWORK_LINK_TOPIC "network:link-status-changed" 104 105 /** 106 * isLinkUp is now true, linkStatusKnown is true. 107 */ 108 #define NS_NETWORK_LINK_DATA_UP "up" 109 /** 110 * isLinkUp is now false, linkStatusKnown is true. 111 */ 112 #define NS_NETWORK_LINK_DATA_DOWN "down" 113 /** 114 * isLinkUp is still true, but the network setup is modified. 115 * linkStatusKnown is true. 116 */ 117 #define NS_NETWORK_LINK_DATA_CHANGED "changed" 118 /** 119 * linkStatusKnown is now false. 120 */ 121 #define NS_NETWORK_LINK_DATA_UNKNOWN "unknown" 122 123 /** 124 * network ID has changed. 125 */ 126 #define NS_NETWORK_ID_CHANGED_TOPIC "network:networkid-changed" 127 128 /** 129 * DNS suffix list has updated. 130 */ 131 #define NS_DNS_SUFFIX_LIST_UPDATED_TOPIC "network:dns-suffix-list-updated" 132 133 /** 134 * We send notifications through nsIObserverService with topic 135 * NS_NETWORK_LINK_TYPE_TOPIC whenever the network connection type 136 * changes. We pass one of the valid connection type constants 137 * below as the aData parameter of the notification. 138 */ 139 #define NS_NETWORK_LINK_TYPE_TOPIC "network:link-type-changed" 140 141 /** We were unable to determine the network connection type */ 142 #define NS_NETWORK_LINK_TYPE_UNKNOWN "unknown" 143 144 /** A standard wired ethernet connection */ 145 #define NS_NETWORK_LINK_TYPE_ETHERNET "ethernet" 146 147 /** A connection via a USB port */ 148 #define NS_NETWORK_LINK_TYPE_USB "usb" 149 150 /** A connection via a WiFi access point (IEEE802.11) */ 151 #define NS_NETWORK_LINK_TYPE_WIFI "wifi" 152 153 /** A connection via WiMax (IEEE802.16) */ 154 #define NS_NETWORK_LINK_TYPE_WIMAX "wimax" 155 156 /** A mobile connection (e.g. 2G, 3G, etc) */ 157 #define NS_NETWORK_LINK_TYPE_MOBILE "mobile" 158 %}