|
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 |
|
12 using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; |
|
13 |
|
14 struct TCPError { |
|
15 nsString name; |
|
16 }; |
|
17 |
|
18 union SendableData { |
|
19 uint8_t[]; |
|
20 nsString; |
|
21 }; |
|
22 |
|
23 union CallbackData { |
|
24 void_t; |
|
25 SendableData; |
|
26 TCPError; |
|
27 }; |
|
28 |
|
29 namespace mozilla { |
|
30 namespace net { |
|
31 |
|
32 //------------------------------------------------------------------- |
|
33 protocol PTCPSocket |
|
34 { |
|
35 manager PNecko; |
|
36 |
|
37 parent: |
|
38 // Forward calling to child's open() method to parent, expect TCPOptions |
|
39 // is expanded to |useSSL| (from TCPOptions.useSecureTransport) and |
|
40 // |binaryType| (from TCPOption.binaryType). |
|
41 Open(nsString host, uint16_t port, bool useSSL, nsString binaryType); |
|
42 |
|
43 // When child's send() is called, this message requrests parent to send |
|
44 // data and update it's trackingNumber. |
|
45 Data(SendableData data, uint32_t trackingNumber); |
|
46 |
|
47 // Forward calling to child's upgradeToSecure() method to parent. |
|
48 StartTLS(); |
|
49 |
|
50 // Forward calling to child's send() method to parent. |
|
51 Suspend(); |
|
52 |
|
53 // Forward calling to child's resume() method to parent. |
|
54 Resume(); |
|
55 |
|
56 // Forward calling to child's close() method to parent. |
|
57 Close(); |
|
58 |
|
59 child: |
|
60 // Forward events that are dispatched by parent. |
|
61 Callback(nsString type, CallbackData data, nsString readyState); |
|
62 |
|
63 // Update child's bufferedAmount when parent's bufferedAmount is updated. |
|
64 // trackingNumber is also passed back to child to ensure the bufferedAmount |
|
65 // is corresponding the last call to send(). |
|
66 UpdateBufferedAmount(uint32_t bufferedAmount, uint32_t trackingNumber); |
|
67 |
|
68 both: |
|
69 RequestDelete(); |
|
70 __delete__(); |
|
71 }; |
|
72 |
|
73 |
|
74 } // namespace net |
|
75 } // namespace mozilla |
|
76 |