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

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: Add two missing files. 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 int32_t (*Connect)(PP_Resource tcp_socket, 28 int32_t (*Connect)(PP_Resource tcp_socket,
29 const char* host, 29 const char* host,
30 uint16_t port, 30 uint16_t port,
31 struct PP_CompletionCallback callback); 31 struct PP_CompletionCallback callback);
32 32
33 // Same as Connect(), but connecting to the address given by |addr|. A typical 33 // Same as Connect(), but connecting to the address given by |addr|. A typical
34 // use-case would be for reconnections. 34 // use-case would be for reconnections.
35 int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, 35 int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket,
36 const struct PP_Flash_NetAddress* addr, 36 const struct PP_Flash_NetAddress* addr,
37 struct PP_CompletionCallback callback); 37 struct PP_CompletionCallback callback);
38 38
39 // Gets the local address of the socket, if it has been connected. 39 // Gets the local address of the socket, if it has been connected.
40 // Returns PP_TRUE on success. 40 // Returns PP_TRUE on success.
41 PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, 41 PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket,
42 struct PP_Flash_NetAddress* local_addr); 42 struct PP_Flash_NetAddress* local_addr);
43 43
44 // Gets the remote address of the socket, if it has been connected. 44 // Gets the remote address of the socket, if it has been connected.
45 // Returns PP_TRUE on success. 45 // Returns PP_TRUE on success.
46 PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, 46 PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket,
47 struct PP_Flash_NetAddress* remote_addr); 47 struct PP_Flash_NetAddress* remote_addr);
48 48
49 // Does SSL handshake and moves to sending and receiving encrypted data. The 49 // Does SSL handshake and moves to sending and receiving encrypted data. The
50 // socket must have been successfully connected. |server_name| will be 50 // socket must have been successfully connected. |host| will be
51 // compared with the name(s) in the server's certificate during the SSL 51 // compared with the name(s) in the server's certificate during the SSL
52 // handshake. 52 // handshake.
wtc 2011/08/15 19:35:12 Please document |port|. You can say it is only us
yzshen1 2011/08/15 23:09:32 Done.
53 int32_t (*InitiateSSL)(PP_Resource tcp_socket, 53 int32_t (*SSLHandshake)(PP_Resource tcp_socket,
54 const char* server_name, 54 const char* host,
55 struct PP_CompletionCallback callback); 55 uint16_t port,
56 struct PP_CompletionCallback callback);
56 57
57 // Reads data from the socket. The size of |buffer| must be at least as large 58 // 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 59 // 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 60 // read or an error code. If the return value is 0, then it indicates that
60 // end-of-file was reached. 61 // end-of-file was reached.
61 // This method won't return more than 1 megabyte, so if |bytes_to_read| 62 // 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. 63 // exceeds 1 megabyte, it will always perform a partial read.
63 // Multiple outstanding read requests are not supported. 64 // Multiple outstanding read requests are not supported.
64 int32_t (*Read)(PP_Resource tcp_socket, 65 int32_t (*Read)(PP_Resource tcp_socket,
65 char* buffer, 66 char* buffer,
(...skipping 13 matching lines...) Expand all
79 // Cancels any IO that may be pending, and disconnects the socket. Any pending 80 // 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 81 // 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 82 // 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 83 // 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 84 // it will be implicitly disconnected, so you are not required to call this
84 // method. 85 // method.
85 void (*Disconnect)(PP_Resource tcp_socket); 86 void (*Disconnect)(PP_Resource tcp_socket);
86 }; 87 };
87 88
88 #endif // PPAPI_C_PRIVATE_PPB_FLASH_TCP_SOCKET_H_ 89 #endif // PPAPI_C_PRIVATE_PPB_FLASH_TCP_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698