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

Side by Side Diff: ppapi/c/ppb_tcp_socket.h

Issue 690903002: Remove timing limitation of SetOption invocation for PPAPI sockets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « ppapi/api/ppb_udp_socket.idl ('k') | ppapi/c/ppb_udp_socket.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright 2013 The Chromium Authors. All rights reserved. 1 /* Copyright 2013 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 5
6 /* From ppb_tcp_socket.idl modified Fri Sep 20 09:58:19 2013. */ 6 /* From ppb_tcp_socket.idl modified Mon Dec 8 16:50:44 2014. */
7 7
8 #ifndef PPAPI_C_PPB_TCP_SOCKET_H_ 8 #ifndef PPAPI_C_PPB_TCP_SOCKET_H_
9 #define PPAPI_C_PPB_TCP_SOCKET_H_ 9 #define PPAPI_C_PPB_TCP_SOCKET_H_
10 10
11 #include "ppapi/c/pp_bool.h" 11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_completion_callback.h" 12 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_instance.h" 13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_macros.h" 14 #include "ppapi/c/pp_macros.h"
15 #include "ppapi/c/pp_resource.h" 15 #include "ppapi/c/pp_resource.h"
16 #include "ppapi/c/pp_stdint.h" 16 #include "ppapi/c/pp_stdint.h"
17 #include "ppapi/c/pp_var.h" 17 #include "ppapi/c/pp_var.h"
18 18
19 #define PPB_TCPSOCKET_INTERFACE_1_0 "PPB_TCPSocket;1.0" 19 #define PPB_TCPSOCKET_INTERFACE_1_0 "PPB_TCPSocket;1.0"
20 #define PPB_TCPSOCKET_INTERFACE_1_1 "PPB_TCPSocket;1.1" 20 #define PPB_TCPSOCKET_INTERFACE_1_1 "PPB_TCPSocket;1.1"
21 #define PPB_TCPSOCKET_INTERFACE PPB_TCPSOCKET_INTERFACE_1_1 21 #define PPB_TCPSOCKET_INTERFACE_1_2 "PPB_TCPSocket;1.2"
22 #define PPB_TCPSOCKET_INTERFACE PPB_TCPSOCKET_INTERFACE_1_2
22 23
23 /** 24 /**
24 * @file 25 * @file
25 * This file defines the <code>PPB_TCPSocket</code> interface. 26 * This file defines the <code>PPB_TCPSocket</code> interface.
26 */ 27 */
27 28
28 29
29 /** 30 /**
30 * @addtogroup Enums 31 * @addtogroup Enums
31 * @{ 32 * @{
32 */ 33 */
33 /** 34 /**
34 * Option names used by <code>SetOption()</code>. 35 * Option names used by <code>SetOption()</code>.
35 */ 36 */
36 typedef enum { 37 typedef enum {
37 /** 38 /**
38 * Disables coalescing of small writes to make TCP segments, and instead 39 * Disables coalescing of small writes to make TCP segments, and instead
39 * delivers data immediately. Value's type is <code>PP_VARTYPE_BOOL</code>. 40 * delivers data immediately. Value's type is <code>PP_VARTYPE_BOOL</code>.
40 * This option can only be set after a successful <code>Connect()</code> call. 41 * On version 1.1 or earlier, this option can only be set after a successful
42 * <code>Connect()</code> call. On version 1.2 or later, there is no such
43 * limitation.
41 */ 44 */
42 PP_TCPSOCKET_OPTION_NO_DELAY = 0, 45 PP_TCPSOCKET_OPTION_NO_DELAY = 0,
43 /** 46 /**
44 * Specifies the total per-socket buffer space reserved for sends. Value's 47 * Specifies the total per-socket buffer space reserved for sends. Value's
45 * type should be <code>PP_VARTYPE_INT32</code>. 48 * type should be <code>PP_VARTYPE_INT32</code>.
46 * This option can only be set after a successful <code>Connect()</code> call. 49 * On version 1.1 or earlier, this option can only be set after a successful
50 * <code>Connect()</code> call. On version 1.2 or later, there is no such
51 * limitation.
47 * 52 *
48 * Note: This is only treated as a hint for the browser to set the buffer 53 * Note: This is only treated as a hint for the browser to set the buffer
49 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't 54 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't
50 * guarantee it will conform to the size. 55 * guarantee it will conform to the size.
51 */ 56 */
52 PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE = 1, 57 PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE = 1,
53 /** 58 /**
54 * Specifies the total per-socket buffer space reserved for receives. Value's 59 * Specifies the total per-socket buffer space reserved for receives. Value's
55 * type should be <code>PP_VARTYPE_INT32</code>. 60 * type should be <code>PP_VARTYPE_INT32</code>.
56 * This option can only be set after a successful <code>Connect()</code> call. 61 * On version 1.1 or earlier, this option can only be set after a successful
62 * <code>Connect()</code> call. On version 1.2 or later, there is no such
63 * limitation.
57 * 64 *
58 * Note: This is only treated as a hint for the browser to set the buffer 65 * Note: This is only treated as a hint for the browser to set the buffer
59 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't 66 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't
60 * guarantee it will conform to the size. 67 * guarantee it will conform to the size.
61 */ 68 */
62 PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2 69 PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2
63 } PP_TCPSocket_Option; 70 } PP_TCPSocket_Option;
64 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocket_Option, 4); 71 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocket_Option, 4);
65 /** 72 /**
66 * @} 73 * @}
67 */ 74 */
68 75
69 /** 76 /**
70 * @addtogroup Interfaces 77 * @addtogroup Interfaces
71 * @{ 78 * @{
72 */ 79 */
73 /** 80 /**
74 * The <code>PPB_TCPSocket</code> interface provides TCP socket operations. 81 * The <code>PPB_TCPSocket</code> interface provides TCP socket operations.
75 * 82 *
76 * Permissions: Apps permission <code>socket</code> with subrule 83 * Permissions: Apps permission <code>socket</code> with subrule
77 * <code>tcp-connect</code> is required for <code>Connect()</code>; subrule 84 * <code>tcp-connect</code> is required for <code>Connect()</code>; subrule
78 * <code>tcp-listen</code> is required for <code>Listen()</code>. 85 * <code>tcp-listen</code> is required for <code>Listen()</code>.
79 * For more details about network communication permissions, please see: 86 * For more details about network communication permissions, please see:
80 * http://developer.chrome.com/apps/app_network.html 87 * http://developer.chrome.com/apps/app_network.html
81 */ 88 */
82 struct PPB_TCPSocket_1_1 { 89 struct PPB_TCPSocket_1_2 {
83 /** 90 /**
84 * Creates a TCP socket resource. 91 * Creates a TCP socket resource.
85 * 92 *
86 * @param[in] instance A <code>PP_Instance</code> identifying one instance of 93 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
87 * a module. 94 * a module.
88 * 95 *
89 * @return A <code>PP_Resource</code> corresponding to a TCP socket or 0 96 * @return A <code>PP_Resource</code> corresponding to a TCP socket or 0
90 * on failure. 97 * on failure.
91 */ 98 */
92 PP_Resource (*Create)(PP_Instance instance); 99 PP_Resource (*Create)(PP_Instance instance);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 * completion. 273 * completion.
267 * 274 *
268 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 275 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
269 */ 276 */
270 int32_t (*SetOption)(PP_Resource tcp_socket, 277 int32_t (*SetOption)(PP_Resource tcp_socket,
271 PP_TCPSocket_Option name, 278 PP_TCPSocket_Option name,
272 struct PP_Var value, 279 struct PP_Var value,
273 struct PP_CompletionCallback callback); 280 struct PP_CompletionCallback callback);
274 }; 281 };
275 282
276 typedef struct PPB_TCPSocket_1_1 PPB_TCPSocket; 283 typedef struct PPB_TCPSocket_1_2 PPB_TCPSocket;
277 284
278 struct PPB_TCPSocket_1_0 { 285 struct PPB_TCPSocket_1_0 {
279 PP_Resource (*Create)(PP_Instance instance); 286 PP_Resource (*Create)(PP_Instance instance);
280 PP_Bool (*IsTCPSocket)(PP_Resource resource); 287 PP_Bool (*IsTCPSocket)(PP_Resource resource);
281 int32_t (*Connect)(PP_Resource tcp_socket, 288 int32_t (*Connect)(PP_Resource tcp_socket,
282 PP_Resource addr, 289 PP_Resource addr,
283 struct PP_CompletionCallback callback); 290 struct PP_CompletionCallback callback);
284 PP_Resource (*GetLocalAddress)(PP_Resource tcp_socket); 291 PP_Resource (*GetLocalAddress)(PP_Resource tcp_socket);
285 PP_Resource (*GetRemoteAddress)(PP_Resource tcp_socket); 292 PP_Resource (*GetRemoteAddress)(PP_Resource tcp_socket);
286 int32_t (*Read)(PP_Resource tcp_socket, 293 int32_t (*Read)(PP_Resource tcp_socket,
287 char* buffer, 294 char* buffer,
288 int32_t bytes_to_read, 295 int32_t bytes_to_read,
289 struct PP_CompletionCallback callback); 296 struct PP_CompletionCallback callback);
290 int32_t (*Write)(PP_Resource tcp_socket, 297 int32_t (*Write)(PP_Resource tcp_socket,
291 const char* buffer, 298 const char* buffer,
292 int32_t bytes_to_write, 299 int32_t bytes_to_write,
293 struct PP_CompletionCallback callback); 300 struct PP_CompletionCallback callback);
294 void (*Close)(PP_Resource tcp_socket); 301 void (*Close)(PP_Resource tcp_socket);
295 int32_t (*SetOption)(PP_Resource tcp_socket, 302 int32_t (*SetOption)(PP_Resource tcp_socket,
296 PP_TCPSocket_Option name, 303 PP_TCPSocket_Option name,
297 struct PP_Var value, 304 struct PP_Var value,
298 struct PP_CompletionCallback callback); 305 struct PP_CompletionCallback callback);
299 }; 306 };
307
308 struct PPB_TCPSocket_1_1 {
309 PP_Resource (*Create)(PP_Instance instance);
310 PP_Bool (*IsTCPSocket)(PP_Resource resource);
311 int32_t (*Bind)(PP_Resource tcp_socket,
312 PP_Resource addr,
313 struct PP_CompletionCallback callback);
314 int32_t (*Connect)(PP_Resource tcp_socket,
315 PP_Resource addr,
316 struct PP_CompletionCallback callback);
317 PP_Resource (*GetLocalAddress)(PP_Resource tcp_socket);
318 PP_Resource (*GetRemoteAddress)(PP_Resource tcp_socket);
319 int32_t (*Read)(PP_Resource tcp_socket,
320 char* buffer,
321 int32_t bytes_to_read,
322 struct PP_CompletionCallback callback);
323 int32_t (*Write)(PP_Resource tcp_socket,
324 const char* buffer,
325 int32_t bytes_to_write,
326 struct PP_CompletionCallback callback);
327 int32_t (*Listen)(PP_Resource tcp_socket,
328 int32_t backlog,
329 struct PP_CompletionCallback callback);
330 int32_t (*Accept)(PP_Resource tcp_socket,
331 PP_Resource* accepted_tcp_socket,
332 struct PP_CompletionCallback callback);
333 void (*Close)(PP_Resource tcp_socket);
334 int32_t (*SetOption)(PP_Resource tcp_socket,
335 PP_TCPSocket_Option name,
336 struct PP_Var value,
337 struct PP_CompletionCallback callback);
338 };
300 /** 339 /**
301 * @} 340 * @}
302 */ 341 */
303 342
304 #endif /* PPAPI_C_PPB_TCP_SOCKET_H_ */ 343 #endif /* PPAPI_C_PPB_TCP_SOCKET_H_ */
305 344
OLDNEW
« no previous file with comments | « ppapi/api/ppb_udp_socket.idl ('k') | ppapi/c/ppb_udp_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698