Bug 717122 - Network Manager interfaces. r=cjones
authorThinker K.F. Li <thinker@codemud.net>
Thu, 19 Apr 2012 18:33:25 -0300
changeset 95320 637a250a8a70657b9dd662ce3132079265805987
parent 95319 880879bfc6a808540620195dc6208fb955f1294b
child 95321 68962a3b0d30b213cbd238b28212ca7b515b59c1
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs717122
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 717122 - Network Manager interfaces. r=cjones
dom/system/gonk/Makefile.in
dom/system/gonk/nsINetworkManager.idl
--- a/dom/system/gonk/Makefile.in
+++ b/dom/system/gonk/Makefile.in
@@ -20,16 +20,17 @@ FORCE_STATIC_LIB = 1
 include $(topsrcdir)/dom/dom-config.mk
 
 CPPSRCS = \
   SystemWorkerManager.cpp \
   $(NULL)
 
 XPIDLSRCS = \
   nsIAudioManager.idl \
+  nsINetworkManager.idl \
   nsIRadioInterfaceLayer.idl \
   nsIWorkerHolder.idl \
   $(NULL)
 
 LOCAL_INCLUDES = \
   -I$(topsrcdir)/dom/base \
   -I$(topsrcdir)/dom/src/geolocation \
   -I$(topsrcdir)/dom/telephony \
new file mode 100644
--- /dev/null
+++ b/dom/system/gonk/nsINetworkManager.idl
@@ -0,0 +1,120 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+/**
+ * Information about networks that is exposed to network manager API consumers.
+ */
+[scriptable, uuid(e016d594-3072-11e1-9b7d-0010183a41af)]
+interface nsINetworkInterface : nsISupports
+{
+  const long NETWORK_STATE_UNKNOWN = -1;
+  const long NETWORK_STATE_CONNECTING = 0;
+  const long NETWORK_STATE_CONNECTED = 1;
+  const long NETWORK_STATE_SUSPENDED = 2;
+  const long NETWORK_STATE_DISCONNECTING = 3;
+  const long NETWORK_STATE_DISCONNECTED = 4;
+
+  /**
+   * Current network state, one of the NETWORK_STATE_* constants.
+   *
+   * When this changes, network interface implementations notify the
+   * 'network-interface-state-changed' observer notification.
+   */
+  readonly attribute long state;
+
+  const long NETWORK_TYPE_WIFI        = 0;
+  const long NETWORK_TYPE_MOBILE      = 1;
+  const long NETWORK_TYPE_MOBILE_MMS  = 2;
+
+  /**
+   * Network type. One of the NETWORK_TYPE_* constants.
+   */
+  readonly attribute long type;
+
+  /**
+   * Name of the network interface. This identifier is unique.
+   */
+  readonly attribute DOMString name;
+
+  /**
+   * Indicates whether DHCP should be run when the interface connects.
+   */
+  readonly attribute boolean dhcp;
+
+};
+
+/**
+ * Manage network interfaces.
+ */
+[scriptable, uuid(3bc29392-2fba-11e1-80fd-0010183a41af)]
+interface nsINetworkManager : nsISupports
+{
+  /**
+   * Register the given network interface with the network manager.
+   *
+   * Consumers will be notified with the 'network-interface-registered'
+   * observer notification.
+   *
+   * Throws if there's already an interface registered that has the same
+   * name.
+   *
+   * @param network
+   *        Network interface to register.
+   */
+  void registerNetworkInterface(in nsINetworkInterface network);
+
+  /**
+   * Unregister the given network interface from the network manager.
+   *
+   * Consumers will be notified with the 'network-interface-unregistered'
+   * observer notification.
+   *
+   * Throws an exception if the specified network interface object isn't
+   * registered.
+   *
+   * @param network
+   *        Network interface to unregister.
+   */
+  void unregisterNetworkInterface(in nsINetworkInterface network);
+
+  /**
+   * Object containing all known network connections, keyed by their
+   * interface name.
+   */
+  readonly attribute jsval networkInterfaces;
+
+  /**
+   * The preferred network type. One of the
+   * nsINetworkInterface::NETWORK_TYPE_* constants.
+   *
+   * This attribute is used for setting default route to favor
+   * interfaces with given type.  This can be overriden by calling
+   * overrideDefaultRoute().
+   */
+  attribute long preferredNetworkType;
+
+  /**
+   * The network interface handling all data traffic.
+   *
+   * When this changes, the 'network-active-changed' observer
+   * notification is dispatched.
+   */
+  readonly attribute nsINetworkInterface active;
+
+  /**
+   * Override the default behaviour for preferredNetworkType and route
+   * all network traffic through the the specified interface.
+   *
+   * Consumers can observe changes to the active network by subscribing to
+   * the 'network-active-changed' observer notification.
+   *
+   * @param network
+   *        Network to route all network traffic to. If this is null,
+   *        a previous override is canceled.
+   */
+  long overrideActive(in nsINetworkInterface network);
+
+};