1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/base/public/nsINetworkLinkService.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,103 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* vim:expandtab:shiftwidth=4:tabstop=4: 1.6 + */ 1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.10 + 1.11 +#include "nsISupports.idl" 1.12 + 1.13 +/** 1.14 + * Network link status monitoring service. 1.15 + */ 1.16 +[scriptable, uuid(f7d3be87-7403-4a1e-b89f-2797776e9b08)] 1.17 +interface nsINetworkLinkService : nsISupports 1.18 +{ 1.19 + /* Link type constants */ 1.20 + const unsigned long LINK_TYPE_UNKNOWN = 0; 1.21 + const unsigned long LINK_TYPE_ETHERNET = 1; 1.22 + const unsigned long LINK_TYPE_USB = 2; 1.23 + const unsigned long LINK_TYPE_WIFI = 3; 1.24 + const unsigned long LINK_TYPE_WIMAX = 4; 1.25 + const unsigned long LINK_TYPE_2G = 5; 1.26 + const unsigned long LINK_TYPE_3G = 6; 1.27 + const unsigned long LINK_TYPE_4G = 7; 1.28 + 1.29 + /** 1.30 + * This is set to true when the system is believed to have a usable 1.31 + * network connection. 1.32 + * 1.33 + * The link is only up when network connections can be established. For 1.34 + * example, the link is down during DHCP configuration (unless there 1.35 + * is another usable interface already configured). 1.36 + * 1.37 + * If the link status is not currently known, we generally assume that 1.38 + * it is up. 1.39 + */ 1.40 + readonly attribute boolean isLinkUp; 1.41 + 1.42 + /** 1.43 + * This is set to true when we believe that isLinkUp is accurate. 1.44 + */ 1.45 + readonly attribute boolean linkStatusKnown; 1.46 + 1.47 + /** 1.48 + * The type of network connection. 1.49 + */ 1.50 + readonly attribute unsigned long linkType; 1.51 +}; 1.52 + 1.53 +%{C++ 1.54 +/** 1.55 + * We send notifications through nsIObserverService with topic 1.56 + * NS_NETWORK_LINK_TOPIC whenever one of isLinkUp or linkStatusKnown 1.57 + * changes. We pass one of the NS_NETWORK_LINK_DATA_ constants below 1.58 + * as the aData parameter of the notification. 1.59 + */ 1.60 +#define NS_NETWORK_LINK_TOPIC "network:link-status-changed" 1.61 + 1.62 +/** 1.63 + * isLinkUp is now true, linkStatusKnown is true. 1.64 + */ 1.65 +#define NS_NETWORK_LINK_DATA_UP "up" 1.66 +/** 1.67 + * isLinkUp is now false, linkStatusKnown is true. 1.68 + */ 1.69 +#define NS_NETWORK_LINK_DATA_DOWN "down" 1.70 +/** 1.71 + * linkStatusKnown is now false. 1.72 + */ 1.73 +#define NS_NETWORK_LINK_DATA_UNKNOWN "unknown" 1.74 + 1.75 +/** 1.76 + * We send notifications through nsIObserverService with topic 1.77 + * NS_NETWORK_LINK_TYPE_TOPIC whenever the network connection type 1.78 + * changes. We pass one of the valid connection type constants 1.79 + * below as the aData parameter of the notification. 1.80 + */ 1.81 +#define NS_NETWORK_LINK_TYPE_TOPIC "network:link-type-changed" 1.82 + 1.83 +/** We were unable to determine the network connection type */ 1.84 +#define NS_NETWORK_LINK_TYPE_UNKNOWN "unknown" 1.85 + 1.86 +/** A standard wired ethernet connection */ 1.87 +#define NS_NETWORK_LINK_TYPE_ETHERNET "ethernet" 1.88 + 1.89 +/** A connection via a USB port */ 1.90 +#define NS_NETWORK_LINK_TYPE_USB "usb" 1.91 + 1.92 +/** A connection via a WiFi access point (IEEE802.11) */ 1.93 +#define NS_NETWORK_LINK_TYPE_WIFI "wifi" 1.94 + 1.95 +/** A connection via WiMax (IEEE802.16) */ 1.96 +#define NS_NETWORK_LINK_TYPE_WIMAX "wimax" 1.97 + 1.98 +/** A '2G' mobile connection (e.g. GSM, GPRS, EDGE) */ 1.99 +#define NS_NETWORK_LINK_TYPE_2G "2g" 1.100 + 1.101 +/** A '3G' mobile connection (e.g. UMTS, CDMA) */ 1.102 +#define NS_NETWORK_LINK_TYPE_3G "3g" 1.103 + 1.104 +/** A '4G' mobile connection (e.g. LTE, UMB) */ 1.105 +#define NS_NETWORK_LINK_TYPE_4G "4g" 1.106 +%}