| 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 DOMString? min; |
| 114 DOMString? max; |
| 115 }; |
| 116 |
| 117 dictionary SecureOptions { |
| 118 TLSVersionConstraints? tlsVersion; |
| 119 }; |
| 120 |
| 110 callback RecvFromCallback = void (RecvFromInfo recvFromInfo); | 121 callback RecvFromCallback = void (RecvFromInfo recvFromInfo); |
| 111 | 122 |
| 112 callback SendToCallback = void (WriteInfo writeInfo); | 123 callback SendToCallback = void (WriteInfo writeInfo); |
| 113 | 124 |
| 114 callback SetKeepAliveCallback = void (boolean result); | 125 callback SetKeepAliveCallback = void (boolean result); |
| 115 | 126 |
| 116 callback SetNoDelayCallback = void (boolean result); | 127 callback SetNoDelayCallback = void (boolean result); |
| 117 | 128 |
| 118 callback GetInfoCallback = void (SocketInfo result); | 129 callback GetInfoCallback = void (SocketInfo result); |
| 119 | 130 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 static void setMulticastLoopbackMode( | 336 static void setMulticastLoopbackMode( |
| 326 long socketId, | 337 long socketId, |
| 327 boolean enabled, | 338 boolean enabled, |
| 328 SetMulticastLoopbackModeCallback callback); | 339 SetMulticastLoopbackModeCallback callback); |
| 329 | 340 |
| 330 // Get the multicast group addresses the socket is currently joined to. | 341 // Get the multicast group addresses the socket is currently joined to. |
| 331 // |socketId| : The socketId. | 342 // |socketId| : The socketId. |
| 332 // |callback| : Called with an array of strings of the result. | 343 // |callback| : Called with an array of strings of the result. |
| 333 static void getJoinedGroups(long socketId, | 344 static void getJoinedGroups(long socketId, |
| 334 GetJoinedGroupsCallback callback); | 345 GetJoinedGroupsCallback callback); |
| 346 |
| 347 // Start a TLS client connection over the socket. |
| 348 // |socketId| : The existing, connected socket to use. |
| 349 // |options| : Constraints and parameters for the TLS connection. |
| 350 // |callback| : Called when the connection attempt is complete. |
| 351 static void secure(long socketId, |
| 352 optional SecureOptions options, |
| 353 SecureCallback callback); |
| 335 }; | 354 }; |
| 336 | 355 |
| 337 }; | 356 }; |
| OLD | NEW |