nsITCPSocketCallback.idl (2009B)
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/. */ 4 5 /** 6 * MozTCPSocket exposes a TCP client and server sockets 7 * to highly privileged apps. It provides a buffered, non-blocking 8 * interface for sending. For receiving, it uses an asynchronous, 9 * event handler based interface. 10 */ 11 12 #include "domstubs.idl" 13 14 15 /* 16 * This interface is implemented in TCPSocket.cpp as an internal interface 17 * for use in cross-process socket implementation. 18 * Needed to account for multiple possible types that can be provided to 19 * the socket callbacks as arguments. 20 */ 21 [scriptable, uuid(ac2c4b69-cb79-4767-b1ce-bcf62945cd39)] 22 interface nsITCPSocketCallback : nsISupports { 23 // Limitation of TCPSocket's buffer size. 24 const unsigned long BUFFER_SIZE = 65536; 25 26 // Dispatch an "error" event at this object with the given name and type. 27 void fireErrorEvent(in AString name, in AString type, in nsresult errorCode); 28 29 // Dispatch a "data" event at this object with a string 30 void fireDataStringEvent(in AString type, in ACString data); 31 32 // Dispatch a "data" event at this object with an Array 33 void fireDataArrayEvent(in AString type, in Array<uint8_t> data); 34 35 // Dispatch an event of the given type at this object. 36 void fireEvent(in AString type); 37 38 // Update the DOM object's readyState. 39 // @param readyState 40 // new ready state 41 void updateReadyState(in unsigned long readystate); 42 43 // Update the DOM object's bufferedAmount value with a tracking number to 44 // to allow tracking of which writes are "in-flight" 45 // @param bufferedAmount 46 // TCPSocket parent's bufferedAmount. 47 // @param trackingNumber 48 // A number to ensure the bufferedAmount is updated after data 49 // from child are sent to parent. 50 void updateBufferedAmount(in uint32_t bufferedAmount, 51 in uint32_t trackingNumber); 52 };