Pepper_56_C++_interfaces
Pepper_56_C++_interfaces
 All Classes Namespaces Files Functions Typedefs Enumerations Macros Groups
tcp_socket.h
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.
4 
5 #ifndef PPAPI_CPP_TCP_SOCKET_H_
6 #define PPAPI_CPP_TCP_SOCKET_H_
7 
8 #include <stdint.h>
9 
10 #include "ppapi/c/ppb_tcp_socket.h"
11 #include "ppapi/cpp/net_address.h"
12 #include "ppapi/cpp/pass_ref.h"
13 #include "ppapi/cpp/resource.h"
14 
15 namespace pp {
16 
17 class CompletionCallback;
18 class InstanceHandle;
19 
20 template <typename T> class CompletionCallbackWithOutput;
21 
29 class TCPSocket : public Resource {
30  public:
33  TCPSocket();
34 
39  explicit TCPSocket(const InstanceHandle& instance);
40 
45  TCPSocket(PassRef, PP_Resource resource);
46 
50  TCPSocket(const TCPSocket& other);
51 
53  virtual ~TCPSocket();
54 
60  TCPSocket& operator=(const TCPSocket& other);
61 
66  static bool IsAvailable();
67 
78  int32_t Bind(const NetAddress& addr, const CompletionCallback& callback);
79 
103  int32_t Connect(const NetAddress& addr, const CompletionCallback& callback);
104 
109  NetAddress GetLocalAddress() const;
110 
116 
142  int32_t Read(char* buffer,
143  int32_t bytes_to_read,
144  const CompletionCallback& callback);
145 
156  int32_t Write(const char* buffer,
157  int32_t bytes_to_write,
158  const CompletionCallback& callback);
159 
173  int32_t Listen(int32_t backlog,
174  const CompletionCallback& callback);
175 
184  int32_t Accept(const CompletionCallbackWithOutput<TCPSocket>& callback);
185 
195  void Close();
196 
207  int32_t SetOption(PP_TCPSocket_Option name,
208  const Var& value,
209  const CompletionCallback& callback);
210 };
211 
212 } // namespace pp
213 
214 #endif // PPAPI_CPP_TCP_SOCKET_H_
int32_t Listen(int32_t backlog, const CompletionCallback &callback)
int32_t SetOption(PP_TCPSocket_Option name, const Var &value, const CompletionCallback &callback)
Definition: tcp_socket.h:29
NetAddress GetLocalAddress() const
Definition: completion_callback.h:189
int32_t Bind(const NetAddress &addr, const CompletionCallback &callback)
virtual ~TCPSocket()
The destructor.
int32_t Accept(const CompletionCallbackWithOutput< TCPSocket > &callback)
int32_t Read(char *buffer, int32_t bytes_to_read, const CompletionCallback &callback)
int32_t Connect(const NetAddress &addr, const CompletionCallback &callback)
The NetAddress class represents a network address.
Definition: net_address.h:18
Definition: completion_callback.h:26
TCPSocket & operator=(const TCPSocket &other)
Definition: instance_handle.h:44
PassRef
Definition: pass_ref.h:17
int32_t Write(const char *buffer, int32_t bytes_to_write, const CompletionCallback &callback)
NetAddress GetRemoteAddress() const
A generic type used for passing data types between the module and the page.
Definition: var.h:23
A reference counted module resource.
Definition: resource.h:20
static bool IsAvailable()