| 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 #ifndef PPAPI_CPP_PRIVATE_TCP_SOCKET_PRIVATE_H_ | 5 #ifndef PPAPI_CPP_PRIVATE_TCP_SOCKET_PRIVATE_H_ |
| 6 #define PPAPI_CPP_PRIVATE_TCP_SOCKET_PRIVATE_H_ | 6 #define PPAPI_CPP_PRIVATE_TCP_SOCKET_PRIVATE_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/pp_stdint.h" | 8 #include "ppapi/c/pp_stdint.h" |
| 9 #include "ppapi/c/private/ppb_tcp_socket_private.h" | 9 #include "ppapi/c/private/ppb_tcp_socket_private.h" |
| 10 #include "ppapi/cpp/pass_ref.h" |
| 10 #include "ppapi/cpp/resource.h" | 11 #include "ppapi/cpp/resource.h" |
| 11 | 12 |
| 12 namespace pp { | 13 namespace pp { |
| 13 | 14 |
| 14 class CompletionCallback; | 15 class CompletionCallback; |
| 15 class InstanceHandle; | 16 class InstanceHandle; |
| 16 | 17 |
| 17 class TCPSocketPrivate : public Resource { | 18 class TCPSocketPrivate : public Resource { |
| 18 public: | 19 public: |
| 19 explicit TCPSocketPrivate(const InstanceHandle& instance); | 20 explicit TCPSocketPrivate(const InstanceHandle& instance); |
| 20 | 21 |
| 22 TCPSocketPrivate(PassRef, PP_Resource resource); |
| 23 |
| 21 // Returns true if the required interface is available. | 24 // Returns true if the required interface is available. |
| 22 static bool IsAvailable(); | 25 static bool IsAvailable(); |
| 23 | 26 |
| 24 int32_t Connect(const char* host, | 27 int32_t Connect(const char* host, |
| 25 uint16_t port, | 28 uint16_t port, |
| 26 const CompletionCallback& callback); | 29 const CompletionCallback& callback); |
| 27 int32_t ConnectWithNetAddress(const PP_NetAddress_Private* addr, | 30 int32_t ConnectWithNetAddress(const PP_NetAddress_Private* addr, |
| 28 const CompletionCallback& callback); | 31 const CompletionCallback& callback); |
| 29 bool GetLocalAddress(PP_NetAddress_Private* local_addr); | 32 bool GetLocalAddress(PP_NetAddress_Private* local_addr); |
| 30 bool GetRemoteAddress(PP_NetAddress_Private* remote_addr); | 33 bool GetRemoteAddress(PP_NetAddress_Private* remote_addr); |
| 31 int32_t SSLHandshake(const char* server_name, | 34 int32_t SSLHandshake(const char* server_name, |
| 32 uint16_t server_port, | 35 uint16_t server_port, |
| 33 const CompletionCallback& callback); | 36 const CompletionCallback& callback); |
| 34 int32_t Read(char* buffer, | 37 int32_t Read(char* buffer, |
| 35 int32_t bytes_to_read, | 38 int32_t bytes_to_read, |
| 36 const CompletionCallback& callback); | 39 const CompletionCallback& callback); |
| 37 int32_t Write(const char* buffer, | 40 int32_t Write(const char* buffer, |
| 38 int32_t bytes_to_write, | 41 int32_t bytes_to_write, |
| 39 const CompletionCallback& callback); | 42 const CompletionCallback& callback); |
| 40 void Disconnect(); | 43 void Disconnect(); |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 } // namespace pp | 46 } // namespace pp |
| 44 | 47 |
| 45 #endif // PPAPI_CPP_PRIVATE_TCP_SOCKET_PRIVATE_H_ | 48 #endif // PPAPI_CPP_PRIVATE_TCP_SOCKET_PRIVATE_H_ |
| OLD | NEW |