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