OLD | NEW |
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 #include "ppapi/c/pp_completion_callback.h" | 5 #include "ppapi/c/pp_completion_callback.h" |
6 #include "ppapi/c/pp_errors.h" | 6 #include "ppapi/c/pp_errors.h" |
7 #include "ppapi/c/private/ppb_flash_tcp_socket.h" | 7 #include "ppapi/c/private/ppb_flash_tcp_socket.h" |
8 #include "ppapi/thunk/common.h" | 8 #include "ppapi/thunk/common.h" |
9 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
10 #include "ppapi/thunk/thunk.h" | 10 #include "ppapi/thunk/thunk.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 | 59 |
60 PP_Bool GetRemoteAddress(PP_Resource tcp_socket, | 60 PP_Bool GetRemoteAddress(PP_Resource tcp_socket, |
61 PP_Flash_NetAddress* remote_addr) { | 61 PP_Flash_NetAddress* remote_addr) { |
62 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); | 62 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); |
63 if (enter.failed()) | 63 if (enter.failed()) |
64 return PP_FALSE; | 64 return PP_FALSE; |
65 return enter.object()->GetRemoteAddress(remote_addr); | 65 return enter.object()->GetRemoteAddress(remote_addr); |
66 } | 66 } |
67 | 67 |
68 int32_t InitiateSSL(PP_Resource tcp_socket, | 68 int32_t SSLHandshake(PP_Resource tcp_socket, |
69 const char* server_name, | 69 const char* server_name, |
70 PP_CompletionCallback callback) { | 70 uint16_t server_port, |
| 71 PP_CompletionCallback callback) { |
71 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); | 72 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); |
72 if (enter.failed()) | 73 if (enter.failed()) |
73 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); | 74 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); |
74 int32_t result = enter.object()->InitiateSSL(server_name, callback); | 75 int32_t result = enter.object()->SSLHandshake(server_name, server_port, |
| 76 callback); |
75 return MayForceCallback(callback, result); | 77 return MayForceCallback(callback, result); |
76 } | 78 } |
77 | 79 |
78 int32_t Read(PP_Resource tcp_socket, | 80 int32_t Read(PP_Resource tcp_socket, |
79 char* buffer, | 81 char* buffer, |
80 int32_t bytes_to_read, | 82 int32_t bytes_to_read, |
81 PP_CompletionCallback callback) { | 83 PP_CompletionCallback callback) { |
82 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); | 84 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); |
83 if (enter.failed()) | 85 if (enter.failed()) |
84 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); | 86 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); |
(...skipping 18 matching lines...) Expand all Loading... |
103 enter.object()->Disconnect(); | 105 enter.object()->Disconnect(); |
104 } | 106 } |
105 | 107 |
106 const PPB_Flash_TCPSocket g_ppb_flash_tcp_socket_thunk = { | 108 const PPB_Flash_TCPSocket g_ppb_flash_tcp_socket_thunk = { |
107 &Create, | 109 &Create, |
108 &IsFlashTCPSocket, | 110 &IsFlashTCPSocket, |
109 &Connect, | 111 &Connect, |
110 &ConnectWithNetAddress, | 112 &ConnectWithNetAddress, |
111 &GetLocalAddress, | 113 &GetLocalAddress, |
112 &GetRemoteAddress, | 114 &GetRemoteAddress, |
113 &InitiateSSL, | 115 &SSLHandshake, |
114 &Read, | 116 &Read, |
115 &Write, | 117 &Write, |
116 &Disconnect | 118 &Disconnect |
117 }; | 119 }; |
118 | 120 |
119 } // namespace | 121 } // namespace |
120 | 122 |
121 const PPB_Flash_TCPSocket* GetPPB_Flash_TCPSocket_Thunk() { | 123 const PPB_Flash_TCPSocket* GetPPB_Flash_TCPSocket_Thunk() { |
122 return &g_ppb_flash_tcp_socket_thunk; | 124 return &g_ppb_flash_tcp_socket_thunk; |
123 } | 125 } |
124 | 126 |
125 } // namespace thunk | 127 } // namespace thunk |
126 } // namespace ppapi | 128 } // namespace ppapi |
127 | 129 |
OLD | NEW |