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

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

Issue 10790137: Adds socket.getInfo to the socket API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Broke apart local/peer into localAddress,localPort peerAddress,peerPort, and updated the docs Created 8 years, 5 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 // File-level comment to appease parser. Eventually this will not be necessary. 5 // File-level comment to appease parser. Eventually this will not be necessary.
6 6
7 namespace experimental.socket { 7 namespace experimental.socket {
8 enum SocketType { 8 enum SocketType {
9 tcp, 9 tcp,
10 udp 10 udp
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 long resultCode; 49 long resultCode;
50 50
51 ArrayBuffer data; 51 ArrayBuffer data;
52 52
53 // The address of the remote machine. 53 // The address of the remote machine.
54 DOMString address; 54 DOMString address;
55 55
56 long port; 56 long port;
57 }; 57 };
58 58
59 dictionary SocketInfo {
60 // The type of the passed socket. This will be code <code>tcp</code> or
benwells 2012/07/26 04:18:37 In "This will be code <code>tcp..." is the first c
thorogood 2012/07/26 06:19:50 Typo, thanks.
61 // <code>udp</code>.
62 SocketType socketType;
63
64 // Whether this socket is currently connected.
65 boolean connected;
66
67 // If this socket is connected, contains the IPv4/6 address of the peer.
68 DOMString? peerAddress;
69
70 // Optionally contains the port of the connected peer.
benwells 2012/07/26 04:18:37 As this is a return value optional is unclear. You
thorogood 2012/07/26 06:19:50 Done.
71 long? peerPort;
72
73 // If this socket is bound or connected, contains its local IPv4/6 address.
74 DOMString? localAddress;
75
76 // Optionally contains the local port.
benwells 2012/07/26 04:18:37 Same re optional
thorogood 2012/07/26 06:19:50 Done.
77 long? localPort;
78 };
79
59 callback RecvFromCallback = void (RecvFromInfo recvFromInfo); 80 callback RecvFromCallback = void (RecvFromInfo recvFromInfo);
60 81
61 callback SendToCallback = void (WriteInfo writeInfo); 82 callback SendToCallback = void (WriteInfo writeInfo);
62 83
63 callback SetKeepAliveCallback = void (boolean result); 84 callback SetKeepAliveCallback = void (boolean result);
64 85
65 callback SetNoDelayCallback = void (boolean result); 86 callback SetNoDelayCallback = void (boolean result);
66 87
88 callback GetInfoCallback = void (SocketInfo result);
89
67 interface Functions { 90 interface Functions {
68 // Creates a socket of the specified type that will connect to the specified 91 // Creates a socket of the specified type that will connect to the specified
69 // remote machine. 92 // remote machine.
70 // |type| : The type of socket to create. Must be <code>tcp</code> or 93 // |type| : The type of socket to create. Must be <code>tcp</code> or
71 // <code>udp</code>. 94 // <code>udp</code>.
72 // |options| : The socket options. 95 // |options| : The socket options.
73 // |callback| : Called when the socket has been created. 96 // |callback| : Called when the socket has been created.
74 static void create(SocketType type, 97 static void create(SocketType type,
75 optional CreateOptions options, 98 optional CreateOptions options,
76 CreateCallback callback); 99 CreateCallback callback);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 optional long delay, 178 optional long delay,
156 SetKeepAliveCallback callback); 179 SetKeepAliveCallback callback);
157 180
158 // Enable/disable Nagle algorithm. 181 // Enable/disable Nagle algorithm.
159 // |socketId| : The socketId. 182 // |socketId| : The socketId.
160 // |noDelay| : If true, disable Nagle algorithm. 183 // |noDelay| : If true, disable Nagle algorithm.
161 // |callback| : Called when the setNoDelay attempt is complete. 184 // |callback| : Called when the setNoDelay attempt is complete.
162 static void setNoDelay(long socketId, 185 static void setNoDelay(long socketId,
163 boolean noDelay, 186 boolean noDelay,
164 SetNoDelayCallback callback); 187 SetNoDelayCallback callback);
188
189 // Retrieve the state of the given socket.
190 // |socketId| : The socketId.
191 // |callback| : Called when the state is available.
192 static void getInfo(long socketId,
193 GetInfoCallback callback);
165 }; 194 };
166 195
167 }; 196 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698