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

Side by Side Diff: extensions/common/api/sockets_udp.idl

Issue 2378763003: Add ability to reuse address in chrome.sockets.udp
Patch Set: Respond to code reviews, clean up tests Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.sockets.udp</code> API to send and receive data over the 5 // Use the <code>chrome.sockets.udp</code> API to send and receive data over the
6 // network using UDP connections. This API supersedes the UDP functionality 6 // network using UDP connections. This API supersedes the UDP functionality
7 // previously found in the "socket" API. 7 // previously found in the "socket" API.
8 namespace sockets.udp { 8 namespace sockets.udp {
9 // The socket properties specified in the <code>create</code> or 9 // The socket properties specified in the <code>create</code> or
10 // <code>update</code> function. Each property is optional. If a property 10 // <code>update</code> function. Each property is optional. If a property
11 // value is not specified, a default value is used when calling 11 // value is not specified, a default value is used when calling
12 // <code>create</code>, or the existing value if preserved when calling 12 // <code>create</code>, or the existing value if preserved when calling
13 // <code>update</code>. 13 // <code>update</code>.
14 dictionary SocketProperties { 14 dictionary SocketProperties {
15 // Flag indicating if the socket is left open when the event page of the 15 // Flag indicating if the socket is left open when the event page of the
16 // application is unloaded (see 16 // application is unloaded (see
17 // <a href="http://developer.chrome.com/apps/app_lifecycle.html">Manage App 17 // <a href="http://developer.chrome.com/apps/app_lifecycle.html">Manage App
18 // Lifecycle</a>). The default value is "false." When the application is 18 // Lifecycle</a>). The default value is "false." When the application is
19 // loaded, any sockets previously opened with persistent=true can be fetched 19 // loaded, any sockets previously opened with persistent=true can be fetched
20 // with <code>getSockets</code>. 20 // with <code>getSockets</code>.
21 boolean? persistent; 21 boolean? persistent;
22 22
23 // An application-defined string associated with the socket. 23 // An application-defined string associated with the socket.
24 DOMString? name; 24 DOMString? name;
25 25
26 // The size of the buffer used to receive data. If the buffer is too small 26 // The size of the buffer used to receive data. If the buffer is too small
27 // to receive the UDP packet, data is lost. The default value is 4096. 27 // to receive the UDP packet, data is lost. The default value is 4096.
28 long? bufferSize; 28 long? bufferSize;
29
30 // Flag indicating if the address can be bound by multiple sockets.
31 boolean? allowAddressReuse;
29 }; 32 };
30 33
31 // Result of <code>create</code> call. 34 // Result of <code>create</code> call.
32 dictionary CreateInfo { 35 dictionary CreateInfo {
33 // The ID of the newly created socket. Note that socket IDs created from 36 // The ID of the newly created socket. Note that socket IDs created from
34 // this API are not compatible with socket IDs created from other APIs, such 37 // this API are not compatible with socket IDs created from other APIs, such
35 // as the deprecated <code>$(ref:socket)</code> API. 38 // as the deprecated <code>$(ref:socket)</code> API.
36 long socketId; 39 long socketId;
37 }; 40 };
38 41
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 DOMString? name; 84 DOMString? name;
82 85
83 // The size of the buffer used to receive data. If no buffer size has been 86 // The size of the buffer used to receive data. If no buffer size has been
84 // specified explictly, the value is not provided. 87 // specified explictly, the value is not provided.
85 long? bufferSize; 88 long? bufferSize;
86 89
87 // Flag indicating whether the socket is blocked from firing onReceive 90 // Flag indicating whether the socket is blocked from firing onReceive
88 // events. 91 // events.
89 boolean paused; 92 boolean paused;
90 93
94 // Flag indicating whether the address can be bound by multiple sockets.
95 boolean addressReusable;
96
91 // If the underlying socket is bound, contains its local 97 // If the underlying socket is bound, contains its local
92 // IPv4/6 address. 98 // IPv4/6 address.
93 DOMString? localAddress; 99 DOMString? localAddress;
94 100
95 // If the underlying socket is bound, contains its local port. 101 // If the underlying socket is bound, contains its local port.
96 long? localPort; 102 long? localPort;
97 }; 103 };
98 104
99 // Callback from the <code>getInfo</code> method. 105 // Callback from the <code>getInfo</code> method.
100 // |socketInfo| : Object containing the socket information. 106 // |socketInfo| : Object containing the socket information.
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 static void onReceive(ReceiveInfo info); 318 static void onReceive(ReceiveInfo info);
313 319
314 // Event raised when a network error occured while the runtime was waiting 320 // Event raised when a network error occured while the runtime was waiting
315 // for data on the socket address and port. Once this event is raised, the 321 // for data on the socket address and port. Once this event is raised, the
316 // socket is paused and no more <code>onReceive</code> events will be raised 322 // socket is paused and no more <code>onReceive</code> events will be raised
317 // for this socket until the socket is resumed. 323 // for this socket until the socket is resumed.
318 // |info| : The event data. 324 // |info| : The event data.
319 static void onReceiveError(ReceiveErrorInfo info); 325 static void onReceiveError(ReceiveErrorInfo info);
320 }; 326 };
321 }; 327 };
OLDNEW
« no previous file with comments | « extensions/browser/api/sockets_udp/sockets_udp_api.cc ('k') | extensions/test/data/sockets_udp/api/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698