1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/network/interfaces/nsITCPSocketParent.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,83 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "domstubs.idl" 1.9 + 1.10 +interface nsIDOMTCPSocket; 1.11 +interface nsIDOMTCPServerSocket; 1.12 +interface nsITCPServerSocketParent; 1.13 +interface nsITCPSocketIntermediary; 1.14 + 1.15 +// Interface required to allow the TCP socket object (TCPSocket.js) in the 1.16 +// parent process to talk to the parent IPC actor, TCPSocketParent, which 1.17 +// is written in C++. 1.18 +[scriptable, uuid(868662a4-681c-4b89-9f02-6fe5b7ace265)] 1.19 +interface nsITCPSocketParent : nsISupports 1.20 +{ 1.21 + [implicit_jscontext] void initJS(in jsval intermediary); 1.22 + 1.23 + // Trigger a callback in the content process for |type|, providing a serialized 1.24 + // argument of |data|, and update the child's readyState value with the given 1.25 + // values. 1.26 + // 1.27 + // @param type 1.28 + // Event type: 'onopen', 'ondata', 'onerror' or 'onclose'. 'odrain' is 1.29 + // controlled by child. 1.30 + // @param data 1.31 + // Serialized data that is passed to event handler. 1.32 + // @param readyState 1.33 + // Current ready state. 1.34 + [implicit_jscontext] void sendEvent(in DOMString type, 1.35 + in jsval data, 1.36 + in DOMString readyState); 1.37 + 1.38 + // Initialize a parent socket object. It is called from the parent side socket, 1.39 + // which is generated in accepting any open request on the parent side. 1.40 + // The socket after being initialized will be established. 1.41 + // 1.42 + // @param socket 1.43 + // The socket on the parent side. 1.44 + // @param intermediary 1.45 + // Intermediate class object. See nsITCPSocketIntermediary. 1.46 + [implicit_jscontext] void setSocketAndIntermediary(in nsIDOMTCPSocket socket, 1.47 + in nsITCPSocketIntermediary intermediary); 1.48 + 1.49 + // When parent's buffered amount is updated and it wants to inform child to 1.50 + // update the bufferedAmount as well. 1.51 + // 1.52 + // @param bufferedAmount 1.53 + // The new value of bufferedAmount that is going to be set to child's 1.54 + // bufferedAmount. 1.55 + // @param trackingNumber 1.56 + // Parent's current tracking number, reflecting the number of calls to 1.57 + // send() on the child process. This number is sent back to the child 1.58 + // to make sure the bufferedAmount updated on the child will correspond 1.59 + // to the latest call of send(). 1.60 + void sendUpdateBufferedAmount(in uint32_t bufferedAmount, in uint32_t trackingNumber); 1.61 +}; 1.62 + 1.63 +// Intermediate class to handle sending multiple possible data types 1.64 +// and kicking off the chrome process socket object's connection. 1.65 +// This interface is the bridge of TCPSocketParent, which is written in C++, 1.66 +// and TCPSocket, which is written in Javascript. TCPSocketParentIntermediary 1.67 +// implements nsITCPSocketIntermediary in Javascript. 1.68 +[scriptable, uuid(c434224a-dbb7-4869-8b2b-e49cee990e85)] 1.69 +interface nsITCPSocketIntermediary : nsISupports { 1.70 + // Open the connection to the server with the given parameters 1.71 + nsIDOMTCPSocket open(in nsITCPSocketParent parent, 1.72 + in DOMString host, in unsigned short port, 1.73 + in boolean useSSL, in DOMString binaryType, 1.74 + in unsigned long appId); 1.75 + 1.76 + // Listen on a port 1.77 + nsIDOMTCPServerSocket listen(in nsITCPServerSocketParent parent, 1.78 + in unsigned short port, in unsigned short backlog, 1.79 + in DOMString binaryType); 1.80 + 1.81 + // Called when received a child request to send a string. 1.82 + void onRecvSendString(in DOMString data, in uint32_t trackingNumber); 1.83 + 1.84 + // Called when received a child request to send an array buffer. 1.85 + void onRecvSendArrayBuffer(in jsval data, in uint32_t trackingNumber); 1.86 +};