summaryrefslogtreecommitdiffstats
path: root/dom/network/interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'dom/network/interfaces')
-rw-r--r--dom/network/interfaces/moz.build19
-rw-r--r--dom/network/interfaces/nsIEthernetManager.idl137
-rw-r--r--dom/network/interfaces/nsIMozNavigatorNetwork.idl13
-rw-r--r--dom/network/interfaces/nsINetworkStatsServiceProxy.idl64
-rw-r--r--dom/network/interfaces/nsITCPSocketCallback.idl59
-rw-r--r--dom/network/interfaces/nsIUDPSocketChild.idl78
6 files changed, 370 insertions, 0 deletions
diff --git a/dom/network/interfaces/moz.build b/dom/network/interfaces/moz.build
new file mode 100644
index 000000000..add687542
--- /dev/null
+++ b/dom/network/interfaces/moz.build
@@ -0,0 +1,19 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+XPIDL_SOURCES += [
+ 'nsIMozNavigatorNetwork.idl',
+ 'nsITCPSocketCallback.idl',
+ 'nsIUDPSocketChild.idl',
+]
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+ XPIDL_SOURCES += [
+ 'nsIEthernetManager.idl',
+ 'nsINetworkStatsServiceProxy.idl',
+ ]
+
+XPIDL_MODULE = 'dom_network'
diff --git a/dom/network/interfaces/nsIEthernetManager.idl b/dom/network/interfaces/nsIEthernetManager.idl
new file mode 100644
index 000000000..2b92dc88f
--- /dev/null
+++ b/dom/network/interfaces/nsIEthernetManager.idl
@@ -0,0 +1,137 @@
+/* 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"
+
+[scriptable, function, uuid(2a3ad56c-edc0-439f-8aae-900b331ddf49)]
+interface nsIEthernetManagerCallback : nsISupports
+{
+ /**
+ * Callback function used to report the success of different operations.
+ *
+ * @param success
+ * Boolean value indicates the success of an operation.
+ * @prarm message
+ * Message reported in the end of operation.
+ */
+ void notify(in boolean success, in DOMString message);
+};
+
+[scriptable, function, uuid(1746e7dd-92d4-43fa-8ef4-bc13d0b60353)]
+interface nsIEthernetManagerScanCallback : nsISupports
+{
+ /**
+ * Callback function used to report the result of scan function.
+ *
+ * @param list
+ * List of available ethernet interfaces.
+ */
+ void notify(in jsval list);
+};
+
+/**
+ * An internal idl provides control to ethernet interfaces.
+ */
+[scriptable, uuid(81750c87-bb3b-4724-b955-834eafa53fd1)]
+interface nsIEthernetManager : nsISupports
+{
+ /**
+ * List of exisiting interface name.
+ */
+ readonly attribute jsval interfaceList;
+
+ /**
+ * Scan available ethernet interfaces on device.
+ *
+ * @param callback
+ * Callback function.
+ */
+ void scan(in nsIEthernetManagerScanCallback callback);
+
+ /**
+ * Add a new interface to the interface list.
+ *
+ * @param ifname
+ * Interface name. Should be the form of "eth*".
+ * @param callback
+ * Callback function.
+ */
+ void addInterface(in DOMString ifname,
+ in nsIEthernetManagerCallback callback);
+
+ /**
+ * Remove an existing interface from the interface list.
+ *
+ * @param ifname
+ * Interface name.
+ * @param Callback
+ * Callback function.
+ */
+ void removeInterface(in DOMString ifname,
+ in nsIEthernetManagerCallback callback);
+
+ /**
+ * Update a conifg of an existing interface in the interface list.
+ *
+ * @param ifname
+ * Interface name.
+ * @param config
+ * .ip: IP address.
+ * .prefixLength: Mask length.
+ * .gateway: Gateway.
+ * .dnses: DNS addresses.
+ * .httpProxyHost: HTTP proxy host.
+ * .httpProxyPort: HTTP proxy port.
+ * .ipMode: IP mode, can be 'dhcp' or 'static'.
+ * @param callback
+ * Callback function.
+ */
+ void updateInterfaceConfig(in DOMString ifname,
+ in jsval config,
+ in nsIEthernetManagerCallback callback);
+
+ /**
+ * Enable networking of an existing interface in the interface list.
+ *
+ * @param ifname
+ * Interface name.
+ * @param callback
+ * Callback function.
+ */
+ void enable(in DOMString ifname,
+ in nsIEthernetManagerCallback callback);
+
+ /**
+ * Disable networking of an existing interface in the interface list.
+ *
+ * @param ifname
+ * Interface name.
+ * @param callback
+ * Callback function.
+ */
+ void disable(in DOMString ifname,
+ in nsIEthernetManagerCallback callback);
+
+ /**
+ * Make an existing interface connect to network.
+ *
+ * @param ifname
+ * Interface name.
+ * @param callback
+ * Callback function.
+ */
+ void connect(in DOMString ifname,
+ in nsIEthernetManagerCallback callback);
+
+ /**
+ * Disconnect a connected interface in the interface list.
+ *
+ * @param ifname
+ * Interface name.
+ * @param callback
+ * Callback function.
+ */
+ void disconnect(in DOMString ifname,
+ in nsIEthernetManagerCallback callback);
+};
diff --git a/dom/network/interfaces/nsIMozNavigatorNetwork.idl b/dom/network/interfaces/nsIMozNavigatorNetwork.idl
new file mode 100644
index 000000000..1d667aada
--- /dev/null
+++ b/dom/network/interfaces/nsIMozNavigatorNetwork.idl
@@ -0,0 +1,13 @@
+/* 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"
+
+interface nsINetworkProperties;
+
+[uuid(7956523b-631e-4f80-94a5-3883bcfd6bf3)]
+interface nsIMozNavigatorNetwork : nsISupports
+{
+ readonly attribute nsINetworkProperties properties;
+};
diff --git a/dom/network/interfaces/nsINetworkStatsServiceProxy.idl b/dom/network/interfaces/nsINetworkStatsServiceProxy.idl
new file mode 100644
index 000000000..cd6765c68
--- /dev/null
+++ b/dom/network/interfaces/nsINetworkStatsServiceProxy.idl
@@ -0,0 +1,64 @@
+/* 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"
+
+interface nsINetworkInfo;
+
+[scriptable, function, uuid(5f821529-1d80-4ab5-a933-4e1b3585b6bc)]
+interface nsINetworkStatsServiceProxyCallback : nsISupports
+{
+ /*
+ * @param aResult callback result with boolean value
+ * @param aMessage message
+ */
+ void notify(in boolean aResult, in jsval aMessage);
+};
+
+[scriptable, uuid(f4f3e901-e102-499d-9d37-dc9951f52df7)]
+interface nsINetworkStatsServiceProxy : nsISupports
+{
+ /*
+ * An interface used to record per-app traffic data.
+ * @param aAppId app id
+ * @param aIsInIsolatedMozBrowser
+ * true if the frame is an isolated mozbrowser element. <iframe
+ * mozbrowser mozapp> and <xul:browser> are not considered to be
+ * mozbrowser elements. <iframe mozbrowser noisolation> does not count
+ * as isolated since isolation is disabled. Isolation can only be
+ * disabled if the containing document is chrome.
+ * @param aNetworkInterface network
+ * @param aTimeStamp time stamp
+ * @param aRxBytes received data amount
+ * @param aTxBytes transmitted data amount
+ * @param aIsAccumulative is stats accumulative
+ * @param aCallback an optional callback
+ */
+ void saveAppStats(in unsigned long aAppId,
+ in boolean aIsInIsolatedMozBrowser,
+ in nsINetworkInfo aNetworkInfo,
+ in unsigned long long aTimeStamp,
+ in unsigned long long aRxBytes,
+ in unsigned long long aTxBytes,
+ in boolean aIsAccumulative,
+ [optional] in nsINetworkStatsServiceProxyCallback aCallback);
+
+ /*
+ * An interface used to record per-system service traffic data.
+ * @param aServiceType system service type
+ * @param aNetworkInterface network
+ * @param aTimeStamp time stamp
+ * @param aRxBytes received data amount
+ * @param aTxBytes transmitted data amount
+ * @param aIsAccumulative is stats accumulative
+ * @param aCallback an optional callback
+ */
+ void saveServiceStats(in string aServiceType,
+ in nsINetworkInfo aNetworkInfo,
+ in unsigned long long aTimeStamp,
+ in unsigned long long aRxBytes,
+ in unsigned long long aTxBytes,
+ in boolean aIsAccumulative,
+ [optional] in nsINetworkStatsServiceProxyCallback aCallback);
+};
diff --git a/dom/network/interfaces/nsITCPSocketCallback.idl b/dom/network/interfaces/nsITCPSocketCallback.idl
new file mode 100644
index 000000000..5ab85dcc7
--- /dev/null
+++ b/dom/network/interfaces/nsITCPSocketCallback.idl
@@ -0,0 +1,59 @@
+/* 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/. */
+
+/**
+ * MozTCPSocket exposes a TCP client and server sockets
+ * to highly privileged apps. It provides a buffered, non-blocking
+ * interface for sending. For receiving, it uses an asynchronous,
+ * event handler based interface.
+ */
+
+#include "domstubs.idl"
+
+%{C++
+#include "nsTArrayForwardDeclare.h"
+%}
+[ref] native nsUint8TArrayRef(InfallibleTArray<uint8_t>);
+[ptr] native JSContextPtr(JSContext);
+
+
+/*
+ * This interface is implemented in TCPSocket.cpp as an internal interface
+ * for use in cross-process socket implementation.
+ * Needed to account for multiple possible types that can be provided to
+ * the socket callbacks as arguments.
+ */
+[scriptable, uuid(ac2c4b69-cb79-4767-b1ce-bcf62945cd39)]
+interface nsITCPSocketCallback : nsISupports {
+ // Limitation of TCPSocket's buffer size.
+ const unsigned long BUFFER_SIZE = 65536;
+
+ // Dispatch an "error" event at this object with the given name and type.
+ void fireErrorEvent(in AString name, in AString type);
+
+ // Dispatch a "data" event at this object with a string
+ void fireDataStringEvent(in DOMString type, in ACString data);
+
+ // Dispatch a "data" event at this object with an Array
+ void fireDataArrayEvent(in DOMString type, [const] in nsUint8TArrayRef data);
+
+ // Dispatch an event of the given type at this object.
+ void fireEvent(in DOMString type);
+
+ // Update the DOM object's readyState.
+ // @param readyState
+ // new ready state
+ void updateReadyState(in unsigned long readystate);
+
+ // Update the DOM object's bufferedAmount value with a tracking number to
+ // to allow tracking of which writes are "in-flight"
+ // @param bufferedAmount
+ // TCPSocket parent's bufferedAmount.
+ // @param trackingNumber
+ // A number to ensure the bufferedAmount is updated after data
+ // from child are sent to parent.
+ void updateBufferedAmount(in uint32_t bufferedAmount,
+ in uint32_t trackingNumber);
+};
+
diff --git a/dom/network/interfaces/nsIUDPSocketChild.idl b/dom/network/interfaces/nsIUDPSocketChild.idl
new file mode 100644
index 000000000..3a07fae66
--- /dev/null
+++ b/dom/network/interfaces/nsIUDPSocketChild.idl
@@ -0,0 +1,78 @@
+/* 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"
+#include "nsINetAddr.idl"
+
+interface nsIUDPSocketInternal;
+interface nsIInputStream;
+interface nsIPrincipal;
+
+%{ C++
+namespace mozilla {
+namespace net {
+union NetAddr;
+}
+}
+%}
+native NetAddr(mozilla::net::NetAddr);
+[ptr] native NetAddrPtr(mozilla::net::NetAddr);
+
+[scriptable, uuid(1e6ad73b-6c05-4d78-9a88-2d357b88f58b)]
+interface nsIUDPSocketChild : nsISupports
+{
+ readonly attribute unsigned short localPort;
+ readonly attribute AUTF8String localAddress;
+ attribute AUTF8String filterName;
+
+ // Allow hosting this over PBackground instead of PNecko
+ [noscript] void setBackgroundSpinsEvents();
+
+ // Tell the chrome process to bind the UDP socket to a given local host and port
+ void bind(in nsIUDPSocketInternal socket, in nsIPrincipal principal,
+ in AUTF8String host, in unsigned short port,
+ in bool addressReuse, in bool loopback, in uint32_t recvBufferSize,
+ in uint32_t sendBufferSize);
+
+ // Tell the chrome process to connect the UDP socket to a given remote host and port
+ void connect(in nsIUDPSocketInternal socket, in AUTF8String host, in unsigned short port);
+
+ // Tell the chrome process to perform equivalent operations to all following methods
+ void send(in AUTF8String host, in unsigned short port,
+ [const, array, size_is(byteLength)] in uint8_t bytes,
+ in unsigned long byteLength);
+ // Send without DNS query
+ void sendWithAddr(in nsINetAddr addr,
+ [const, array, size_is(byteLength)] in uint8_t bytes,
+ in unsigned long byteLength);
+ [noscript] void sendWithAddress([const] in NetAddrPtr addr,
+ [const, array, size_is(byteLength)] in uint8_t bytes,
+ in unsigned long byteLength);
+ // Send input stream. This must be a buffered stream implementation.
+ void sendBinaryStream(in AUTF8String host, in unsigned short port, in nsIInputStream stream);
+
+ void close();
+ void joinMulticast(in AUTF8String multicastAddress, in AUTF8String iface);
+ void leaveMulticast(in AUTF8String multicastAddress, in AUTF8String iface);
+};
+
+/*
+ * Internal interface for callback from chrome process
+ */
+[scriptable, uuid(613dd3ad-598b-4da9-ad63-bbda50c20098)]
+interface nsIUDPSocketInternal : nsISupports
+{
+ // callback while socket is opened. localPort and localAddress is ready until this time.
+ void callListenerOpened();
+ // callback while socket is connected.
+ void callListenerConnected();
+ // callback while socket is closed.
+ void callListenerClosed();
+ // callback while incoming packet is received.
+ void callListenerReceivedData(in AUTF8String host, in unsigned short port,
+ [const, array, size_is(dataLength)] in uint8_t data,
+ in unsigned long dataLength);
+ // callback while any error happened.
+ void callListenerError(in AUTF8String message, in AUTF8String filename, in uint32_t lineNumber);
+};