blob: 24d2812656d0f550ee1fd668534659b815dbb8e7 [file] [log] [blame]
[email protected]8522332e2013-08-28 19:42:591// Copyright 2013 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_PROXY_TCP_SOCKET_RESOURCE_H_
6#define PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_
7
avie029c4132015-12-23 06:45:228#include <stdint.h>
9
[email protected]8522332e2013-08-28 19:42:5910#include "base/compiler_specific.h"
11#include "ppapi/proxy/tcp_socket_resource_base.h"
12#include "ppapi/thunk/ppb_tcp_socket_api.h"
13
14namespace ppapi {
[email protected]92576792013-09-20 15:29:1315
[email protected]8522332e2013-08-28 19:42:5916namespace proxy {
17
18class PPAPI_PROXY_EXPORT TCPSocketResource : public thunk::PPB_TCPSocket_API,
19 public TCPSocketResourceBase {
20 public:
[email protected]92576792013-09-20 15:29:1321 // C-tor used for new sockets created.
22 TCPSocketResource(Connection connection,
23 PP_Instance instance,
24 TCPSocketVersion version);
25
Peter Boström3d5b3cb2021-09-23 21:35:4526 TCPSocketResource(const TCPSocketResource&) = delete;
27 TCPSocketResource& operator=(const TCPSocketResource&) = delete;
28
nicke4784432015-04-23 14:01:4829 ~TCPSocketResource() override;
[email protected]8522332e2013-08-28 19:42:5930
31 // PluginResource overrides.
nicke4784432015-04-23 14:01:4832 thunk::PPB_TCPSocket_API* AsPPB_TCPSocket_API() override;
[email protected]8522332e2013-08-28 19:42:5933
34 // thunk::PPB_TCPSocket_API implementation.
nicke4784432015-04-23 14:01:4835 int32_t Bind(PP_Resource addr,
36 scoped_refptr<TrackedCallback> callback) override;
37 int32_t Connect(PP_Resource addr,
38 scoped_refptr<TrackedCallback> callback) override;
39 PP_Resource GetLocalAddress() override;
40 PP_Resource GetRemoteAddress() override;
41 int32_t Read(char* buffer,
42 int32_t bytes_to_read,
43 scoped_refptr<TrackedCallback> callback) override;
44 int32_t Write(const char* buffer,
45 int32_t bytes_to_write,
46 scoped_refptr<TrackedCallback> callback) override;
47 int32_t Listen(int32_t backlog,
48 scoped_refptr<TrackedCallback> callback) override;
49 int32_t Accept(PP_Resource* accepted_tcp_socket,
50 scoped_refptr<TrackedCallback> callback) override;
51 void Close() override;
52 int32_t SetOption1_1(
hidehikofd305c122014-12-11 06:01:4753 PP_TCPSocket_Option name,
54 const PP_Var& value,
55 scoped_refptr<TrackedCallback> callback) override;
nicke4784432015-04-23 14:01:4856 int32_t SetOption(PP_TCPSocket_Option name,
57 const PP_Var& value,
58 scoped_refptr<TrackedCallback> callback) override;
[email protected]8522332e2013-08-28 19:42:5959
[email protected]92576792013-09-20 15:29:1360 // TCPSocketResourceBase implementation.
nicke4784432015-04-23 14:01:4861 PP_Resource CreateAcceptedSocket(
[email protected]92576792013-09-20 15:29:1362 int pending_host_id,
63 const PP_NetAddress_Private& local_addr,
mostynb699af3c2014-10-06 18:03:3464 const PP_NetAddress_Private& remote_addr) override;
[email protected]92576792013-09-20 15:29:1365
[email protected]8522332e2013-08-28 19:42:5966 private:
[email protected]92576792013-09-20 15:29:1367 // C-tor used for accepted sockets.
68 TCPSocketResource(Connection connection,
69 PP_Instance instance,
70 int pending_host_id,
71 const PP_NetAddress_Private& local_addr,
72 const PP_NetAddress_Private& remote_addr);
[email protected]8522332e2013-08-28 19:42:5973};
74
75} // namespace proxy
76} // namespace ppapi
77
78#endif // PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_