dom/network/interfaces/nsIDOMTCPServerSocket.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #include "domstubs.idl"
     6 #include "nsITCPSocketChild.idl"
     8 // Bug 797561 - Expose a server tcp socket API to web applications
     9 /**
    10  * nsIDOMTCPServerSocket
    11  *
    12  * An interface to a server socket that can accept incoming connections for gaia apps.
    13  */
    14 [scriptable, uuid(821638a1-5327-416d-8031-668764f2ec04)]
    15 interface nsIDOMTCPServerSocket : nsISupports
    16 {
    17   /**
    18    * The port of this server socket object.
    19    */
    20   readonly attribute unsigned short localPort;
    22   /**
    23    * The onconnect event handler is called when a client connection is accepted.
    24    * The data attribute of the event passed to the onconnect handler will be a TCPSocket
    25    * instance, which is used for communication between client and server. 
    26    */
    27   attribute jsval onconnect;
    29   /**
    30    * The onerror handler will be called when the listen of a server socket is aborted.
    31    * The data attribute of the event passed to the onerror handler will have a
    32    * description of the kind of error.
    33    */
    34   attribute jsval onerror;
    36   /**
    37    * Close the server socket.
    38    */
    39   void close();
    40 };
    42 /**
    43  * Internal interfaces for use in cross-process server-socket implementation.
    44  * Needed to account for multiple possible types that can be provided to
    45  * the socket callbacks as arguments.
    46  *
    47  * These interfaces are for calling each method from the server socket object
    48  * on the parent and child side for an IPC protocol implementation.
    49  */
    51 [scriptable, uuid(b64b1e68-4efa-497c-b0d8-69f067ad5ec8)]
    52 interface nsITCPServerSocketInternal : nsISupports 
    53 {
    54   /**
    55    * Initialization after creating a TCP server socket object.
    56    *
    57    * @param windowVal
    58    *        An object to create ArrayBuffer for this window. See Bug 831107.
    59    */
    60   void init(in jsval windowVal);
    62   /** 
    63    * Listen on a port
    64    *
    65    * @param localPort 
    66    *        The port of the server socket. Pass -1 to indicate no preference,
    67    *        and a port will be selected automatically.
    68    * @param options 
    69    *        An object specifying one or more parameters which
    70    *        determine the details of the socket.
    71    *
    72    *        binaryType: "arraybuffer" to use UInt8 array
    73    *        instances in the ondata callback and as the argument
    74    *        to send. Defaults to "string", to use JavaScript strings.
    75    * @param backlog 
    76    *        The maximum length the queue of pending connections may grow to.
    77    *        This parameter may be silently limited by the operating system.
    78    *        Pass -1 to use the default value.
    79    */
    80   void listen(in unsigned short localPort, in jsval options, in unsigned short backlog);
    82   /**
    83    * Listener for receiving an accepted socket.
    84    */
    85   void callListenerAccept(in nsITCPSocketChild socketChild);
    87   /**
    88    * Listener for handling an error caused in chrome process.
    89    */
    90   void callListenerError(in DOMString message, in DOMString filename,
    91                          in uint32_t lineNumber, in uint32_t columnNumber);
    92 };

mercurial