diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-26 17:55:22 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-26 17:55:22 +0000 |
commit | cd4650d91f7164a74812e81c6202272f8b0d8d1d (patch) | |
tree | af7a30d151f975aaa1fa9d283762f4ce2e3f25f4 /ppapi/c | |
parent | 6abb6b88c89f3b499c97d5acce085021b3d79319 (diff) | |
download | chromium_src-cd4650d91f7164a74812e81c6202272f8b0d8d1d.zip chromium_src-cd4650d91f7164a74812e81c6202272f8b0d8d1d.tar.gz chromium_src-cd4650d91f7164a74812e81c6202272f8b0d8d1d.tar.bz2 |
Add IDL file for PPB_Flash_TCPSocket.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/8036009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102754 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c')
-rw-r--r-- | ppapi/c/private/ppb_flash_tcp_socket.h | 154 |
1 files changed, 100 insertions, 54 deletions
diff --git a/ppapi/c/private/ppb_flash_tcp_socket.h b/ppapi/c/private/ppb_flash_tcp_socket.h index 05eb3a0..0cad5bc 100644 --- a/ppapi/c/private/ppb_flash_tcp_socket.h +++ b/ppapi/c/private/ppb_flash_tcp_socket.h @@ -1,6 +1,9 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_flash_tcp_socket.idl modified Fri Sep 23 17:09:42 2011. */ #ifndef PPAPI_C_PRIVATE_PPB_FLASH_TCP_SOCKET_H_ #define PPAPI_C_PRIVATE_PPB_FLASH_TCP_SOCKET_H_ @@ -8,91 +11,134 @@ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" -// This is an opaque type holding a network address. +#define PPB_FLASH_TCPSOCKET_INTERFACE_0_2 "PPB_Flash_TCPSocket;0.2" +#define PPB_FLASH_TCPSOCKET_INTERFACE PPB_FLASH_TCPSOCKET_INTERFACE_0_2 + +/** + * @file + * This file defines the <code>PPB_Flash_TCPSocket</code> interface. + */ + + +/** + * @addtogroup Structs + * @{ + */ +/** + * This is an opaque type holding a network address. + */ struct PP_Flash_NetAddress { uint32_t size; char data[128]; }; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Flash_NetAddress, 132); +/** + * @} + */ -#define PPB_FLASH_TCPSOCKET_INTERFACE "PPB_Flash_TCPSocket;0.2" - +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_Flash_TCPSocket</code> interface provides TCP socket + * operations. + */ struct PPB_Flash_TCPSocket { + /** + * Allocates a TCP socket resource. + */ PP_Resource (*Create)(PP_Instance instance); - + /** + * Determines if a given resource is TCP socket. + */ PP_Bool (*IsFlashTCPSocket)(PP_Resource resource); - - // Connects to a TCP port given as a host-port pair. - // When a proxy server is used, |host| and |port| refer to the proxy server - // instead of the destination server. + /** + * Connects to a TCP port given as a host-port pair. + * When a proxy server is used, |host| and |port| refer to the proxy server + * instead of the destination server. + */ int32_t (*Connect)(PP_Resource tcp_socket, const char* host, uint16_t port, struct PP_CompletionCallback callback); - - // Same as Connect(), but connecting to the address given by |addr|. A typical - // use-case would be for reconnections. + /** + * Same as Connect(), but connecting to the address given by |addr|. A typical + * use-case would be for reconnections. + */ int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, const struct PP_Flash_NetAddress* addr, struct PP_CompletionCallback callback); - - // Gets the local address of the socket, if it has been connected. - // Returns PP_TRUE on success. + /** + * Gets the local address of the socket, if it has been connected. + * Returns PP_TRUE on success. + */ PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, struct PP_Flash_NetAddress* local_addr); - - // Gets the remote address of the socket, if it has been connected. - // Returns PP_TRUE on success. + /** + * Gets the remote address of the socket, if it has been connected. + * Returns PP_TRUE on success. + */ PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, struct PP_Flash_NetAddress* remote_addr); - - // Does SSL handshake and moves to sending and receiving encrypted data. The - // socket must have been successfully connected. |server_name| will be - // compared with the name(s) in the server's certificate during the SSL - // handshake. |server_port| is only used to identify an SSL server in the SSL - // session cache. - // When a proxy server is used, |server_name| and |server_port| refer to the - // destination server. - // If the socket is not connected, or there are pending read/write requests, - // SSLHandshake() will fail without starting a handshake. Otherwise, any - // failure during the handshake process will cause the socket to be - // disconnected. + /** + * Does SSL handshake and moves to sending and receiving encrypted data. The + * socket must have been successfully connected. |server_name| will be + * compared with the name(s) in the server's certificate during the SSL + * handshake. |server_port| is only used to identify an SSL server in the SSL + * session cache. + * When a proxy server is used, |server_name| and |server_port| refer to the + * destination server. + * If the socket is not connected, or there are pending read/write requests, + * SSLHandshake() will fail without starting a handshake. Otherwise, any + * failure during the handshake process will cause the socket to be + * disconnected. + */ int32_t (*SSLHandshake)(PP_Resource tcp_socket, const char* server_name, uint16_t server_port, struct PP_CompletionCallback callback); - - // Reads data from the socket. The size of |buffer| must be at least as large - // as |bytes_to_read|. May perform a partial read. Returns the number of bytes - // read or an error code. If the return value is 0, then it indicates that - // end-of-file was reached. - // This method won't return more than 1 megabyte, so if |bytes_to_read| - // exceeds 1 megabyte, it will always perform a partial read. - // Multiple outstanding read requests are not supported. + /** + * Reads data from the socket. The size of |buffer| must be at least as large + * as |bytes_to_read|. May perform a partial read. Returns the number of bytes + * read or an error code. If the return value is 0, then it indicates that + * end-of-file was reached. + * This method won't return more than 1 megabyte, so if |bytes_to_read| + * exceeds 1 megabyte, it will always perform a partial read. + * Multiple outstanding read requests are not supported. + */ int32_t (*Read)(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback); - - // Writes data to the socket. May perform a partial write. Returns the number - // of bytes written or an error code. - // This method won't write more than 1 megabyte, so if |bytes_to_write| - // exceeds 1 megabyte, it will always perform a partial write. - // Multiple outstanding write requests are not supported. + /** + * Writes data to the socket. May perform a partial write. Returns the number + * of bytes written or an error code. + * This method won't write more than 1 megabyte, so if |bytes_to_write| + * exceeds 1 megabyte, it will always perform a partial write. + * Multiple outstanding write requests are not supported. + */ int32_t (*Write)(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback); - - // Cancels any IO that may be pending, and disconnects the socket. Any pending - // callbacks will still run, reporting PP_Error_Aborted if pending IO was - // interrupted. It is NOT valid to call Connect() again after a call to this - // method. Note: If the socket is destroyed when it is still connected, then - // it will be implicitly disconnected, so you are not required to call this - // method. + /** + * Cancels any IO that may be pending, and disconnects the socket. Any pending + * callbacks will still run, reporting PP_Error_Aborted if pending IO was + * interrupted. It is NOT valid to call Connect() again after a call to this + * method. Note: If the socket is destroyed when it is still connected, then + * it will be implicitly disconnected, so you are not required to call this + * method. + */ void (*Disconnect)(PP_Resource tcp_socket); }; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_FLASH_TCP_SOCKET_H_ */ -#endif // PPAPI_C_PRIVATE_PPB_FLASH_TCP_SOCKET_H_ |