PTCPSocket.ipdl (2151B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set sw=2 ts=8 et tw=80 ft=cpp : */ 3 4 /* This Source Code Form is subject to the terms of the Mozilla Public 5 * License, v. 2.0. If a copy of the MPL was not distributed with this 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 7 8 include protocol PNecko; 9 10 include "mozilla/net/NeckoMessageUtils.h"; 11 include "mozilla/dom/network/TCPSocketParent.h"; 12 include "mozilla/dom/network/TCPSocketChild.h"; 13 14 using struct mozilla::void_t from "mozilla/ipc/IPCCore.h"; 15 16 struct TCPError { 17 nsString name; 18 nsString message; 19 nsresult errorCode; 20 }; 21 22 union SendableData { 23 uint8_t[]; 24 nsCString; 25 }; 26 27 union CallbackData { 28 void_t; 29 SendableData; 30 TCPError; 31 }; 32 33 namespace mozilla { 34 namespace net { 35 36 //------------------------------------------------------------------- 37 [ManualDealloc, ChildImpl="mozilla::dom::TCPSocketChild", ParentImpl="mozilla::dom::TCPSocketParent"] 38 protocol PTCPSocket 39 { 40 manager PNecko; 41 42 parent: 43 // Forward calling to child's open() method to parent, expect TCPOptions 44 // is expanded to |useSSL| (from TCPOptions.useSecureTransport) and 45 // |binaryType| (from TCPOption.binaryType). 46 async Open(nsString host, uint16_t port, bool useSSL, bool useArrayBuffers); 47 48 async Data(SendableData data); 49 50 // Forward calling to child's upgradeToSecure() method to parent. 51 async StartTLS(); 52 53 // Forward calling to child's send() method to parent. 54 async Suspend(); 55 56 // Forward calling to child's resume() method to parent. 57 async Resume(); 58 59 // Forward calling to child's close() method to parent. 60 async Close(); 61 62 child: 63 // Forward events that are dispatched by parent. 64 async Callback(nsString type, CallbackData data, uint32_t readyState); 65 66 // Update child's bufferedAmount when parent's bufferedAmount is updated. 67 // trackingNumber is also passed back to child to ensure the bufferedAmount 68 // is corresponding the last call to send(). 69 async UpdateBufferedAmount(uint32_t bufferedAmount, uint32_t trackingNumber); 70 71 both: 72 async RequestDelete(); 73 async __delete__(); 74 }; 75 76 77 } // namespace net 78 } // namespace mozilla 79