Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: ppapi/proxy/tcp_socket_resource.h

Issue 24195004: PPB_TCPSocket: add support for TCP server socket operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/tcp_socket_private_resource.cc ('k') | ppapi/proxy/tcp_socket_resource.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_PROXY_TCP_SOCKET_RESOURCE_H_ 5 #ifndef PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_
6 #define PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_ 6 #define PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "ppapi/proxy/tcp_socket_resource_base.h" 10 #include "ppapi/proxy/tcp_socket_resource_base.h"
11 #include "ppapi/thunk/ppb_tcp_socket_api.h" 11 #include "ppapi/thunk/ppb_tcp_socket_api.h"
12 12
13 namespace ppapi { 13 namespace ppapi {
14
15 enum TCPSocketVersion;
16
14 namespace proxy { 17 namespace proxy {
15 18
16 class PPAPI_PROXY_EXPORT TCPSocketResource : public thunk::PPB_TCPSocket_API, 19 class PPAPI_PROXY_EXPORT TCPSocketResource : public thunk::PPB_TCPSocket_API,
17 public TCPSocketResourceBase { 20 public TCPSocketResourceBase {
18 public: 21 public:
19 TCPSocketResource(Connection connection, PP_Instance instance); 22 // C-tor used for new sockets created.
23 TCPSocketResource(Connection connection,
24 PP_Instance instance,
25 TCPSocketVersion version);
26
20 virtual ~TCPSocketResource(); 27 virtual ~TCPSocketResource();
21 28
22 // PluginResource overrides. 29 // PluginResource overrides.
23 virtual thunk::PPB_TCPSocket_API* AsPPB_TCPSocket_API() OVERRIDE; 30 virtual thunk::PPB_TCPSocket_API* AsPPB_TCPSocket_API() OVERRIDE;
24 31
25 // thunk::PPB_TCPSocket_API implementation. 32 // thunk::PPB_TCPSocket_API implementation.
33 virtual int32_t Bind(PP_Resource addr,
34 scoped_refptr<TrackedCallback> callback) OVERRIDE;
26 virtual int32_t Connect(PP_Resource addr, 35 virtual int32_t Connect(PP_Resource addr,
27 scoped_refptr<TrackedCallback> callback) OVERRIDE; 36 scoped_refptr<TrackedCallback> callback) OVERRIDE;
28 virtual PP_Resource GetLocalAddress() OVERRIDE; 37 virtual PP_Resource GetLocalAddress() OVERRIDE;
29 virtual PP_Resource GetRemoteAddress() OVERRIDE; 38 virtual PP_Resource GetRemoteAddress() OVERRIDE;
30 virtual int32_t Read(char* buffer, 39 virtual int32_t Read(char* buffer,
31 int32_t bytes_to_read, 40 int32_t bytes_to_read,
32 scoped_refptr<TrackedCallback> callback) OVERRIDE; 41 scoped_refptr<TrackedCallback> callback) OVERRIDE;
33 virtual int32_t Write(const char* buffer, 42 virtual int32_t Write(const char* buffer,
34 int32_t bytes_to_write, 43 int32_t bytes_to_write,
35 scoped_refptr<TrackedCallback> callback) OVERRIDE; 44 scoped_refptr<TrackedCallback> callback) OVERRIDE;
45 virtual int32_t Listen(int32_t backlog,
46 scoped_refptr<TrackedCallback> callback) OVERRIDE;
47 virtual int32_t Accept(PP_Resource* accepted_tcp_socket,
48 scoped_refptr<TrackedCallback> callback) OVERRIDE;
36 virtual void Close() OVERRIDE; 49 virtual void Close() OVERRIDE;
37 virtual int32_t SetOption(PP_TCPSocket_Option name, 50 virtual int32_t SetOption(PP_TCPSocket_Option name,
38 const PP_Var& value, 51 const PP_Var& value,
39 scoped_refptr<TrackedCallback> callback) OVERRIDE; 52 scoped_refptr<TrackedCallback> callback) OVERRIDE;
40 53
54 // TCPSocketResourceBase implementation.
55 virtual PP_Resource CreateAcceptedSocket(
56 int pending_host_id,
57 const PP_NetAddress_Private& local_addr,
58 const PP_NetAddress_Private& remote_addr) OVERRIDE;
59
41 private: 60 private:
61 // C-tor used for accepted sockets.
62 TCPSocketResource(Connection connection,
63 PP_Instance instance,
64 int pending_host_id,
65 const PP_NetAddress_Private& local_addr,
66 const PP_NetAddress_Private& remote_addr);
67
42 DISALLOW_COPY_AND_ASSIGN(TCPSocketResource); 68 DISALLOW_COPY_AND_ASSIGN(TCPSocketResource);
43 }; 69 };
44 70
45 } // namespace proxy 71 } // namespace proxy
46 } // namespace ppapi 72 } // namespace ppapi
47 73
48 #endif // PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_ 74 #endif // PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/tcp_socket_private_resource.cc ('k') | ppapi/proxy/tcp_socket_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698