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 Sun Feb 10 00:28:07 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 /* Special value used for testing. Guaranteed to fail SetOption(). */ |
| 37 PP_TCPSOCKETOPTION_INVALID = 0, |
| 38 /* Disable coalescing of small writes to make TCP segments, and instead |
| 39 * deliver data immediately. For SSL sockets, this option must be set before |
| 40 * SSLHandshake() is called. Value type is PP_VARTYPE_BOOL. */ |
| 41 PP_TCPSOCKETOPTION_NO_DELAY = 1 |
| 42 } PP_TCPSocketOption_Private; |
| 43 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocketOption_Private, 4); |
| 44 /** |
| 45 * @} |
| 46 */ |
| 47 |
| 48 /** |
30 * @addtogroup Interfaces | 49 * @addtogroup Interfaces |
31 * @{ | 50 * @{ |
32 */ | 51 */ |
33 /** | 52 /** |
34 * The <code>PPB_TCPSocket_Private</code> interface provides TCP socket | 53 * The <code>PPB_TCPSocket_Private</code> interface provides TCP socket |
35 * operations. | 54 * operations. |
36 */ | 55 */ |
37 struct PPB_TCPSocket_Private_0_4 { | 56 struct PPB_TCPSocket_Private_0_5 { |
38 /** | 57 /** |
39 * Allocates a TCP socket resource. | 58 * Allocates a TCP socket resource. |
40 */ | 59 */ |
41 PP_Resource (*Create)(PP_Instance instance); | 60 PP_Resource (*Create)(PP_Instance instance); |
42 /** | 61 /** |
43 * Determines if a given resource is TCP socket. | 62 * Determines if a given resource is TCP socket. |
44 */ | 63 */ |
45 PP_Bool (*IsTCPSocket)(PP_Resource resource); | 64 PP_Bool (*IsTCPSocket)(PP_Resource resource); |
46 /** | 65 /** |
47 * Connects to a TCP port given as a host-port pair. | 66 * 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); | 151 struct PP_CompletionCallback callback); |
133 /** | 152 /** |
134 * Cancels any IO that may be pending, and disconnects the socket. Any pending | 153 * 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 | 154 * 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 | 155 * 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 | 156 * 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 | 157 * it will be implicitly disconnected, so you are not required to call this |
139 * method. | 158 * method. |
140 */ | 159 */ |
141 void (*Disconnect)(PP_Resource tcp_socket); | 160 void (*Disconnect)(PP_Resource tcp_socket); |
| 161 /** |
| 162 * Sets an option on |tcp_socket|. Supported |name| and |value| parameters |
| 163 * are as described for PP_TCPSocketOption_Private. |callback| will be |
| 164 * invoked with PP_OK if setting the option succeeds, or an error code |
| 165 * otherwise. The socket must be connection before SetOption is called. |
| 166 */ |
| 167 int32_t (*SetOption)(PP_Resource tcp_socket, |
| 168 PP_TCPSocketOption_Private name, |
| 169 struct PP_Var value, |
| 170 struct PP_CompletionCallback callback); |
142 }; | 171 }; |
143 | 172 |
144 typedef struct PPB_TCPSocket_Private_0_4 PPB_TCPSocket_Private; | 173 typedef struct PPB_TCPSocket_Private_0_5 PPB_TCPSocket_Private; |
145 | 174 |
146 struct PPB_TCPSocket_Private_0_3 { | 175 struct PPB_TCPSocket_Private_0_3 { |
147 PP_Resource (*Create)(PP_Instance instance); | 176 PP_Resource (*Create)(PP_Instance instance); |
148 PP_Bool (*IsTCPSocket)(PP_Resource resource); | 177 PP_Bool (*IsTCPSocket)(PP_Resource resource); |
149 int32_t (*Connect)(PP_Resource tcp_socket, | 178 int32_t (*Connect)(PP_Resource tcp_socket, |
150 const char* host, | 179 const char* host, |
151 uint16_t port, | 180 uint16_t port, |
152 struct PP_CompletionCallback callback); | 181 struct PP_CompletionCallback callback); |
153 int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, | 182 int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, |
154 const struct PP_NetAddress_Private* addr, | 183 const struct PP_NetAddress_Private* addr, |
155 struct PP_CompletionCallback callback); | 184 struct PP_CompletionCallback callback); |
156 PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, | 185 PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, |
157 struct PP_NetAddress_Private* local_addr); | 186 struct PP_NetAddress_Private* local_addr); |
158 PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, | 187 PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, |
159 struct PP_NetAddress_Private* remote_addr); | 188 struct PP_NetAddress_Private* remote_addr); |
160 int32_t (*SSLHandshake)(PP_Resource tcp_socket, | 189 int32_t (*SSLHandshake)(PP_Resource tcp_socket, |
161 const char* server_name, | 190 const char* server_name, |
162 uint16_t server_port, | 191 uint16_t server_port, |
163 struct PP_CompletionCallback callback); | 192 struct PP_CompletionCallback callback); |
164 int32_t (*Read)(PP_Resource tcp_socket, | 193 int32_t (*Read)(PP_Resource tcp_socket, |
165 char* buffer, | 194 char* buffer, |
166 int32_t bytes_to_read, | 195 int32_t bytes_to_read, |
167 struct PP_CompletionCallback callback); | 196 struct PP_CompletionCallback callback); |
168 int32_t (*Write)(PP_Resource tcp_socket, | 197 int32_t (*Write)(PP_Resource tcp_socket, |
169 const char* buffer, | 198 const char* buffer, |
170 int32_t bytes_to_write, | 199 int32_t bytes_to_write, |
171 struct PP_CompletionCallback callback); | 200 struct PP_CompletionCallback callback); |
172 void (*Disconnect)(PP_Resource tcp_socket); | 201 void (*Disconnect)(PP_Resource tcp_socket); |
173 }; | 202 }; |
| 203 |
| 204 struct PPB_TCPSocket_Private_0_4 { |
| 205 PP_Resource (*Create)(PP_Instance instance); |
| 206 PP_Bool (*IsTCPSocket)(PP_Resource resource); |
| 207 int32_t (*Connect)(PP_Resource tcp_socket, |
| 208 const char* host, |
| 209 uint16_t port, |
| 210 struct PP_CompletionCallback callback); |
| 211 int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, |
| 212 const struct PP_NetAddress_Private* addr, |
| 213 struct PP_CompletionCallback callback); |
| 214 PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, |
| 215 struct PP_NetAddress_Private* local_addr); |
| 216 PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, |
| 217 struct PP_NetAddress_Private* remote_addr); |
| 218 int32_t (*SSLHandshake)(PP_Resource tcp_socket, |
| 219 const char* server_name, |
| 220 uint16_t server_port, |
| 221 struct PP_CompletionCallback callback); |
| 222 PP_Resource (*GetServerCertificate)(PP_Resource tcp_socket); |
| 223 PP_Bool (*AddChainBuildingCertificate)(PP_Resource tcp_socket, |
| 224 PP_Resource certificate, |
| 225 PP_Bool is_trusted); |
| 226 int32_t (*Read)(PP_Resource tcp_socket, |
| 227 char* buffer, |
| 228 int32_t bytes_to_read, |
| 229 struct PP_CompletionCallback callback); |
| 230 int32_t (*Write)(PP_Resource tcp_socket, |
| 231 const char* buffer, |
| 232 int32_t bytes_to_write, |
| 233 struct PP_CompletionCallback callback); |
| 234 void (*Disconnect)(PP_Resource tcp_socket); |
| 235 }; |
174 /** | 236 /** |
175 * @} | 237 * @} |
176 */ | 238 */ |
177 | 239 |
178 #endif /* PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ */ | 240 #endif /* PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ */ |
179 | 241 |
OLD | NEW |