Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: chrome/common/extensions/api/socket.idl

Issue 12684008: Multicast socket API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor fixes Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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);
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 SendToCallback callback); 208 SendToCallback callback);
199 209
200 // This method applies to TCP sockets only. 210 // This method applies to TCP sockets only.
201 // Listens for connections on the specified port and address. This 211 // Listens for connections on the specified port and address. This
202 // effectively makes this a server socket, and client socket 212 // effectively makes this a server socket, and client socket
203 // functions (connect, read, write) can no longer be used on this socket. 213 // functions (connect, read, write) can no longer be used on this socket.
204 // |socketId| : The socketId. 214 // |socketId| : The socketId.
205 // |address| : The address of the local machine. 215 // |address| : The address of the local machine.
206 // |port| : The port of the local machine. 216 // |port| : The port of the local machine.
207 // |backlog| : Length of the socket's listen queue. 217 // |backlog| : Length of the socket's listen queue.
218 // |callback| : Called when listen operation completes.
208 static void listen(long socketId, 219 static void listen(long socketId,
209 DOMString address, 220 DOMString address,
210 long port, 221 long port,
211 optional long backlog, 222 optional long backlog,
212 ListenCallback callback); 223 ListenCallback callback);
213 224
214 // This method applies to TCP sockets only. 225 // This method applies to TCP sockets only.
215 // Registers a callback function to be called when a connection is 226 // Registers a callback function to be called when a connection is
216 // accepted on this listening server socket. Listen must be called first. 227 // accepted on this listening server socket. Listen must be called first.
217 // If there is already an active accept callback, this callback will be 228 // If there is already an active accept callback, this callback will be
(...skipping 25 matching lines...) Expand all
243 254
244 // Retrieves the state of the given socket. 255 // Retrieves the state of the given socket.
245 // |socketId| : The socketId. 256 // |socketId| : The socketId.
246 // |callback| : Called when the state is available. 257 // |callback| : Called when the state is available.
247 static void getInfo(long socketId, 258 static void getInfo(long socketId,
248 GetInfoCallback callback); 259 GetInfoCallback callback);
249 260
250 // Retrieves information about local adapters on this system. 261 // Retrieves information about local adapters on this system.
251 // |callback| : Called when local adapter information is available. 262 // |callback| : Called when local adapter information is available.
252 static void getNetworkList(GetNetworkCallback callback); 263 static void getNetworkList(GetNetworkCallback callback);
264
265 // Join the multicast group and start to receive diagrams from that group.
miket_OOO 2013/04/25 21:52:12 "diagrams" is probably not the right word.
Bei Zhang 2013/04/25 23:56:21 Done.
266 // The socket must be of UDP type and must be bound to a local port
267 // before calling this method.
268 // |socketId| : The socketId.
269 // |address| : The group address to join. Domain names are not supported.
270 // |callback| : Called when the join group operation is done with an
271 // integer parameter indicating the platform-independent error code.
272 static void joinGroup(long socketId,
273 DOMString address,
274 JoinGroupCallback callback);
275
276 // Leave the multicast group previously joined using <code>joinGroup</code>.
277 // It's not nessesary to leave the multicast group before destroying the
miket_OOO 2013/04/25 21:52:12 spelling: necessary
Bei Zhang 2013/04/25 23:56:21 Done.
278 // socket or exiting. This is automatically called by the OS.
279 //
280 // Leaving the group will prevent the router from sending multicast
281 // datagrams to the local host, presuming no other process on the host is
282 // still joined to the group.
283 //
284 // |socketId| : The socketId.
285 // |address| : The group address to leave. Domain names are not supported.
286 // |callback| : Called when the leave group operation is done with an
287 // integer parameter indicating the platform-independent error code.
288 static void leaveGroup(long socketId, DOMString address,
289 LeaveGroupCallback callback);
290
291 // Set the time-to-live of multicast diagrams sent to the multicast group.
292 //
293 // Calling this method does not require multicast permissions.
294 //
295 // |socketId| : The socketId.
296 // |ttl| : The time-to-live value.
297 // |callback| : Called when the configuretion operation is done.
miket_OOO 2013/04/25 21:52:12 spelling: configuration
Bei Zhang 2013/04/25 23:56:21 Done.
Bei Zhang 2013/04/25 23:56:21 Done.
298 static void setMulticastTimeToLive(
299 long socketId,
300 long ttl,
301 SetMulticastTimeToLiveCallback callback);
302
303 // Set the whether multicast diagrams sent from the host to the multicast
miket_OOO 2013/04/25 21:52:12 remove the first "the"
Bei Zhang 2013/04/25 23:56:21 Done.
304 // group will be looped back to the host.
305 //
306 // Note: the behavior of <code>setMulticastLoopbackMode</code> is slightly
307 // different between Windows and Unix-like systems. The inconsistency only
miket_OOO 2013/04/25 21:52:12 happens only (not only happens)
Bei Zhang 2013/04/25 23:56:21 Done.
308 // happens when there are more than one applications on the same host
miket_OOO 2013/04/25 21:52:12 fix pluralization of "applications"
miket_OOO 2013/04/25 21:52:12 there is, not there are ("there is ... one applica
Bei Zhang 2013/04/25 23:56:21 Wow thanks! this is really helpful! Done.
Bei Zhang 2013/04/25 23:56:21 Done.
309 // joined to the same multicast group while having different settings on
310 // multicast loopback mode. On Windows, the applications with loopback off
311 // will not RECEIVE the loopback packets; while on Unix-like systems, the
312 // applications with loopback off will not SEND the loopback packets to
313 // other applications on the same host. See MSDN: http://goo.gl/6vqbj
miket_OOO 2013/04/25 21:52:12 Hmmmm. This is a problem. The app writer will neve
Bei Zhang 2013/04/25 23:56:21 wtc concerned that we may not be able to make this
314 //
315 // Calling this method does not require multicast permissions.
316 //
317 // |socketId| : The socketId.
318 // |enabled| : Indicate whether to enable loop back mode.
miket_OOO 2013/04/25 21:52:12 Be consistent: either "loop back" or "loopback" (p
Bei Zhang 2013/04/25 23:56:21 Done.
319 // |callback| : Called when the configuretion operation is done.
miket_OOO 2013/04/25 21:52:12 spelling
Bei Zhang 2013/04/25 23:56:21 Done.
320 static void setMulticastLoopbackMode(
321 long socketId,
322 boolean enabled,
323 SetMulticastLoopbackModeCallback callback);
324
325 // Get the multicast group addresses the socket is currently joined to.
326 // |socketId| : The socketId.
327 // |callback| : Called with an array of strings of the result.
328 static void getJoinedGroups(long socketId,
329 GetJoinedGroupsCallback callback);
253 }; 330 };
254 331
255 }; 332 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698