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
3 // found in the LICENSE file.
5 #ifndef PPAPI_THUNK_PPB_TCP_SOCKET_API_H_
6 #define PPAPI_THUNK_PPB_TCP_SOCKET_API_H_
8 #include "base/memory/ref_counted.h"
9 #include "ppapi/c/ppb_tcp_socket.h"
10 #include "ppapi/thunk/ppapi_thunk_export.h"
14 class TrackedCallback
;
18 class PPAPI_THUNK_EXPORT PPB_TCPSocket_API
{
20 virtual ~PPB_TCPSocket_API() {}
22 virtual int32_t Bind(PP_Resource addr
,
23 scoped_refptr
<TrackedCallback
> callback
) = 0;
24 virtual int32_t Connect(PP_Resource addr
,
25 scoped_refptr
<TrackedCallback
> callback
) = 0;
26 virtual PP_Resource
GetLocalAddress() = 0;
27 virtual PP_Resource
GetRemoteAddress() = 0;
28 virtual int32_t Read(char* buffer
,
29 int32_t bytes_to_read
,
30 scoped_refptr
<TrackedCallback
> callback
) = 0;
31 virtual int32_t Write(const char* buffer
,
32 int32_t bytes_to_write
,
33 scoped_refptr
<TrackedCallback
> callback
) = 0;
34 virtual int32_t Listen(int32_t backlog
,
35 scoped_refptr
<TrackedCallback
> callback
) = 0;
36 virtual int32_t Accept(PP_Resource
* accepted_tcp_socket
,
37 scoped_refptr
<TrackedCallback
> callback
) = 0;
38 virtual void Close() = 0;
39 virtual int32_t SetOption1_1(PP_TCPSocket_Option name
,
41 scoped_refptr
<TrackedCallback
> callback
) = 0;
42 virtual int32_t SetOption(PP_TCPSocket_Option name
,
44 scoped_refptr
<TrackedCallback
> callback
) = 0;
50 #endif // PPAPI_THUNK_PPB_TCP_SOCKET_API_H_