blob: 830fcf1bfbbec8a3d0024bcd0c0ef76cf13a088a [file] [log] [blame]
Avi Drissmandb497b32022-09-15 19:47:281// Copyright 2013 The Chromium Authors
[email protected]ef5e98e2011-12-06 09:49:182// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]8522332e2013-08-28 19:42:595#ifndef PPAPI_PROXY_TCP_SOCKET_PRIVATE_RESOURCE_H_
6#define PPAPI_PROXY_TCP_SOCKET_PRIVATE_RESOURCE_H_
[email protected]ef5e98e2011-12-06 09:49:187
avie029c4132015-12-23 06:45:228#include <stdint.h>
9
[email protected]ef5e98e2011-12-06 09:49:1810#include "base/compiler_specific.h"
[email protected]8522332e2013-08-28 19:42:5911#include "ppapi/proxy/tcp_socket_resource_base.h"
[email protected]ef5e98e2011-12-06 09:49:1812#include "ppapi/thunk/ppb_tcp_socket_private_api.h"
13
14namespace ppapi {
[email protected]8522332e2013-08-28 19:42:5915namespace proxy {
[email protected]ef5e98e2011-12-06 09:49:1816
[email protected]8522332e2013-08-28 19:42:5917class PPAPI_PROXY_EXPORT TCPSocketPrivateResource
[email protected]ef5e98e2011-12-06 09:49:1818 : public thunk::PPB_TCPSocket_Private_API,
[email protected]8522332e2013-08-28 19:42:5919 public TCPSocketResourceBase {
[email protected]ef5e98e2011-12-06 09:49:1820 public:
[email protected]8522332e2013-08-28 19:42:5921 // C-tor used for new sockets.
22 TCPSocketPrivateResource(Connection connection, PP_Instance instance);
[email protected]ef5e98e2011-12-06 09:49:1823
[email protected]8522332e2013-08-28 19:42:5924 // C-tor used for already accepted sockets.
25 TCPSocketPrivateResource(Connection connection,
26 PP_Instance instance,
27 int pending_resource_id,
28 const PP_NetAddress_Private& local_addr,
29 const PP_NetAddress_Private& remote_addr);
[email protected]ef5e98e2011-12-06 09:49:1830
Peter Boström3d5b3cb2021-09-23 21:35:4531 TCPSocketPrivateResource(const TCPSocketPrivateResource&) = delete;
32 TCPSocketPrivateResource& operator=(const TCPSocketPrivateResource&) = delete;
33
nicke4784432015-04-23 14:01:4834 ~TCPSocketPrivateResource() override;
[email protected]8522332e2013-08-28 19:42:5935
36 // PluginResource overrides.
nicke4784432015-04-23 14:01:4837 PPB_TCPSocket_Private_API* AsPPB_TCPSocket_Private_API() override;
[email protected]ef5e98e2011-12-06 09:49:1838
39 // PPB_TCPSocket_Private_API implementation.
nicke4784432015-04-23 14:01:4840 int32_t Connect(const char* host,
41 uint16_t port,
42 scoped_refptr<TrackedCallback> callback) override;
43 int32_t ConnectWithNetAddress(
[email protected]ef5e98e2011-12-06 09:49:1844 const PP_NetAddress_Private* addr,
mostynb699af3c2014-10-06 18:03:3445 scoped_refptr<TrackedCallback> callback) override;
nicke4784432015-04-23 14:01:4846 PP_Bool GetLocalAddress(PP_NetAddress_Private* local_addr) override;
47 PP_Bool GetRemoteAddress(PP_NetAddress_Private* remote_addr) override;
48 int32_t SSLHandshake(
[email protected]aed96532012-06-23 14:27:4249 const char* server_name,
50 uint16_t server_port,
mostynb699af3c2014-10-06 18:03:3451 scoped_refptr<TrackedCallback> callback) override;
nicke4784432015-04-23 14:01:4852 PP_Resource GetServerCertificate() override;
53 PP_Bool AddChainBuildingCertificate(PP_Resource certificate,
54 PP_Bool trusted) override;
55 int32_t Read(char* buffer,
56 int32_t bytes_to_read,
57 scoped_refptr<TrackedCallback> callback) override;
58 int32_t Write(const char* buffer,
59 int32_t bytes_to_write,
60 scoped_refptr<TrackedCallback> callback) override;
61 void Disconnect() override;
62 int32_t SetOption(PP_TCPSocketOption_Private name,
63 const PP_Var& value,
64 scoped_refptr<TrackedCallback> callback) override;
[email protected]ef5e98e2011-12-06 09:49:1865
[email protected]92576792013-09-20 15:29:1366 // TCPSocketResourceBase implementation.
nicke4784432015-04-23 14:01:4867 PP_Resource CreateAcceptedSocket(
[email protected]92576792013-09-20 15:29:1368 int pending_host_id,
69 const PP_NetAddress_Private& local_addr,
mostynb699af3c2014-10-06 18:03:3470 const PP_NetAddress_Private& remote_addr) override;
[email protected]ef5e98e2011-12-06 09:49:1871};
72
[email protected]8522332e2013-08-28 19:42:5973} // namespace proxy
[email protected]ef5e98e2011-12-06 09:49:1874} // namespace ppapi
75
[email protected]8522332e2013-08-28 19:42:5976#endif // PPAPI_PROXY_TCP_SOCKET_PRIVATE_RESOURCE_H_