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

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
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/c/ppb_net_address.h"
10 #include "ppapi/proxy/tcp_socket_resource_base.h" 11 #include "ppapi/proxy/tcp_socket_resource_base.h"
11 #include "ppapi/thunk/ppb_tcp_socket_api.h" 12 #include "ppapi/thunk/ppb_tcp_socket_api.h"
12 13
13 namespace ppapi { 14 namespace ppapi {
14 namespace proxy { 15 namespace proxy {
15 16
16 class PPAPI_PROXY_EXPORT TCPSocketResource : public thunk::PPB_TCPSocket_API, 17 class PPAPI_PROXY_EXPORT TCPSocketResource : public thunk::PPB_TCPSocket_API,
17 public TCPSocketResourceBase { 18 public TCPSocketResourceBase {
18 public: 19 public:
20 // C-tor used for new sockets created.
19 TCPSocketResource(Connection connection, PP_Instance instance); 21 TCPSocketResource(Connection connection, PP_Instance instance);
22 TCPSocketResource(Connection connection,
23 PP_Instance instance,
24 PP_NetAddress_Family family);
25
20 virtual ~TCPSocketResource(); 26 virtual ~TCPSocketResource();
21 27
22 // PluginResource overrides. 28 // PluginResource overrides.
23 virtual thunk::PPB_TCPSocket_API* AsPPB_TCPSocket_API() OVERRIDE; 29 virtual thunk::PPB_TCPSocket_API* AsPPB_TCPSocket_API() OVERRIDE;
24 30
25 // thunk::PPB_TCPSocket_API implementation. 31 // thunk::PPB_TCPSocket_API implementation.
32 virtual int32_t Bind(PP_Resource addr,
33 scoped_refptr<TrackedCallback> callback) OVERRIDE;
26 virtual int32_t Connect(PP_Resource addr, 34 virtual int32_t Connect(PP_Resource addr,
27 scoped_refptr<TrackedCallback> callback) OVERRIDE; 35 scoped_refptr<TrackedCallback> callback) OVERRIDE;
28 virtual PP_Resource GetLocalAddress() OVERRIDE; 36 virtual PP_Resource GetLocalAddress() OVERRIDE;
29 virtual PP_Resource GetRemoteAddress() OVERRIDE; 37 virtual PP_Resource GetRemoteAddress() OVERRIDE;
30 virtual int32_t Read(char* buffer, 38 virtual int32_t Read(char* buffer,
31 int32_t bytes_to_read, 39 int32_t bytes_to_read,
32 scoped_refptr<TrackedCallback> callback) OVERRIDE; 40 scoped_refptr<TrackedCallback> callback) OVERRIDE;
33 virtual int32_t Write(const char* buffer, 41 virtual int32_t Write(const char* buffer,
34 int32_t bytes_to_write, 42 int32_t bytes_to_write,
35 scoped_refptr<TrackedCallback> callback) OVERRIDE; 43 scoped_refptr<TrackedCallback> callback) OVERRIDE;
44 virtual int32_t Listen(int32_t backlog,
45 scoped_refptr<TrackedCallback> callback) OVERRIDE;
46 virtual int32_t Accept(PP_Resource* accepted_tcp_socket,
47 scoped_refptr<TrackedCallback> callback) OVERRIDE;
36 virtual void Close() OVERRIDE; 48 virtual void Close() OVERRIDE;
37 virtual int32_t SetOption(PP_TCPSocket_Option name, 49 virtual int32_t SetOption(PP_TCPSocket_Option name,
38 const PP_Var& value, 50 const PP_Var& value,
39 scoped_refptr<TrackedCallback> callback) OVERRIDE; 51 scoped_refptr<TrackedCallback> callback) OVERRIDE;
40 52
53 // TCPSocketResourceBase implementation.
54 virtual PP_Resource CreateAcceptedSocket(
55 int pending_host_id,
56 const PP_NetAddress_Private& local_addr,
57 const PP_NetAddress_Private& remote_addr) OVERRIDE;
58
41 private: 59 private:
60 // C-tor used for accepted sockets.
61 TCPSocketResource(Connection connection,
62 PP_Instance instance,
63 int pending_host_id,
64 const PP_NetAddress_Private& local_addr,
65 const PP_NetAddress_Private& remote_addr);
66
42 DISALLOW_COPY_AND_ASSIGN(TCPSocketResource); 67 DISALLOW_COPY_AND_ASSIGN(TCPSocketResource);
43 }; 68 };
44 69
45 } // namespace proxy 70 } // namespace proxy
46 } // namespace ppapi 71 } // namespace ppapi
47 72
48 #endif // PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_ 73 #endif // PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698