OLD | NEW |
| (Empty) |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 * Use of this source code is governed by a BSD-style license that can be | |
3 * found in the LICENSE file. | |
4 */ | |
5 | |
6 /** | |
7 * This file defines the <code>PPB_Transport_Dev</code> interface. | |
8 */ | |
9 label Chrome { | |
10 M14 = 0.7 | |
11 }; | |
12 | |
13 [assert_size(4)] | |
14 enum PP_TransportType { | |
15 PP_TRANSPORTTYPE_DATAGRAM = 0, | |
16 PP_TRANSPORTTYPE_STREAM = 1 | |
17 }; | |
18 | |
19 [assert_size(4)] | |
20 enum PP_TransportProperty { | |
21 /** | |
22 * STUN server address and port, e.g "stun.example.com:19302". | |
23 */ | |
24 PP_TRANSPORTPROPERTY_STUN_SERVER = 0, | |
25 | |
26 /** | |
27 * Relay server address and port, e.g. "relay.example.com:12344". | |
28 */ | |
29 PP_TRANSPORTPROPERTY_RELAY_SERVER = 1, | |
30 | |
31 /** | |
32 * Username for the relay server. | |
33 */ | |
34 PP_TRANSPORTPROPERTY_RELAY_USERNAME = 2, | |
35 | |
36 /** | |
37 * Password for the relay server. | |
38 */ | |
39 PP_TRANSPORTPROPERTY_RELAY_PASSWORD = 3, | |
40 | |
41 /** | |
42 * Type of Relay server. Must be one of the PP_TransportRelayMode values. By | |
43 * default is set to PP_TRANSPORTRELAYMODE_TURN. | |
44 */ | |
45 PP_TRANSPORTPROPERTY_RELAY_MODE = 4, | |
46 | |
47 /** | |
48 * TCP receive window in bytes. Takes effect only for PseudoTCP connections. | |
49 */ | |
50 PP_TRANSPORTPROPERTY_TCP_RECEIVE_WINDOW = 5, | |
51 | |
52 /** | |
53 * TCP send window in bytes. Takes effect only for PseudoTCP connections. | |
54 */ | |
55 PP_TRANSPORTPROPERTY_TCP_SEND_WINDOW = 6, | |
56 | |
57 /** | |
58 * Boolean value that disables Neagle's algorithm when set to true. When | |
59 * Neagle's algorithm is disabled, all outgoing packets are sent as soon as | |
60 * possible. When set to false (by default) data may be buffered until there | |
61 * is a sufficient amount to send. | |
62 */ | |
63 PP_TRANSPORTPROPERTY_TCP_NO_DELAY = 7, | |
64 | |
65 /** | |
66 * Delay for ACK packets in milliseconds. By default set to 100ms. | |
67 */ | |
68 PP_TRANSPORTPROPERTY_TCP_ACK_DELAY = 8, | |
69 | |
70 /** | |
71 * Boolean value that disables TCP-based transports when set to true. By | |
72 * default set to false. | |
73 */ | |
74 PP_TRANSPORTPROPERTY_DISABLE_TCP_TRANSPORT = 9 | |
75 }; | |
76 | |
77 [assert_size(4)] | |
78 enum PP_TransportRelayMode { | |
79 /** | |
80 * RFC5766 compliant relay server. | |
81 */ | |
82 PP_TRANSPORTRELAYMODE_TURN = 0, | |
83 | |
84 /** | |
85 * Legacy Google relay server. | |
86 */ | |
87 PP_TRANSPORTRELAYMODE_GOOGLE = 1 | |
88 }; | |
89 | |
90 /** | |
91 * The transport interface provides peer-to-peer communication. | |
92 * | |
93 * TODO(juberti): other getters/setters | |
94 * connect state | |
95 * connect type, protocol | |
96 * RTT | |
97 */ | |
98 interface PPB_Transport_Dev { | |
99 /** | |
100 * Creates a new transport object with the specified name using the | |
101 * specified protocol. | |
102 */ | |
103 PP_Resource CreateTransport( | |
104 [in] PP_Instance instance, | |
105 [in] str_t name, | |
106 [in] PP_TransportType type); | |
107 | |
108 /** | |
109 * Returns PP_TRUE if resource is a Transport, PP_FALSE otherwise. | |
110 */ | |
111 PP_Bool IsTransport( | |
112 [in] PP_Resource resource); | |
113 | |
114 /** | |
115 * Returns PP_TRUE if the transport is currently writable (i.e. can | |
116 * send data to the remote peer), PP_FALSE otherwise. | |
117 */ | |
118 PP_Bool IsWritable( | |
119 [in] PP_Resource transport); | |
120 | |
121 /** | |
122 * Sets various configuration properties of the transport. | |
123 */ | |
124 int32_t SetProperty( | |
125 [in] PP_Resource transport, | |
126 [in] PP_TransportProperty property, | |
127 [in] PP_Var value); | |
128 | |
129 /** | |
130 * Establishes a connection to the remote peer. Returns | |
131 * PP_OK_COMPLETIONPENDING and notifies on |cb| when connectivity is | |
132 * established (or timeout occurs). | |
133 */ | |
134 int32_t Connect( | |
135 [in] PP_Resource transport, | |
136 [in] PP_CompletionCallback cb); | |
137 | |
138 /** | |
139 * Obtains another ICE candidate address to be provided to the | |
140 * remote peer. Returns PP_OK_COMPLETIONPENDING if there are no more | |
141 * addresses to be sent. After the callback is called | |
142 * GetNextAddress() must be called again to get the address. | |
143 */ | |
144 int32_t GetNextAddress( | |
145 [in] PP_Resource transport, | |
146 [out] PP_Var address, | |
147 [in] PP_CompletionCallback cb); | |
148 | |
149 /** | |
150 * Provides an ICE candidate address that was received from the remote peer. | |
151 */ | |
152 int32_t ReceiveRemoteAddress( | |
153 [in] PP_Resource transport, | |
154 [in] PP_Var address); | |
155 | |
156 /** | |
157 * Like recv(), receives data. Returns PP_OK_COMPLETIONPENDING if there is | |
158 * currently no data to receive. In that case, the |data| pointer should | |
159 * remain valid until the callback is called. | |
160 */ | |
161 int32_t Recv( | |
162 [in] PP_Resource transport, | |
163 [out] mem_t data, | |
164 [in] uint32_t len, | |
165 [in] PP_CompletionCallback cb); | |
166 | |
167 /** | |
168 * Like send(), sends data. Returns PP_OK_COMPLETIONPENDING if the socket is | |
169 * currently flow-controlled. In that case, the |data| pointer should remain | |
170 * valid until the callback is called. | |
171 */ | |
172 int32_t Send( | |
173 [in] PP_Resource transport, | |
174 [in] mem_t data, | |
175 [in] uint32_t len, | |
176 [in] PP_CompletionCallback cb); | |
177 | |
178 /** | |
179 * Disconnects from the remote peer. | |
180 */ | |
181 int32_t Close( | |
182 [in] PP_Resource transport); | |
183 }; | |
OLD | NEW |