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.
5 #ifndef PPAPI_CPP_PRIVATE_TCP_SOCKET_PRIVATE_H_
6 #define PPAPI_CPP_PRIVATE_TCP_SOCKET_PRIVATE_H_
8 #include "ppapi/c/pp_stdint.h"
9 #include "ppapi/c/private/ppb_tcp_socket_private.h"
10 #include "ppapi/cpp/pass_ref.h"
11 #include "ppapi/cpp/private/x509_certificate_private.h"
12 #include "ppapi/cpp/resource.h"
16 class CompletionCallback
;
19 class TCPSocketPrivate
: public Resource
{
21 explicit TCPSocketPrivate(const InstanceHandle
& instance
);
23 TCPSocketPrivate(PassRef
, PP_Resource resource
);
25 // Returns true if the required interface is available.
26 static bool IsAvailable();
28 int32_t Connect(const char* host
,
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
,
37 const CompletionCallback
& callback
);
38 X509CertificatePrivate
GetServerCertificate();
39 bool AddChainBuildingCertificate(const X509CertificatePrivate
& cert
,
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
);
49 int32_t SetOption(PP_TCPSocketOption_Private name
,
51 const CompletionCallback
& callback
);
56 #endif // PPAPI_CPP_PRIVATE_TCP_SOCKET_PRIVATE_H_