| 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 Wed Nov 16 15:27:20 2011. */ | 6 /* From private/ppb_tcp_socket_private.idl modified Fri Apr 6 14:42:45 2012. */ |
| 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/private/ppb_net_address_private.h" | 17 #include "ppapi/c/private/ppb_net_address_private.h" |
| 18 | 18 |
| 19 #define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_3 "PPB_TCPSocket_Private;0.3" | 19 #define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_3 "PPB_TCPSocket_Private;0.3" |
| 20 #define PPB_TCPSOCKET_PRIVATE_INTERFACE PPB_TCPSOCKET_PRIVATE_INTERFACE_0_3 | 20 #define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4 "PPB_TCPSocket_Private;0.4" |
| 21 #define PPB_TCPSOCKET_PRIVATE_INTERFACE PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4 |
| 21 | 22 |
| 22 /** | 23 /** |
| 23 * @file | 24 * @file |
| 24 * This file defines the <code>PPB_TCPSocket_Private</code> interface. | 25 * This file defines the <code>PPB_TCPSocket_Private</code> interface. |
| 25 */ | 26 */ |
| 26 | 27 |
| 27 | 28 |
| 28 /** | 29 /** |
| 29 * @addtogroup Interfaces | 30 * @addtogroup Interfaces |
| 30 * @{ | 31 * @{ |
| 31 */ | 32 */ |
| 32 /** | 33 /** |
| 33 * The <code>PPB_TCPSocket_Private</code> interface provides TCP socket | 34 * The <code>PPB_TCPSocket_Private</code> interface provides TCP socket |
| 34 * operations. | 35 * operations. |
| 35 */ | 36 */ |
| 36 struct PPB_TCPSocket_Private_0_3 { | 37 struct PPB_TCPSocket_Private_0_4 { |
| 37 /** | 38 /** |
| 38 * Allocates a TCP socket resource. | 39 * Allocates a TCP socket resource. |
| 39 */ | 40 */ |
| 40 PP_Resource (*Create)(PP_Instance instance); | 41 PP_Resource (*Create)(PP_Instance instance); |
| 41 /** | 42 /** |
| 42 * Determines if a given resource is TCP socket. | 43 * Determines if a given resource is TCP socket. |
| 43 */ | 44 */ |
| 44 PP_Bool (*IsTCPSocket)(PP_Resource resource); | 45 PP_Bool (*IsTCPSocket)(PP_Resource resource); |
| 45 /** | 46 /** |
| 46 * Connects to a TCP port given as a host-port pair. | 47 * Connects to a TCP port given as a host-port pair. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 * If the socket is not connected, or there are pending read/write requests, | 82 * If the socket is not connected, or there are pending read/write requests, |
| 82 * SSLHandshake() will fail without starting a handshake. Otherwise, any | 83 * SSLHandshake() will fail without starting a handshake. Otherwise, any |
| 83 * failure during the handshake process will cause the socket to be | 84 * failure during the handshake process will cause the socket to be |
| 84 * disconnected. | 85 * disconnected. |
| 85 */ | 86 */ |
| 86 int32_t (*SSLHandshake)(PP_Resource tcp_socket, | 87 int32_t (*SSLHandshake)(PP_Resource tcp_socket, |
| 87 const char* server_name, | 88 const char* server_name, |
| 88 uint16_t server_port, | 89 uint16_t server_port, |
| 89 struct PP_CompletionCallback callback); | 90 struct PP_CompletionCallback callback); |
| 90 /** | 91 /** |
| 92 * Returns the server's <code>PPB_X509Certificate_Private</code> for a socket |
| 93 * connection if an SSL connection has been established using |
| 94 * <code>SSLHandshake</code>. If no SSL connection has been established, a |
| 95 * null resource is returned. |
| 96 */ |
| 97 PP_Resource (*GetServerCertificate)(PP_Resource tcp_socket); |
| 98 /** |
| 99 * NOTE: This function is not implemented and will return |
| 100 * <code>PP_FALSE</code>. |
| 101 * Adds a trusted/untrusted chain building certificate to be used for this |
| 102 * connection. The <code>certificate</code> must be a |
| 103 * <code>PPB_X509Certificate_Private<code>. <code>PP_TRUE</code> is returned |
| 104 * upon success. |
| 105 */ |
| 106 PP_Bool (*AddChainBuildingCertificate)(PP_Resource tcp_socket, |
| 107 PP_Resource certificate, |
| 108 PP_Bool is_trusted); |
| 109 /** |
| 91 * Reads data from the socket. The size of |buffer| must be at least as large | 110 * Reads data from the socket. The size of |buffer| must be at least as large |
| 92 * as |bytes_to_read|. May perform a partial read. Returns the number of bytes | 111 * as |bytes_to_read|. May perform a partial read. Returns the number of bytes |
| 93 * read or an error code. If the return value is 0, then it indicates that | 112 * read or an error code. If the return value is 0, then it indicates that |
| 94 * end-of-file was reached. | 113 * end-of-file was reached. |
| 95 * This method won't return more than 1 megabyte, so if |bytes_to_read| | 114 * This method won't return more than 1 megabyte, so if |bytes_to_read| |
| 96 * exceeds 1 megabyte, it will always perform a partial read. | 115 * exceeds 1 megabyte, it will always perform a partial read. |
| 97 * Multiple outstanding read requests are not supported. | 116 * Multiple outstanding read requests are not supported. |
| 98 */ | 117 */ |
| 99 int32_t (*Read)(PP_Resource tcp_socket, | 118 int32_t (*Read)(PP_Resource tcp_socket, |
| 100 char* buffer, | 119 char* buffer, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 115 * Cancels any IO that may be pending, and disconnects the socket. Any pending | 134 * Cancels any IO that may be pending, and disconnects the socket. Any pending |
| 116 * callbacks will still run, reporting PP_Error_Aborted if pending IO was | 135 * callbacks will still run, reporting PP_Error_Aborted if pending IO was |
| 117 * interrupted. It is NOT valid to call Connect() again after a call to this | 136 * interrupted. It is NOT valid to call Connect() again after a call to this |
| 118 * method. Note: If the socket is destroyed when it is still connected, then | 137 * method. Note: If the socket is destroyed when it is still connected, then |
| 119 * it will be implicitly disconnected, so you are not required to call this | 138 * it will be implicitly disconnected, so you are not required to call this |
| 120 * method. | 139 * method. |
| 121 */ | 140 */ |
| 122 void (*Disconnect)(PP_Resource tcp_socket); | 141 void (*Disconnect)(PP_Resource tcp_socket); |
| 123 }; | 142 }; |
| 124 | 143 |
| 125 typedef struct PPB_TCPSocket_Private_0_3 PPB_TCPSocket_Private; | 144 typedef struct PPB_TCPSocket_Private_0_4 PPB_TCPSocket_Private; |
| 145 |
| 146 struct PPB_TCPSocket_Private_0_3 { |
| 147 PP_Resource (*Create)(PP_Instance instance); |
| 148 PP_Bool (*IsTCPSocket)(PP_Resource resource); |
| 149 int32_t (*Connect)(PP_Resource tcp_socket, |
| 150 const char* host, |
| 151 uint16_t port, |
| 152 struct PP_CompletionCallback callback); |
| 153 int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, |
| 154 const struct PP_NetAddress_Private* addr, |
| 155 struct PP_CompletionCallback callback); |
| 156 PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, |
| 157 struct PP_NetAddress_Private* local_addr); |
| 158 PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, |
| 159 struct PP_NetAddress_Private* remote_addr); |
| 160 int32_t (*SSLHandshake)(PP_Resource tcp_socket, |
| 161 const char* server_name, |
| 162 uint16_t server_port, |
| 163 struct PP_CompletionCallback callback); |
| 164 int32_t (*Read)(PP_Resource tcp_socket, |
| 165 char* buffer, |
| 166 int32_t bytes_to_read, |
| 167 struct PP_CompletionCallback callback); |
| 168 int32_t (*Write)(PP_Resource tcp_socket, |
| 169 const char* buffer, |
| 170 int32_t bytes_to_write, |
| 171 struct PP_CompletionCallback callback); |
| 172 void (*Disconnect)(PP_Resource tcp_socket); |
| 173 }; |
| 126 /** | 174 /** |
| 127 * @} | 175 * @} |
| 128 */ | 176 */ |
| 129 | 177 |
| 130 #endif /* PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ */ | 178 #endif /* PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ */ |
| 131 | 179 |
| OLD | NEW |