nsINetworkLinkService.idl 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. #include "nsISupports.idl"
  8. /**
  9. * Network link status monitoring service.
  10. */
  11. [scriptable, uuid(103e5293-77b3-4b70-af59-6e9e4a1f994a)]
  12. interface nsINetworkLinkService : nsISupports
  13. {
  14. /* Link type constants */
  15. const unsigned long LINK_TYPE_UNKNOWN = 0;
  16. const unsigned long LINK_TYPE_ETHERNET = 1;
  17. const unsigned long LINK_TYPE_USB = 2;
  18. const unsigned long LINK_TYPE_WIFI = 3;
  19. const unsigned long LINK_TYPE_WIMAX = 4;
  20. const unsigned long LINK_TYPE_2G = 5;
  21. const unsigned long LINK_TYPE_3G = 6;
  22. const unsigned long LINK_TYPE_4G = 7;
  23. /**
  24. * This is set to true when the system is believed to have a usable
  25. * network connection.
  26. *
  27. * The link is only up when network connections can be established. For
  28. * example, the link is down during DHCP configuration (unless there
  29. * is another usable interface already configured).
  30. *
  31. * If the link status is not currently known, we generally assume that
  32. * it is up.
  33. */
  34. readonly attribute boolean isLinkUp;
  35. /**
  36. * This is set to true when we believe that isLinkUp is accurate.
  37. */
  38. readonly attribute boolean linkStatusKnown;
  39. /**
  40. * The type of network connection.
  41. */
  42. readonly attribute unsigned long linkType;
  43. };
  44. %{C++
  45. /**
  46. * We send notifications through nsIObserverService with topic
  47. * NS_NETWORK_LINK_TOPIC whenever one of isLinkUp or linkStatusKnown
  48. * changes. We pass one of the NS_NETWORK_LINK_DATA_ constants below
  49. * as the aData parameter of the notification.
  50. */
  51. #define NS_NETWORK_LINK_TOPIC "network:link-status-changed"
  52. /**
  53. * isLinkUp is now true, linkStatusKnown is true.
  54. */
  55. #define NS_NETWORK_LINK_DATA_UP "up"
  56. /**
  57. * isLinkUp is now false, linkStatusKnown is true.
  58. */
  59. #define NS_NETWORK_LINK_DATA_DOWN "down"
  60. /**
  61. * isLinkUp is still true, but the network setup is modified.
  62. * linkStatusKnown is true.
  63. */
  64. #define NS_NETWORK_LINK_DATA_CHANGED "changed"
  65. /**
  66. * linkStatusKnown is now false.
  67. */
  68. #define NS_NETWORK_LINK_DATA_UNKNOWN "unknown"
  69. /**
  70. * We send notifications through nsIObserverService with topic
  71. * NS_NETWORK_LINK_TYPE_TOPIC whenever the network connection type
  72. * changes. We pass one of the valid connection type constants
  73. * below as the aData parameter of the notification.
  74. */
  75. #define NS_NETWORK_LINK_TYPE_TOPIC "network:link-type-changed"
  76. /** We were unable to determine the network connection type */
  77. #define NS_NETWORK_LINK_TYPE_UNKNOWN "unknown"
  78. /** A standard wired ethernet connection */
  79. #define NS_NETWORK_LINK_TYPE_ETHERNET "ethernet"
  80. /** A connection via a USB port */
  81. #define NS_NETWORK_LINK_TYPE_USB "usb"
  82. /** A connection via a WiFi access point (IEEE802.11) */
  83. #define NS_NETWORK_LINK_TYPE_WIFI "wifi"
  84. /** A connection via WiMax (IEEE802.16) */
  85. #define NS_NETWORK_LINK_TYPE_WIMAX "wimax"
  86. /** A '2G' mobile connection (e.g. GSM, GPRS, EDGE) */
  87. #define NS_NETWORK_LINK_TYPE_2G "2g"
  88. /** A '3G' mobile connection (e.g. UMTS, CDMA) */
  89. #define NS_NETWORK_LINK_TYPE_3G "3g"
  90. /** A '4G' mobile connection (e.g. LTE, UMB) */
  91. #define NS_NETWORK_LINK_TYPE_4G "4g"
  92. %}