Chromium Code Reviews| 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 namespace socket { | 5 namespace socket { |
| 6 enum SocketType { | 6 enum SocketType { |
| 7 tcp, | 7 tcp, |
| 8 udp | 8 udp |
| 9 }; | 9 }; |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 callback SendToCallback = void (WriteInfo writeInfo); | 107 callback SendToCallback = void (WriteInfo writeInfo); |
| 108 | 108 |
| 109 callback SetKeepAliveCallback = void (boolean result); | 109 callback SetKeepAliveCallback = void (boolean result); |
| 110 | 110 |
| 111 callback SetNoDelayCallback = void (boolean result); | 111 callback SetNoDelayCallback = void (boolean result); |
| 112 | 112 |
| 113 callback GetInfoCallback = void (SocketInfo result); | 113 callback GetInfoCallback = void (SocketInfo result); |
| 114 | 114 |
| 115 callback GetNetworkCallback = void (NetworkInterface[] result); | 115 callback GetNetworkCallback = void (NetworkInterface[] result); |
| 116 | 116 |
| 117 callback JoinGroupCallback = void (long result); | |
|
scheib
2013/04/02 18:25:17
Document what the result values mean, and that -1
Bei Zhang
2013/04/05 00:38:59
I checked other files and found out that callbacks
scheib
2013/04/05 17:41:04
In at least some place, document what the return v
| |
| 118 | |
| 119 callback LeaveGroupCallback = void (long result); | |
| 120 | |
| 121 callback SetMulticastTimeToLiveCallback = void (long result); | |
| 122 | |
| 123 callback SetMulticastLoopbackModeCallback = void (long result); | |
| 124 | |
| 125 callback GetJoinedGroupsCallback = void (DOMString[] groups); | |
| 126 | |
| 117 interface Functions { | 127 interface Functions { |
| 118 // Creates a socket of the specified type that will connect to the specified | 128 // Creates a socket of the specified type that will connect to the specified |
| 119 // remote machine. | 129 // remote machine. |
| 120 // |type| : The type of socket to create. Must be <code>tcp</code> or | 130 // |type| : The type of socket to create. Must be <code>tcp</code> or |
| 121 // <code>udp</code>. | 131 // <code>udp</code>. |
| 122 // |options| : The socket options. | 132 // |options| : The socket options. |
| 123 // |callback| : Called when the socket has been created. | 133 // |callback| : Called when the socket has been created. |
| 124 static void create(SocketType type, | 134 static void create(SocketType type, |
| 125 optional CreateOptions options, | 135 optional CreateOptions options, |
| 126 CreateCallback callback); | 136 CreateCallback callback); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 | 253 |
| 244 // Retrieves the state of the given socket. | 254 // Retrieves the state of the given socket. |
| 245 // |socketId| : The socketId. | 255 // |socketId| : The socketId. |
| 246 // |callback| : Called when the state is available. | 256 // |callback| : Called when the state is available. |
| 247 static void getInfo(long socketId, | 257 static void getInfo(long socketId, |
| 248 GetInfoCallback callback); | 258 GetInfoCallback callback); |
| 249 | 259 |
| 250 // Retrieves information about local adapters on this system. | 260 // Retrieves information about local adapters on this system. |
| 251 // |callback| : Called when local adapter information is available. | 261 // |callback| : Called when local adapter information is available. |
| 252 static void getNetworkList(GetNetworkCallback callback); | 262 static void getNetworkList(GetNetworkCallback callback); |
| 263 | |
| 264 // Join the multicast group and start to receive diagrams from that group. | |
| 265 // The socket must be of UDP type and must be bound to a local port | |
| 266 // before calling this method. | |
| 267 // |socketId| : The socketId. | |
| 268 // |address| : The group address to join. Domain names are not supported. | |
| 269 // |callback| : Called when the join group operation is done. | |
| 270 static void joinGroup(long socketId, | |
| 271 DOMString address, | |
| 272 JoinGroupCallback callback); | |
| 273 | |
| 274 // Leave the multicast group previously joined using <code>joinGroup</code> | |
|
scheib
2013/04/02 18:25:17
Period at end of line.
Bei Zhang
2013/04/05 00:38:59
Done.
| |
| 275 // It's not nessesary to leave the multicast group before destroying the | |
| 276 // socket or exiting. This is automatically called by the OS. | |
| 277 // | |
| 278 // To leave group before destroy the socket can prevent the router from | |
| 279 // sending muticast diagrams to the local host if none of the processes on | |
| 280 // the host is joined to the group. | |
|
scheib
2013/04/02 18:25:17
Wording is a bit awkward. Perhaps:
"Leaving the gr
Bei Zhang
2013/04/05 00:38:59
Done.
| |
| 281 // |socketId| : The socketId. | |
| 282 // |address| : The group address to leave. Domain names are not supported. | |
| 283 // |callback| : Called when the leave group operation is done. | |
| 284 static void leaveGroup(long socketId, DOMString address, | |
| 285 LeaveGroupCallback callback); | |
| 286 | |
| 287 // Set the time-to-live of multicast diagrams sent to the multicast group. | |
| 288 // |socketId| : The socketId. | |
| 289 // |ttl| : The time-to-live value. | |
| 290 // |callback| : Called when the configuretion operation is done. | |
| 291 static void setMulticastTimeToLive( | |
| 292 long socketId, | |
| 293 long ttl, | |
| 294 SetMulticastTimeToLiveCallback callback); | |
| 295 | |
| 296 // Set the whether multicast diagrams sent from the host to the multicast | |
| 297 // group will be looped back to the host. | |
| 298 // |socketId| : The socketId. | |
| 299 // |enabled| : Indicate whether to enable loop back mode. | |
| 300 // |callback| : Called when the configuretion operation is done. | |
| 301 static void setMulticastLoopbackMode( | |
| 302 long socketId, | |
| 303 boolean enabled, | |
| 304 SetMulticastLoopbackModeCallback callback); | |
| 305 | |
| 306 // Get the multicast group adrresses the socket currently joining. | |
|
scheib
2013/04/02 18:25:17
addresses the socket is currently joined to.
Bei Zhang
2013/04/05 00:38:59
Done.
| |
| 307 // |socketId| : The socketId. | |
| 308 // |callback| : Called with an array of strings of the result. | |
| 309 static void getJoinedGroups(long socketId, | |
| 310 GetJoinedGroupsCallback callback); | |
| 253 }; | 311 }; |
| 254 | 312 |
| 255 }; | 313 }; |
| OLD | NEW |