| 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 // TODO(yzshen): This (and the .cc file) contain C++ wrappers for things | |
| 6 // in ppapi/c/private/ppb_flash_tcp_socket.h. This is currently not used in | |
| 7 // (or even compiled with) Chromium. | |
| 8 | |
| 9 #ifndef PPAPI_CPP_PRIVATE_FLASH_TCP_SOCKET_H_ | 5 #ifndef PPAPI_CPP_PRIVATE_FLASH_TCP_SOCKET_H_ |
| 10 #define PPAPI_CPP_PRIVATE_FLASH_TCP_SOCKET_H_ | 6 #define PPAPI_CPP_PRIVATE_FLASH_TCP_SOCKET_H_ |
| 11 | 7 |
| 12 #include "ppapi/c/pp_stdint.h" | 8 #include "ppapi/c/pp_stdint.h" |
| 13 #include "ppapi/c/private/ppb_flash_tcp_socket.h" | 9 #include "ppapi/c/private/ppb_flash_tcp_socket.h" |
| 14 #include "ppapi/cpp/resource.h" | 10 #include "ppapi/cpp/resource.h" |
| 15 | 11 |
| 16 namespace pp { | 12 namespace pp { |
| 17 | 13 |
| 18 class CompletionCallback; | 14 class CompletionCallback; |
| 19 class Instance; | 15 class Instance; |
| 20 | 16 |
| 21 namespace flash { | 17 namespace flash { |
| 22 | 18 |
| 23 class TCPSocket : public Resource { | 19 class TCPSocket : public Resource { |
| 24 public: | 20 public: |
| 25 explicit TCPSocket(Instance* instance); | 21 explicit TCPSocket(Instance* instance); |
| 26 | 22 |
| 23 // Returns true if the required interface is available. |
| 24 static bool IsAvailable(); |
| 25 |
| 27 int32_t Connect(const char* host, | 26 int32_t Connect(const char* host, |
| 28 uint16_t port, | 27 uint16_t port, |
| 29 const CompletionCallback& callback); | 28 const CompletionCallback& callback); |
| 30 int32_t ConnectWithNetAddress(const PP_NetAddress_Private* addr, | 29 int32_t ConnectWithNetAddress(const PP_NetAddress_Private* addr, |
| 31 const CompletionCallback& callback); | 30 const CompletionCallback& callback); |
| 32 bool GetLocalAddress(PP_NetAddress_Private* local_addr); | 31 bool GetLocalAddress(PP_NetAddress_Private* local_addr); |
| 33 bool GetRemoteAddress(PP_NetAddress_Private* remote_addr); | 32 bool GetRemoteAddress(PP_NetAddress_Private* remote_addr); |
| 34 int32_t SSLHandshake(const char* server_name, | 33 int32_t SSLHandshake(const char* server_name, |
| 35 uint16_t server_port, | 34 uint16_t server_port, |
| 36 const CompletionCallback& callback); | 35 const CompletionCallback& callback); |
| 37 int32_t Read(char* buffer, | 36 int32_t Read(char* buffer, |
| 38 int32_t bytes_to_read, | 37 int32_t bytes_to_read, |
| 39 const CompletionCallback& callback); | 38 const CompletionCallback& callback); |
| 40 int32_t Write(const char* buffer, | 39 int32_t Write(const char* buffer, |
| 41 int32_t bytes_to_write, | 40 int32_t bytes_to_write, |
| 42 const CompletionCallback& callback); | 41 const CompletionCallback& callback); |
| 43 void Disconnect(); | 42 void Disconnect(); |
| 44 }; | 43 }; |
| 45 | 44 |
| 46 } // namespace flash | 45 } // namespace flash |
| 47 } // namespace pp | 46 } // namespace pp |
| 48 | 47 |
| 49 #endif // PPAPI_CPP_PRIVATE_FLASH_TCP_SOCKET_H_ | 48 #endif // PPAPI_CPP_PRIVATE_FLASH_TCP_SOCKET_H_ |
| OLD | NEW |