OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Use the <code>chrome.sockets.tcp</code> API to send and receive data over the | 5 // Use the <code>chrome.sockets.tcp</code> API to send and receive data over the |
6 // network using TCP connections. This API supersedes the TCP functionality | 6 // network using TCP connections. This API supersedes the TCP functionality |
7 // previously found in the <code>chrome.socket</code> API. Note that the socket | 7 // previously found in the <code>chrome.socket</code> API. Note that the socket |
8 // ids created from this namespace are not compatible with ids created in other | 8 // ids created from this namespace are not compatible with ids created in other |
9 // namespaces. | 9 // namespaces. |
10 namespace sockets.tcp { | 10 namespace sockets.tcp { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Callback from the <code>setKeepAliveCallback<code> method. | 73 // Callback from the <code>setKeepAliveCallback<code> method. |
74 // |result| : The result code returned from the underlying network call. | 74 // |result| : The result code returned from the underlying network call. |
75 // A negative value indicates an error. | 75 // A negative value indicates an error. |
76 callback SetKeepAliveCallback = void (long result); | 76 callback SetKeepAliveCallback = void (long result); |
77 | 77 |
78 // Callback from the <code>setNodeDelay<code> method. | 78 // Callback from the <code>setNodeDelay<code> method. |
79 // |result| : The result code returned from the underlying network call. | 79 // |result| : The result code returned from the underlying network call. |
80 // A negative value indicates an error. | 80 // A negative value indicates an error. |
81 callback SetNoDelayCallback = void (long result); | 81 callback SetNoDelayCallback = void (long result); |
82 | 82 |
| 83 dictionary TLSVersionConstraints { |
| 84 DOMString? min; |
| 85 DOMString? max; |
| 86 }; |
| 87 |
| 88 dictionary SecureOptions { |
| 89 TLSVersionConstraints? tlsVersion; |
| 90 }; |
| 91 |
| 92 callback SecureCallback = void (long result); |
| 93 |
83 // Result of the <code>getInfo</code> method. | 94 // Result of the <code>getInfo</code> method. |
84 dictionary SocketInfo { | 95 dictionary SocketInfo { |
85 // The socket identifier. | 96 // The socket identifier. |
86 long socketId; | 97 long socketId; |
87 | 98 |
88 // Flag indicating whether the socket is left open when the application is | 99 // Flag indicating whether the socket is left open when the application is |
89 // suspended (see <code>SocketProperties.persistent</code>). | 100 // suspended (see <code>SocketProperties.persistent</code>). |
90 boolean persistent; | 101 boolean persistent; |
91 | 102 |
92 // Application-defined string associated with the socket. | 103 // Application-defined string associated with the socket. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 DOMString peerAddress, | 213 DOMString peerAddress, |
203 long peerPort, | 214 long peerPort, |
204 ConnectCallback callback); | 215 ConnectCallback callback); |
205 | 216 |
206 // Disconnects the socket. | 217 // Disconnects the socket. |
207 // |socketId| : The socket identifier. | 218 // |socketId| : The socket identifier. |
208 // |callback| : Called when the disconnect attempt is complete. | 219 // |callback| : Called when the disconnect attempt is complete. |
209 static void disconnect(long socketId, | 220 static void disconnect(long socketId, |
210 optional DisconnectCallback callback); | 221 optional DisconnectCallback callback); |
211 | 222 |
| 223 // Start a TLS client connection over the socket. |
| 224 // |socketId| : The existing, connected socket to use. |
| 225 // |options| : Constraints and parameters for the TLS connection. |
| 226 // |callback| : Called when the connection attempt is complete. |
| 227 static void secure(long socketId, |
| 228 optional SecureOptions options, |
| 229 SecureCallback callback); |
| 230 |
212 // Sends data on the given TCP socket. | 231 // Sends data on the given TCP socket. |
213 // |socketId| : The socket identifier. | 232 // |socketId| : The socket identifier. |
214 // |data| : The data to send. | 233 // |data| : The data to send. |
215 // |callback| : Called when the <code>send</code> operation completes. | 234 // |callback| : Called when the <code>send</code> operation completes. |
216 static void send(long socketId, | 235 static void send(long socketId, |
217 ArrayBuffer data, | 236 ArrayBuffer data, |
218 SendCallback callback); | 237 SendCallback callback); |
219 | 238 |
220 // Closes the socket and releases the address/port the socket is bound to. | 239 // Closes the socket and releases the address/port the socket is bound to. |
221 // Each socket created should be closed after use. The socket id is no | 240 // Each socket created should be closed after use. The socket id is no |
(...skipping 21 matching lines...) Expand all Loading... |
243 static void onReceive(ReceiveInfo info); | 262 static void onReceive(ReceiveInfo info); |
244 | 263 |
245 // Event raised when a network error occured while the runtime was waiting | 264 // Event raised when a network error occured while the runtime was waiting |
246 // for data on the socket address and port. Once this event is raised, the | 265 // for data on the socket address and port. Once this event is raised, the |
247 // socket is set to <code>paused</code> and no more <code>onReceive</code> | 266 // socket is set to <code>paused</code> and no more <code>onReceive</code> |
248 // events are raised for this socket. | 267 // events are raised for this socket. |
249 // |info| : The event data. | 268 // |info| : The event data. |
250 static void onReceiveError(ReceiveErrorInfo info); | 269 static void onReceiveError(ReceiveErrorInfo info); |
251 }; | 270 }; |
252 }; | 271 }; |
OLD | NEW |