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

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

Issue 15039012: Add the ability to use AllowAddressReuse for UDP sockets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with master Created 7 years, 6 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
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 callback JoinGroupCallback = void (long result); 117 callback JoinGroupCallback = void (long result);
118 118
119 callback LeaveGroupCallback = void (long result); 119 callback LeaveGroupCallback = void (long result);
120 120
121 callback SetMulticastTimeToLiveCallback = void (long result); 121 callback SetMulticastTimeToLiveCallback = void (long result);
122 122
123 callback SetMulticastLoopbackModeCallback = void (long result); 123 callback SetMulticastLoopbackModeCallback = void (long result);
124 124
125 callback GetJoinedGroupsCallback = void (DOMString[] groups); 125 callback GetJoinedGroupsCallback = void (DOMString[] groups);
126 126
127 callback AllowAddressReuseCallback = void (long result);
128
127 interface Functions { 129 interface Functions {
128 // Creates a socket of the specified type that will connect to the specified 130 // Creates a socket of the specified type that will connect to the specified
129 // remote machine. 131 // remote machine.
130 // |type| : The type of socket to create. Must be <code>tcp</code> or 132 // |type| : The type of socket to create. Must be <code>tcp</code> or
131 // <code>udp</code>. 133 // <code>udp</code>.
132 // |options| : The socket options. 134 // |options| : The socket options.
133 // |callback| : Called when the socket has been created. 135 // |callback| : Called when the socket has been created.
134 static void create(SocketType type, 136 static void create(SocketType type,
135 optional CreateOptions options, 137 optional CreateOptions options,
136 CreateCallback callback); 138 CreateCallback callback);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // Retrieves the state of the given socket. 257 // Retrieves the state of the given socket.
256 // |socketId| : The socketId. 258 // |socketId| : The socketId.
257 // |callback| : Called when the state is available. 259 // |callback| : Called when the state is available.
258 static void getInfo(long socketId, 260 static void getInfo(long socketId,
259 GetInfoCallback callback); 261 GetInfoCallback callback);
260 262
261 // Retrieves information about local adapters on this system. 263 // Retrieves information about local adapters on this system.
262 // |callback| : Called when local adapter information is available. 264 // |callback| : Called when local adapter information is available.
263 static void getNetworkList(GetNetworkCallback callback); 265 static void getNetworkList(GetNetworkCallback callback);
264 266
265 // Join the multicast group and start to receive packets from that group. 267 // Joins the multicast group and start to receive packets from that group.
266 // The socket must be of UDP type and must be bound to a local port 268 // The socket must be of UDP type and must be bound to a local port
267 // before calling this method. 269 // before calling this method.
268 // |socketId| : The socketId. 270 // |socketId| : The socketId.
269 // |address| : The group address to join. Domain names are not supported. 271 // |address| : The group address to join. Domain names are not supported.
270 // |callback| : Called when the join group operation is done with an 272 // |callback| : Called when the join group operation is done with an
271 // integer parameter indicating the platform-independent error code. 273 // integer parameter indicating the platform-independent error code.
272 static void joinGroup(long socketId, 274 static void joinGroup(long socketId,
273 DOMString address, 275 DOMString address,
274 JoinGroupCallback callback); 276 JoinGroupCallback callback);
275 277
276 // Leave the multicast group previously joined using <code>joinGroup</code>. 278 // Leaves the multicast group previously joined using
277 // It's not necessary to leave the multicast group before destroying the 279 // <code>joinGroup</code>. It's not necessary to leave the multicast group
278 // socket or exiting. This is automatically called by the OS. 280 // before destroying the socket or exiting. This is automatically called by
281 // the OS.
279 // 282 //
280 // Leaving the group will prevent the router from sending multicast 283 // Leaving the group will prevent the router from sending multicast
281 // datagrams to the local host, presuming no other process on the host is 284 // datagrams to the local host, presuming no other process on the host is
282 // still joined to the group. 285 // still joined to the group.
283 // 286 //
284 // |socketId| : The socketId. 287 // |socketId| : The socketId.
285 // |address| : The group address to leave. Domain names are not supported. 288 // |address| : The group address to leave. Domain names are not supported.
286 // |callback| : Called when the leave group operation is done with an 289 // |callback| : Called when the leave group operation is done with an
287 // integer parameter indicating the platform-independent error code. 290 // integer parameter indicating the platform-independent error code.
288 static void leaveGroup(long socketId, DOMString address, 291 static void leaveGroup(long socketId, DOMString address,
289 LeaveGroupCallback callback); 292 LeaveGroupCallback callback);
290 293
291 // Set the time-to-live of multicast packets sent to the multicast group. 294 // Sets the time-to-live of multicast packets sent to the multicast group.
292 // 295 //
293 // Calling this method does not require multicast permissions. 296 // Calling this method does not require multicast permissions.
294 // 297 //
295 // |socketId| : The socketId. 298 // |socketId| : The socketId.
296 // |ttl| : The time-to-live value. 299 // |ttl| : The time-to-live value.
297 // |callback| : Called when the configuration operation is done. 300 // |callback| : Called when the configuration operation is done.
298 static void setMulticastTimeToLive( 301 static void setMulticastTimeToLive(
299 long socketId, 302 long socketId,
300 long ttl, 303 long ttl,
301 SetMulticastTimeToLiveCallback callback); 304 SetMulticastTimeToLiveCallback callback);
302 305
303 // Set whether multicast packets sent from the host to the multicast 306 // Sets whether multicast packets sent from the host to the multicast
304 // group will be looped back to the host. 307 // group will be looped back to the host.
305 // 308 //
306 // Note: the behavior of <code>setMulticastLoopbackMode</code> is slightly 309 // Note: the behavior of <code>setMulticastLoopbackMode</code> is slightly
307 // different between Windows and Unix-like systems. The inconsistency 310 // different between Windows and Unix-like systems. The inconsistency
308 // happens only when there is more than one application on the same host 311 // happens only when there is more than one application on the same host
309 // joined to the same multicast group while having different settings on 312 // joined to the same multicast group while having different settings on
310 // multicast loopback mode. On Windows, the applications with loopback off 313 // multicast loopback mode. On Windows, the applications with loopback off
311 // will not RECEIVE the loopback packets; while on Unix-like systems, the 314 // will not RECEIVE the loopback packets; while on Unix-like systems, the
312 // applications with loopback off will not SEND the loopback packets to 315 // applications with loopback off will not SEND the loopback packets to
313 // other applications on the same host. See MSDN: http://goo.gl/6vqbj 316 // other applications on the same host. See MSDN: http://goo.gl/6vqbj
314 // 317 //
315 // Calling this method does not require multicast permissions. 318 // Calling this method does not require multicast permissions.
316 // 319 //
317 // |socketId| : The socketId. 320 // |socketId| : The socketId.
318 // |enabled| : Indicate whether to enable loopback mode. 321 // |enabled| : Indicate whether to enable loopback mode.
319 // |callback| : Called when the configuration operation is done. 322 // |callback| : Called when the configuration operation is done.
320 static void setMulticastLoopbackMode( 323 static void setMulticastLoopbackMode(
321 long socketId, 324 long socketId,
322 boolean enabled, 325 boolean enabled,
323 SetMulticastLoopbackModeCallback callback); 326 SetMulticastLoopbackModeCallback callback);
324 327
325 // Get the multicast group addresses the socket is currently joined to. 328 // Gets the multicast group addresses the socket is currently joined to.
326 // |socketId| : The socketId. 329 // |socketId| : The socketId.
327 // |callback| : Called with an array of strings of the result. 330 // |callback| : Called with an array of strings of the result.
328 static void getJoinedGroups(long socketId, 331 static void getJoinedGroups(long socketId,
329 GetJoinedGroupsCallback callback); 332 GetJoinedGroupsCallback callback);
333
334 // Allows a UDP socket to bind to an already-bound address. Note that
335 // binding two sockets to the same address leads to undefined behavior for
336 // packets not sent to a broadcast or multicast address.
337 // |callback| : Called when the operation is done.
338 static void allowAddressReuse(long socketId,
339 AllowAddressReuseCallback callback);
330 }; 340 };
331 341
332 }; 342 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698