Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: ppapi/c/private/ppb_flash_tcp_socket.h

Issue 7535007: Implement PPB_Flash_TCPSocket.InitiateSSL. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Make changes according to Wan-Teh's suggestions. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef PPAPI_C_PRIVATE_PPB_FLASH_TCP_SOCKET_H_ 5 #ifndef PPAPI_C_PRIVATE_PPB_FLASH_TCP_SOCKET_H_
6 #define PPAPI_C_PRIVATE_PPB_FLASH_TCP_SOCKET_H_ 6 #define PPAPI_C_PRIVATE_PPB_FLASH_TCP_SOCKET_H_
7 7
8 #include "ppapi/c/pp_bool.h" 8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_completion_callback.h" 9 #include "ppapi/c/pp_completion_callback.h"
10 #include "ppapi/c/pp_instance.h" 10 #include "ppapi/c/pp_instance.h"
11 #include "ppapi/c/pp_resource.h" 11 #include "ppapi/c/pp_resource.h"
12 #include "ppapi/c/pp_stdint.h" 12 #include "ppapi/c/pp_stdint.h"
13 13
14 // This is an opaque type holding a network address. 14 // This is an opaque type holding a network address.
15 struct PP_Flash_NetAddress { 15 struct PP_Flash_NetAddress {
16 uint32_t size; 16 uint32_t size;
17 char data[128]; 17 char data[128];
18 }; 18 };
19 19
20 #define PPB_FLASH_TCPSOCKET_INTERFACE "PPB_Flash_TCPSocket;0.1" 20 #define PPB_FLASH_TCPSOCKET_INTERFACE "PPB_Flash_TCPSocket;0.2"
21 21
22 struct PPB_Flash_TCPSocket { 22 struct PPB_Flash_TCPSocket {
23 PP_Resource (*Create)(PP_Instance instance); 23 PP_Resource (*Create)(PP_Instance instance);
24 24
25 PP_Bool (*IsFlashTCPSocket)(PP_Resource resource); 25 PP_Bool (*IsFlashTCPSocket)(PP_Resource resource);
26 26
27 // Connects to a TCP port given as a host-port pair. 27 // Connects to a TCP port given as a host-port pair.
28 // When a proxy server is used, |host| and |port| refer to the proxy server
29 // instead of the destination server.
28 int32_t (*Connect)(PP_Resource tcp_socket, 30 int32_t (*Connect)(PP_Resource tcp_socket,
29 const char* host, 31 const char* host,
30 uint16_t port, 32 uint16_t port,
31 struct PP_CompletionCallback callback); 33 struct PP_CompletionCallback callback);
32 34
33 // Same as Connect(), but connecting to the address given by |addr|. A typical 35 // Same as Connect(), but connecting to the address given by |addr|. A typical
34 // use-case would be for reconnections. 36 // use-case would be for reconnections.
35 int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, 37 int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket,
36 const struct PP_Flash_NetAddress* addr, 38 const struct PP_Flash_NetAddress* addr,
37 struct PP_CompletionCallback callback); 39 struct PP_CompletionCallback callback);
38 40
39 // Gets the local address of the socket, if it has been connected. 41 // Gets the local address of the socket, if it has been connected.
40 // Returns PP_TRUE on success. 42 // Returns PP_TRUE on success.
41 PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, 43 PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket,
42 struct PP_Flash_NetAddress* local_addr); 44 struct PP_Flash_NetAddress* local_addr);
43 45
44 // Gets the remote address of the socket, if it has been connected. 46 // Gets the remote address of the socket, if it has been connected.
45 // Returns PP_TRUE on success. 47 // Returns PP_TRUE on success.
46 PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, 48 PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket,
47 struct PP_Flash_NetAddress* remote_addr); 49 struct PP_Flash_NetAddress* remote_addr);
48 50
49 // Does SSL handshake and moves to sending and receiving encrypted data. The 51 // Does SSL handshake and moves to sending and receiving encrypted data. The
50 // socket must have been successfully connected. |server_name| will be 52 // socket must have been successfully connected. |server_name| will be
51 // compared with the name(s) in the server's certificate during the SSL 53 // compared with the name(s) in the server's certificate during the SSL
52 // handshake. 54 // handshake. |server_port| is only used to identify an SSL server in the SSL
53 int32_t (*InitiateSSL)(PP_Resource tcp_socket, 55 // session cache.
54 const char* server_name, 56 // When a proxy server is used, |server_name| and |server_port| refer to the
55 struct PP_CompletionCallback callback); 57 // destination server.
58 int32_t (*SSLHandshake)(PP_Resource tcp_socket,
59 const char* server_name,
60 uint16_t server_port,
61 struct PP_CompletionCallback callback);
56 62
57 // Reads data from the socket. The size of |buffer| must be at least as large 63 // Reads data from the socket. The size of |buffer| must be at least as large
58 // as |bytes_to_read|. May perform a partial read. Returns the number of bytes 64 // as |bytes_to_read|. May perform a partial read. Returns the number of bytes
59 // read or an error code. If the return value is 0, then it indicates that 65 // read or an error code. If the return value is 0, then it indicates that
60 // end-of-file was reached. 66 // end-of-file was reached.
61 // This method won't return more than 1 megabyte, so if |bytes_to_read| 67 // This method won't return more than 1 megabyte, so if |bytes_to_read|
62 // exceeds 1 megabyte, it will always perform a partial read. 68 // exceeds 1 megabyte, it will always perform a partial read.
63 // Multiple outstanding read requests are not supported. 69 // Multiple outstanding read requests are not supported.
64 int32_t (*Read)(PP_Resource tcp_socket, 70 int32_t (*Read)(PP_Resource tcp_socket,
65 char* buffer, 71 char* buffer,
(...skipping 13 matching lines...) Expand all
79 // Cancels any IO that may be pending, and disconnects the socket. Any pending 85 // Cancels any IO that may be pending, and disconnects the socket. Any pending
80 // callbacks will still run, reporting PP_Error_Aborted if pending IO was 86 // callbacks will still run, reporting PP_Error_Aborted if pending IO was
81 // interrupted. It is NOT valid to call Connect() again after a call to this 87 // interrupted. It is NOT valid to call Connect() again after a call to this
82 // method. Note: If the socket is destroyed when it is still connected, then 88 // method. Note: If the socket is destroyed when it is still connected, then
83 // it will be implicitly disconnected, so you are not required to call this 89 // it will be implicitly disconnected, so you are not required to call this
84 // method. 90 // method.
85 void (*Disconnect)(PP_Resource tcp_socket); 91 void (*Disconnect)(PP_Resource tcp_socket);
86 }; 92 };
87 93
88 #endif // PPAPI_C_PRIVATE_PPB_FLASH_TCP_SOCKET_H_ 94 #endif // PPAPI_C_PRIVATE_PPB_FLASH_TCP_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698