OLD | NEW |
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 | 5 |
6 /* From private/ppb_tcp_socket_private.idl modified Fri Apr 6 14:42:45 2012. */ | 6 /* From private/ppb_tcp_socket_private.idl modified Thu Feb 7 11:30:43 2013. */ |
7 | 7 |
8 #ifndef PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ | 8 #ifndef PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ |
9 #define PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ | 9 #define PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_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/private/ppb_net_address_private.h" | 18 #include "ppapi/c/private/ppb_net_address_private.h" |
18 | 19 |
19 #define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_3 "PPB_TCPSocket_Private;0.3" | 20 #define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_3 "PPB_TCPSocket_Private;0.3" |
20 #define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4 "PPB_TCPSocket_Private;0.4" | 21 #define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4 "PPB_TCPSocket_Private;0.4" |
21 #define PPB_TCPSOCKET_PRIVATE_INTERFACE PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4 | 22 #define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_5 "PPB_TCPSocket_Private;0.5" |
| 23 #define PPB_TCPSOCKET_PRIVATE_INTERFACE PPB_TCPSOCKET_PRIVATE_INTERFACE_0_5 |
22 | 24 |
23 /** | 25 /** |
24 * @file | 26 * @file |
25 * This file defines the <code>PPB_TCPSocket_Private</code> interface. | 27 * This file defines the <code>PPB_TCPSocket_Private</code> interface. |
26 */ | 28 */ |
27 | 29 |
28 | 30 |
29 /** | 31 /** |
| 32 * @addtogroup Enums |
| 33 * @{ |
| 34 */ |
| 35 typedef enum { |
| 36 /* Disable coalescing of small writes to make TCP segments, and instead |
| 37 * deliver data immediately. Value type is PP_VARTYPE_BOOL. */ |
| 38 PP_TCPSOCKETFEATURE_NO_DELAY = 0, |
| 39 /* Special value used for testing. Guaranteed to fail SetSocketFeature(). */ |
| 40 PP_TCPSOCKETFEATURE_INVALID = -1 |
| 41 } PP_TCPSocketFeature_Private; |
| 42 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocketFeature_Private, 4); |
| 43 /** |
| 44 * @} |
| 45 */ |
| 46 |
| 47 /** |
30 * @addtogroup Interfaces | 48 * @addtogroup Interfaces |
31 * @{ | 49 * @{ |
32 */ | 50 */ |
33 /** | 51 /** |
34 * The <code>PPB_TCPSocket_Private</code> interface provides TCP socket | 52 * The <code>PPB_TCPSocket_Private</code> interface provides TCP socket |
35 * operations. | 53 * operations. |
36 */ | 54 */ |
37 struct PPB_TCPSocket_Private_0_4 { | 55 struct PPB_TCPSocket_Private_0_5 { |
38 /** | 56 /** |
39 * Allocates a TCP socket resource. | 57 * Allocates a TCP socket resource. |
40 */ | 58 */ |
41 PP_Resource (*Create)(PP_Instance instance); | 59 PP_Resource (*Create)(PP_Instance instance); |
42 /** | 60 /** |
43 * Determines if a given resource is TCP socket. | 61 * Determines if a given resource is TCP socket. |
44 */ | 62 */ |
45 PP_Bool (*IsTCPSocket)(PP_Resource resource); | 63 PP_Bool (*IsTCPSocket)(PP_Resource resource); |
46 /** | 64 /** |
47 * Connects to a TCP port given as a host-port pair. | 65 * Connects to a TCP port given as a host-port pair. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 struct PP_CompletionCallback callback); | 150 struct PP_CompletionCallback callback); |
133 /** | 151 /** |
134 * Cancels any IO that may be pending, and disconnects the socket. Any pending | 152 * Cancels any IO that may be pending, and disconnects the socket. Any pending |
135 * callbacks will still run, reporting PP_Error_Aborted if pending IO was | 153 * callbacks will still run, reporting PP_Error_Aborted if pending IO was |
136 * interrupted. It is NOT valid to call Connect() again after a call to this | 154 * interrupted. It is NOT valid to call Connect() again after a call to this |
137 * method. Note: If the socket is destroyed when it is still connected, then | 155 * method. Note: If the socket is destroyed when it is still connected, then |
138 * it will be implicitly disconnected, so you are not required to call this | 156 * it will be implicitly disconnected, so you are not required to call this |
139 * method. | 157 * method. |
140 */ | 158 */ |
141 void (*Disconnect)(PP_Resource tcp_socket); | 159 void (*Disconnect)(PP_Resource tcp_socket); |
| 160 /** |
| 161 * Sets an option on |tcp_socket|. Supported |name| and |value| parameters |
| 162 * are as described for PP_TCPSocketFeature_Private. |callback| will be |
| 163 * invoked with PP_OK if setting the option succeeds, or an error code |
| 164 * otherwise. |
| 165 */ |
| 166 int32_t (*SetSocketFeature)(PP_Resource udp_socket, |
| 167 PP_TCPSocketFeature_Private name, |
| 168 struct PP_Var value, |
| 169 struct PP_CompletionCallback callback); |
142 }; | 170 }; |
143 | 171 |
144 typedef struct PPB_TCPSocket_Private_0_4 PPB_TCPSocket_Private; | 172 typedef struct PPB_TCPSocket_Private_0_5 PPB_TCPSocket_Private; |
145 | 173 |
146 struct PPB_TCPSocket_Private_0_3 { | 174 struct PPB_TCPSocket_Private_0_3 { |
147 PP_Resource (*Create)(PP_Instance instance); | 175 PP_Resource (*Create)(PP_Instance instance); |
148 PP_Bool (*IsTCPSocket)(PP_Resource resource); | 176 PP_Bool (*IsTCPSocket)(PP_Resource resource); |
149 int32_t (*Connect)(PP_Resource tcp_socket, | 177 int32_t (*Connect)(PP_Resource tcp_socket, |
150 const char* host, | 178 const char* host, |
151 uint16_t port, | 179 uint16_t port, |
152 struct PP_CompletionCallback callback); | 180 struct PP_CompletionCallback callback); |
153 int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, | 181 int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, |
154 const struct PP_NetAddress_Private* addr, | 182 const struct PP_NetAddress_Private* addr, |
155 struct PP_CompletionCallback callback); | 183 struct PP_CompletionCallback callback); |
156 PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, | 184 PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, |
157 struct PP_NetAddress_Private* local_addr); | 185 struct PP_NetAddress_Private* local_addr); |
158 PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, | 186 PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, |
159 struct PP_NetAddress_Private* remote_addr); | 187 struct PP_NetAddress_Private* remote_addr); |
160 int32_t (*SSLHandshake)(PP_Resource tcp_socket, | 188 int32_t (*SSLHandshake)(PP_Resource tcp_socket, |
161 const char* server_name, | 189 const char* server_name, |
162 uint16_t server_port, | 190 uint16_t server_port, |
163 struct PP_CompletionCallback callback); | 191 struct PP_CompletionCallback callback); |
164 int32_t (*Read)(PP_Resource tcp_socket, | 192 int32_t (*Read)(PP_Resource tcp_socket, |
165 char* buffer, | 193 char* buffer, |
166 int32_t bytes_to_read, | 194 int32_t bytes_to_read, |
167 struct PP_CompletionCallback callback); | 195 struct PP_CompletionCallback callback); |
168 int32_t (*Write)(PP_Resource tcp_socket, | 196 int32_t (*Write)(PP_Resource tcp_socket, |
169 const char* buffer, | 197 const char* buffer, |
170 int32_t bytes_to_write, | 198 int32_t bytes_to_write, |
171 struct PP_CompletionCallback callback); | 199 struct PP_CompletionCallback callback); |
172 void (*Disconnect)(PP_Resource tcp_socket); | 200 void (*Disconnect)(PP_Resource tcp_socket); |
173 }; | 201 }; |
| 202 |
| 203 struct PPB_TCPSocket_Private_0_4 { |
| 204 PP_Resource (*Create)(PP_Instance instance); |
| 205 PP_Bool (*IsTCPSocket)(PP_Resource resource); |
| 206 int32_t (*Connect)(PP_Resource tcp_socket, |
| 207 const char* host, |
| 208 uint16_t port, |
| 209 struct PP_CompletionCallback callback); |
| 210 int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, |
| 211 const struct PP_NetAddress_Private* addr, |
| 212 struct PP_CompletionCallback callback); |
| 213 PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, |
| 214 struct PP_NetAddress_Private* local_addr); |
| 215 PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, |
| 216 struct PP_NetAddress_Private* remote_addr); |
| 217 int32_t (*SSLHandshake)(PP_Resource tcp_socket, |
| 218 const char* server_name, |
| 219 uint16_t server_port, |
| 220 struct PP_CompletionCallback callback); |
| 221 PP_Resource (*GetServerCertificate)(PP_Resource tcp_socket); |
| 222 PP_Bool (*AddChainBuildingCertificate)(PP_Resource tcp_socket, |
| 223 PP_Resource certificate, |
| 224 PP_Bool is_trusted); |
| 225 int32_t (*Read)(PP_Resource tcp_socket, |
| 226 char* buffer, |
| 227 int32_t bytes_to_read, |
| 228 struct PP_CompletionCallback callback); |
| 229 int32_t (*Write)(PP_Resource tcp_socket, |
| 230 const char* buffer, |
| 231 int32_t bytes_to_write, |
| 232 struct PP_CompletionCallback callback); |
| 233 void (*Disconnect)(PP_Resource tcp_socket); |
| 234 }; |
174 /** | 235 /** |
175 * @} | 236 * @} |
176 */ | 237 */ |
177 | 238 |
178 #endif /* PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ */ | 239 #endif /* PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ */ |
179 | 240 |
OLD | NEW |