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

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: Fix tests 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.
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 integer
mmenke 2013/04/12 21:07:41 Is this line too long? Comment should also end wi
Bei Zhang 2013/04/15 22:30:26 This comment continues to the next line.
271 // 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
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 // |socketId| : The socketId.
295 // |ttl| : The time-to-live value.
296 // |callback| : Called when the configuretion operation is done.
297 static void setMulticastTimeToLive(
298 long socketId,
299 long ttl,
300 SetMulticastTimeToLiveCallback callback);
301
302 // Set the whether multicast diagrams sent from the host to the multicast
303 // group will be looped back to the host.
304 //
305 // Calling this method does not require multicast permissions.
306 // |socketId| : The socketId.
307 // |enabled| : Indicate whether to enable loop back mode.
308 // |callback| : Called when the configuretion operation is done.
309 static void setMulticastLoopbackMode(
310 long socketId,
311 boolean enabled,
312 SetMulticastLoopbackModeCallback callback);
313
314 // Get the multicast group addresses the socket is currently joined to.
315 // |socketId| : The socketId.
316 // |callback| : Called with an array of strings of the result.
317 static void getJoinedGroups(long socketId,
318 GetJoinedGroupsCallback callback);
253 }; 319 };
254 320
255 }; 321 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698