OLD | NEW |
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 dev/ppb_tcp_socket_dev.idl modified Thu Jun 20 15:14:26 2013. */ | 6 /* From ppb_tcp_socket.idl modified Sat Jun 22 11:17:34 2013. */ |
7 | 7 |
8 #ifndef PPAPI_C_DEV_PPB_TCP_SOCKET_DEV_H_ | 8 #ifndef PPAPI_C_PPB_TCP_SOCKET_H_ |
9 #define PPAPI_C_DEV_PPB_TCP_SOCKET_DEV_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_DEV_INTERFACE_0_1 "PPB_TCPSocket(Dev);0.1" | 19 #define PPB_TCPSOCKET_INTERFACE_1_0 "PPB_TCPSocket;1.0" |
20 #define PPB_TCPSOCKET_DEV_INTERFACE PPB_TCPSOCKET_DEV_INTERFACE_0_1 | 20 #define PPB_TCPSOCKET_INTERFACE PPB_TCPSOCKET_INTERFACE_1_0 |
21 | 21 |
22 /** | 22 /** |
23 * @file | 23 * @file |
24 * This file defines the <code>PPB_TCPSocket_Dev</code> interface. | 24 * This file defines the <code>PPB_TCPSocket</code> interface. |
25 */ | 25 */ |
26 | 26 |
27 | 27 |
28 /** | 28 /** |
29 * @addtogroup Enums | 29 * @addtogroup Enums |
30 * @{ | 30 * @{ |
31 */ | 31 */ |
32 /** | 32 /** |
33 * Option names used by <code>SetOption()</code>. | 33 * Option names used by <code>SetOption()</code>. |
34 */ | 34 */ |
(...skipping 17 matching lines...) Expand all Loading... |
52 /** | 52 /** |
53 * Specifies the total per-socket buffer space reserved for receives. Value's | 53 * Specifies the total per-socket buffer space reserved for receives. Value's |
54 * type should be <code>PP_VARTYPE_INT32</code>. | 54 * type should be <code>PP_VARTYPE_INT32</code>. |
55 * This option can only be set after a successful <code>Connect()</code> call. | 55 * This option can only be set after a successful <code>Connect()</code> call. |
56 * | 56 * |
57 * Note: This is only treated as a hint for the browser to set the buffer | 57 * Note: This is only treated as a hint for the browser to set the buffer |
58 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't | 58 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't |
59 * guarantee it will conform to the size. | 59 * guarantee it will conform to the size. |
60 */ | 60 */ |
61 PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2 | 61 PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2 |
62 } PP_TCPSocket_Option_Dev; | 62 } PP_TCPSocket_Option; |
63 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocket_Option_Dev, 4); | 63 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocket_Option, 4); |
64 /** | 64 /** |
65 * @} | 65 * @} |
66 */ | 66 */ |
67 | 67 |
68 /** | 68 /** |
69 * @addtogroup Interfaces | 69 * @addtogroup Interfaces |
70 * @{ | 70 * @{ |
71 */ | 71 */ |
72 /** | 72 /** |
73 * The <code>PPB_TCPSocket_Dev</code> interface provides TCP socket operations. | 73 * The <code>PPB_TCPSocket</code> interface provides TCP socket operations. |
74 * | 74 * |
75 * Permissions: Apps permission <code>socket</code> with subrule | 75 * Permissions: Apps permission <code>socket</code> with subrule |
76 * <code>tcp-connect</code> is required for <code>Connect()</code>. | 76 * <code>tcp-connect</code> is required for <code>Connect()</code>. |
77 * For more details about network communication permissions, please see: | 77 * For more details about network communication permissions, please see: |
78 * http://developer.chrome.com/apps/app_network.html | 78 * http://developer.chrome.com/apps/app_network.html |
79 */ | 79 */ |
80 struct PPB_TCPSocket_Dev_0_1 { | 80 struct PPB_TCPSocket_1_0 { |
81 /** | 81 /** |
82 * Creates a TCP socket resource. | 82 * Creates a TCP socket resource. |
83 * | 83 * |
84 * @param[in] instance A <code>PP_Instance</code> identifying one instance of | 84 * @param[in] instance A <code>PP_Instance</code> identifying one instance of |
85 * a module. | 85 * a module. |
86 * | 86 * |
87 * @return A <code>PP_Resource</code> corresponding to a TCP socket or 0 | 87 * @return A <code>PP_Resource</code> corresponding to a TCP socket or 0 |
88 * on failure. | 88 * on failure. |
89 */ | 89 */ |
90 PP_Resource (*Create)(PP_Instance instance); | 90 PP_Resource (*Create)(PP_Instance instance); |
91 /** | 91 /** |
92 * Determines if a given resource is a TCP socket. | 92 * Determines if a given resource is a TCP socket. |
93 * | 93 * |
94 * @param[in] resource A <code>PP_Resource</code> to check. | 94 * @param[in] resource A <code>PP_Resource</code> to check. |
95 * | 95 * |
96 * @return <code>PP_TRUE</code> if the input is a | 96 * @return <code>PP_TRUE</code> if the input is a |
97 * <code>PPB_TCPSocket_Dev</code> resource; <code>PP_FALSE</code> | 97 * <code>PPB_TCPSocket</code> resource; <code>PP_FALSE</code> otherwise. |
98 * otherwise. | |
99 */ | 98 */ |
100 PP_Bool (*IsTCPSocket)(PP_Resource resource); | 99 PP_Bool (*IsTCPSocket)(PP_Resource resource); |
101 /** | 100 /** |
102 * Connects the socket to the given address. | 101 * Connects the socket to the given address. |
103 * | 102 * |
104 * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP | 103 * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP |
105 * socket. | 104 * socket. |
106 * @param[in] addr A <code>PPB_NetAddress</code> resource. | 105 * @param[in] addr A <code>PPB_NetAddress</code> resource. |
107 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 106 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
108 * completion. | 107 * completion. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 * | 186 * |
188 * The socket is implicitly closed if it is destroyed, so you are not required | 187 * The socket is implicitly closed if it is destroyed, so you are not required |
189 * to call this method. | 188 * to call this method. |
190 * | 189 * |
191 * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP | 190 * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP |
192 * socket. | 191 * socket. |
193 */ | 192 */ |
194 void (*Close)(PP_Resource tcp_socket); | 193 void (*Close)(PP_Resource tcp_socket); |
195 /** | 194 /** |
196 * Sets a socket option on the TCP socket. | 195 * Sets a socket option on the TCP socket. |
197 * Please see the <code>PP_TCPSocket_Option_Dev</code> description for option | 196 * Please see the <code>PP_TCPSocket_Option</code> description for option |
198 * names, value types and allowed values. | 197 * names, value types and allowed values. |
199 * | 198 * |
200 * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP | 199 * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP |
201 * socket. | 200 * socket. |
202 * @param[in] name The option to set. | 201 * @param[in] name The option to set. |
203 * @param[in] value The option value to set. | 202 * @param[in] value The option value to set. |
204 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 203 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
205 * completion. | 204 * completion. |
206 * | 205 * |
207 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 206 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
208 */ | 207 */ |
209 int32_t (*SetOption)(PP_Resource tcp_socket, | 208 int32_t (*SetOption)(PP_Resource tcp_socket, |
210 PP_TCPSocket_Option_Dev name, | 209 PP_TCPSocket_Option name, |
211 struct PP_Var value, | 210 struct PP_Var value, |
212 struct PP_CompletionCallback callback); | 211 struct PP_CompletionCallback callback); |
213 }; | 212 }; |
214 | 213 |
215 typedef struct PPB_TCPSocket_Dev_0_1 PPB_TCPSocket_Dev; | 214 typedef struct PPB_TCPSocket_1_0 PPB_TCPSocket; |
216 /** | 215 /** |
217 * @} | 216 * @} |
218 */ | 217 */ |
219 | 218 |
220 #endif /* PPAPI_C_DEV_PPB_TCP_SOCKET_DEV_H_ */ | 219 #endif /* PPAPI_C_PPB_TCP_SOCKET_H_ */ |
221 | 220 |
OLD | NEW |