Pepper_47_C++_interfaces
tcp_socket_private.h
Go to the documentation of this file.
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef PPAPI_CPP_PRIVATE_TCP_SOCKET_PRIVATE_H_
6 #define PPAPI_CPP_PRIVATE_TCP_SOCKET_PRIVATE_H_
7 
8 #include "ppapi/c/pp_stdint.h"
9 #include "ppapi/c/private/ppb_tcp_socket_private.h"
10 #include "ppapi/cpp/pass_ref.h"
12 #include "ppapi/cpp/resource.h"
13 
14 namespace pp {
15 
16 class CompletionCallback;
17 class InstanceHandle;
18 
19 class TCPSocketPrivate : public Resource {
20  public:
21  explicit TCPSocketPrivate(const InstanceHandle& instance);
22 
24 
25  // Returns true if the required interface is available.
26  static bool IsAvailable();
27 
28  int32_t Connect(const char* host,
29  uint16_t port,
30  const CompletionCallback& callback);
31  int32_t ConnectWithNetAddress(const PP_NetAddress_Private* addr,
32  const CompletionCallback& callback);
33  bool GetLocalAddress(PP_NetAddress_Private* local_addr);
34  bool GetRemoteAddress(PP_NetAddress_Private* remote_addr);
35  int32_t SSLHandshake(const char* server_name,
36  uint16_t server_port,
37  const CompletionCallback& callback);
40  bool trusted);
41 
42  int32_t Read(char* buffer,
43  int32_t bytes_to_read,
44  const CompletionCallback& callback);
45  int32_t Write(const char* buffer,
46  int32_t bytes_to_write,
47  const CompletionCallback& callback);
48  void Disconnect();
49  int32_t SetOption(PP_TCPSocketOption_Private name,
50  const Var& value,
51  const CompletionCallback& callback);
52 };
53 
54 } // namespace pp
55 
56 #endif // PPAPI_CPP_PRIVATE_TCP_SOCKET_PRIVATE_H_
bool GetRemoteAddress(PP_NetAddress_Private *remote_addr)
int32_t SetOption(PP_TCPSocketOption_Private name, const Var &value, const CompletionCallback &callback)
int32_t Connect(const char *host, uint16_t port, const CompletionCallback &callback)
int32_t Read(char *buffer, int32_t bytes_to_read, const CompletionCallback &callback)
int32_t Write(const char *buffer, int32_t bytes_to_write, const CompletionCallback &callback)
X509CertificatePrivate GetServerCertificate()
PassRef
Definition: pass_ref.h:17
bool GetLocalAddress(PP_NetAddress_Private *local_addr)
TCPSocketPrivate(const InstanceHandle &instance)
A generic type used for passing data types between the module and the page.
Definition: var.h:21
int32_t SSLHandshake(const char *server_name, uint16_t server_port, const CompletionCallback &callback)
int32_t ConnectWithNetAddress(const PP_NetAddress_Private *addr, const CompletionCallback &callback)
A reference counted module resource.
Definition: resource.h:20
bool AddChainBuildingCertificate(const X509CertificatePrivate &cert, bool trusted)