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

Side by Side Diff: ppapi/c/ppb_udp_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, 1 month 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 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_udp_socket.idl modified Sat Jun 22 10:56:26 2013. */ 6 /* From ppb_udp_socket.idl modified Fri Nov 7 17:59:50 2014. */
7 7
8 #ifndef PPAPI_C_PPB_UDP_SOCKET_H_ 8 #ifndef PPAPI_C_PPB_UDP_SOCKET_H_
9 #define PPAPI_C_PPB_UDP_SOCKET_H_ 9 #define PPAPI_C_PPB_UDP_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_UDPSOCKET_INTERFACE_1_0 "PPB_UDPSocket;1.0" 19 #define PPB_UDPSOCKET_INTERFACE_1_0 "PPB_UDPSocket;1.0"
20 #define PPB_UDPSOCKET_INTERFACE PPB_UDPSOCKET_INTERFACE_1_0 20 #define PPB_UDPSOCKET_INTERFACE_1_1 "PPB_UDPSocket;1.1"
21 #define PPB_UDPSOCKET_INTERFACE PPB_UDPSOCKET_INTERFACE_1_1
21 22
22 /** 23 /**
23 * @file 24 * @file
24 * This file defines the <code>PPB_UDPSocket</code> interface. 25 * This file defines the <code>PPB_UDPSocket</code> interface.
25 */ 26 */
26 27
27 28
28 /** 29 /**
29 * @addtogroup Enums 30 * @addtogroup Enums
30 * @{ 31 * @{
31 */ 32 */
32 /** 33 /**
33 * Option names used by <code>SetOption()</code>. 34 * Option names used by <code>SetOption()</code>.
34 */ 35 */
35 typedef enum { 36 typedef enum {
36 /** 37 /**
37 * Allows the socket to share the local address to which it will be bound with 38 * Allows the socket to share the local address to which it will be bound with
38 * other processes. Value's type should be <code>PP_VARTYPE_BOOL</code>. 39 * other processes. Value's type should be <code>PP_VARTYPE_BOOL</code>.
39 * This option can only be set before calling <code>Bind()</code>. 40 * On version 1.0, this option can only be set before calling
41 * <code>Bind()</code>. On version 1.1 or later, there is no such limitation.
40 */ 42 */
41 PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, 43 PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0,
42 /** 44 /**
43 * Allows sending and receiving packets to and from broadcast addresses. 45 * Allows sending and receiving packets to and from broadcast addresses.
44 * Value's type should be <code>PP_VARTYPE_BOOL</code>. 46 * Value's type should be <code>PP_VARTYPE_BOOL</code>.
45 * This option can only be set before calling <code>Bind()</code>. 47 * On version 1.0, this option can only be set before calling
48 * <code>Bind()</code>. On version 1.1 or later, there is no such limitation.
46 */ 49 */
47 PP_UDPSOCKET_OPTION_BROADCAST = 1, 50 PP_UDPSOCKET_OPTION_BROADCAST = 1,
48 /** 51 /**
49 * Specifies the total per-socket buffer space reserved for sends. Value's 52 * Specifies the total per-socket buffer space reserved for sends. Value's
50 * type should be <code>PP_VARTYPE_INT32</code>. 53 * type should be <code>PP_VARTYPE_INT32</code>.
51 * This option can only be set after a successful <code>Bind()</code> call. 54 * On version 1.0, this option can only be set after a successful
55 * <code>Bind()</code> call. On version 1.1 or later, there is no such
56 * limitation.
52 * 57 *
53 * Note: This is only treated as a hint for the browser to set the buffer 58 * Note: This is only treated as a hint for the browser to set the buffer
54 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't 59 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't
55 * guarantee it will conform to the size. 60 * guarantee it will conform to the size.
56 */ 61 */
57 PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, 62 PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2,
58 /** 63 /**
59 * Specifies the total per-socket buffer space reserved for receives. Value's 64 * Specifies the total per-socket buffer space reserved for receives. Value's
60 * type should be <code>PP_VARTYPE_INT32</code>. 65 * type should be <code>PP_VARTYPE_INT32</code>.
61 * This option can only be set after a successful <code>Bind()</code> call. 66 * On version 1.0, this option can only be set after a successful
67 * <code>Bind()</code> call. On version 1.1 or later, there is no such
68 * limitation.
62 * 69 *
63 * Note: This is only treated as a hint for the browser to set the buffer 70 * Note: This is only treated as a hint for the browser to set the buffer
64 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't 71 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't
65 * guarantee it will conform to the size. 72 * guarantee it will conform to the size.
66 */ 73 */
67 PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3 74 PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3
68 } PP_UDPSocket_Option; 75 } PP_UDPSocket_Option;
69 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_UDPSocket_Option, 4); 76 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_UDPSocket_Option, 4);
70 /** 77 /**
71 * @} 78 * @}
72 */ 79 */
73 80
74 /** 81 /**
75 * @addtogroup Interfaces 82 * @addtogroup Interfaces
76 * @{ 83 * @{
77 */ 84 */
78 /** 85 /**
79 * The <code>PPB_UDPSocket</code> interface provides UDP socket operations. 86 * The <code>PPB_UDPSocket</code> interface provides UDP socket operations.
80 * 87 *
81 * Permissions: Apps permission <code>socket</code> with subrule 88 * Permissions: Apps permission <code>socket</code> with subrule
82 * <code>udp-bind</code> is required for <code>Bind()</code>; subrule 89 * <code>udp-bind</code> is required for <code>Bind()</code>; subrule
83 * <code>udp-send-to</code> is required for <code>SendTo()</code>. 90 * <code>udp-send-to</code> is required for <code>SendTo()</code>.
84 * For more details about network communication permissions, please see: 91 * For more details about network communication permissions, please see:
85 * http://developer.chrome.com/apps/app_network.html 92 * http://developer.chrome.com/apps/app_network.html
86 */ 93 */
87 struct PPB_UDPSocket_1_0 { 94 struct PPB_UDPSocket_1_1 {
88 /** 95 /**
89 * Creates a UDP socket resource. 96 * Creates a UDP socket resource.
90 * 97 *
91 * @param[in] instance A <code>PP_Instance</code> identifying one instance of 98 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
92 * a module. 99 * a module.
93 * 100 *
94 * @return A <code>PP_Resource</code> corresponding to a UDP socket or 0 101 * @return A <code>PP_Resource</code> corresponding to a UDP socket or 0
95 * on failure. 102 * on failure.
96 */ 103 */
97 PP_Resource (*Create)(PP_Instance instance); 104 PP_Resource (*Create)(PP_Instance instance);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 * completion. 208 * completion.
202 * 209 *
203 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 210 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
204 */ 211 */
205 int32_t (*SetOption)(PP_Resource udp_socket, 212 int32_t (*SetOption)(PP_Resource udp_socket,
206 PP_UDPSocket_Option name, 213 PP_UDPSocket_Option name,
207 struct PP_Var value, 214 struct PP_Var value,
208 struct PP_CompletionCallback callback); 215 struct PP_CompletionCallback callback);
209 }; 216 };
210 217
211 typedef struct PPB_UDPSocket_1_0 PPB_UDPSocket; 218 typedef struct PPB_UDPSocket_1_1 PPB_UDPSocket;
219
220 struct PPB_UDPSocket_1_0 {
221 PP_Resource (*Create)(PP_Instance instance);
222 PP_Bool (*IsUDPSocket)(PP_Resource resource);
223 int32_t (*Bind)(PP_Resource udp_socket,
224 PP_Resource addr,
225 struct PP_CompletionCallback callback);
226 PP_Resource (*GetBoundAddress)(PP_Resource udp_socket);
227 int32_t (*RecvFrom)(PP_Resource udp_socket,
228 char* buffer,
229 int32_t num_bytes,
230 PP_Resource* addr,
231 struct PP_CompletionCallback callback);
232 int32_t (*SendTo)(PP_Resource udp_socket,
233 const char* buffer,
234 int32_t num_bytes,
235 PP_Resource addr,
236 struct PP_CompletionCallback callback);
237 void (*Close)(PP_Resource udp_socket);
238 int32_t (*SetOption)(PP_Resource udp_socket,
239 PP_UDPSocket_Option name,
240 struct PP_Var value,
241 struct PP_CompletionCallback callback);
242 };
212 /** 243 /**
213 * @} 244 * @}
214 */ 245 */
215 246
216 #endif /* PPAPI_C_PPB_UDP_SOCKET_H_ */ 247 #endif /* PPAPI_C_PPB_UDP_SOCKET_H_ */
217 248
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698