| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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.socket</code> API to send and receive data over the | 5 // Use the <code>chrome.socket</code> API to send and receive data over the |
| 6 // network using TCP and UDP connections. | 6 // network using TCP and UDP connections. |
| 7 namespace socket { | 7 namespace socket { |
| 8 enum SocketType { | 8 enum SocketType { |
| 9 tcp, | 9 tcp, |
| 10 udp | 10 udp |
| 11 }; | 11 }; |
| 12 | 12 |
| 13 // The socket options. | 13 // The socket options. |
| 14 dictionary CreateOptions { | 14 dictionary CreateOptions { |
| 15 }; | 15 }; |
| 16 | 16 |
| 17 dictionary CreateInfo { | 17 dictionary CreateInfo { |
| 18 // The id of the newly created socket. | 18 // The id of the newly created socket. |
| 19 long socketId; | 19 long socketId; |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 callback CreateCallback = void (CreateInfo createInfo); | 22 callback CreateCallback = void (CreateInfo createInfo); |
| 23 | 23 |
| 24 callback ConnectCallback = void (long result); | 24 callback ConnectCallback = void (long result); |
| 25 | 25 |
| 26 callback BindCallback = void (long result); | 26 callback BindCallback = void (long result); |
| 27 | 27 |
| 28 callback ListenCallback = void (long result); | 28 callback ListenCallback = void (long result); |
| 29 | 29 |
| 30 callback SecureCallback = void (long result); |
| 31 |
| 30 dictionary AcceptInfo { | 32 dictionary AcceptInfo { |
| 31 long resultCode; | 33 long resultCode; |
| 32 // The id of the accepted socket. | 34 // The id of the accepted socket. |
| 33 long? socketId; | 35 long? socketId; |
| 34 }; | 36 }; |
| 35 | 37 |
| 36 callback AcceptCallback = void (AcceptInfo acceptInfo); | 38 callback AcceptCallback = void (AcceptInfo acceptInfo); |
| 37 | 39 |
| 38 dictionary ReadInfo { | 40 dictionary ReadInfo { |
| 39 // The resultCode returned from the underlying read() call. | 41 // The resultCode returned from the underlying read() call. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // "eth0", "lo", etc. | 102 // "eth0", "lo", etc. |
| 101 DOMString name; | 103 DOMString name; |
| 102 | 104 |
| 103 // The available IPv4/6 address. | 105 // The available IPv4/6 address. |
| 104 DOMString address; | 106 DOMString address; |
| 105 | 107 |
| 106 // The prefix length | 108 // The prefix length |
| 107 long prefixLength; | 109 long prefixLength; |
| 108 }; | 110 }; |
| 109 | 111 |
| 112 dictionary TLSVersionConstraints { |
| 113 // The minimum and maximum acceptable versions of TLS. These will |
| 114 // be <code>ssl3</code>, <code>tls1</code>, <code>tls1.1</code>, |
| 115 // or <code>tls1.2</code>. |
| 116 DOMString? min; |
| 117 DOMString? max; |
| 118 }; |
| 119 |
| 120 dictionary SecureOptions { |
| 121 TLSVersionConstraints? tlsVersion; |
| 122 }; |
| 123 |
| 110 callback RecvFromCallback = void (RecvFromInfo recvFromInfo); | 124 callback RecvFromCallback = void (RecvFromInfo recvFromInfo); |
| 111 | 125 |
| 112 callback SendToCallback = void (WriteInfo writeInfo); | 126 callback SendToCallback = void (WriteInfo writeInfo); |
| 113 | 127 |
| 114 callback SetKeepAliveCallback = void (boolean result); | 128 callback SetKeepAliveCallback = void (boolean result); |
| 115 | 129 |
| 116 callback SetNoDelayCallback = void (boolean result); | 130 callback SetNoDelayCallback = void (boolean result); |
| 117 | 131 |
| 118 callback GetInfoCallback = void (SocketInfo result); | 132 callback GetInfoCallback = void (SocketInfo result); |
| 119 | 133 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 static void setMulticastLoopbackMode( | 339 static void setMulticastLoopbackMode( |
| 326 long socketId, | 340 long socketId, |
| 327 boolean enabled, | 341 boolean enabled, |
| 328 SetMulticastLoopbackModeCallback callback); | 342 SetMulticastLoopbackModeCallback callback); |
| 329 | 343 |
| 330 // Get the multicast group addresses the socket is currently joined to. | 344 // Get the multicast group addresses the socket is currently joined to. |
| 331 // |socketId| : The socketId. | 345 // |socketId| : The socketId. |
| 332 // |callback| : Called with an array of strings of the result. | 346 // |callback| : Called with an array of strings of the result. |
| 333 static void getJoinedGroups(long socketId, | 347 static void getJoinedGroups(long socketId, |
| 334 GetJoinedGroupsCallback callback); | 348 GetJoinedGroupsCallback callback); |
| 349 |
| 350 // Start a TLS client connection over the socket. |
| 351 // |socketId| : The connected socket to use. |
| 352 // |options| : Constraints and parameters for the TLS connection. |
| 353 // |callback| : Called when the TLS connection attempt is complete. |
| 354 static void secure(long socketId, |
| 355 optional SecureOptions options, |
| 356 SecureCallback callback); |
| 335 }; | 357 }; |
| 336 | 358 |
| 337 }; | 359 }; |
| OLD | NEW |