Pepper_56_C++_interfaces
Pepper_56_C++_interfaces
 All Classes Namespaces Files Functions Typedefs Enumerations Macros Groups
udp_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_UDP_SOCKET_H_
6 #define PPAPI_CPP_UDP_SOCKET_H_
7 
8 #include <stdint.h>
9 
10 #include "ppapi/c/ppb_udp_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 class Var;
20 
21 template <typename T> class CompletionCallbackWithOutput;
22 
30 class UDPSocket : public Resource {
31  public:
34  UDPSocket();
35 
40  explicit UDPSocket(const InstanceHandle& instance);
41 
46  UDPSocket(PassRef, PP_Resource resource);
47 
51  UDPSocket(const UDPSocket& other);
52 
54  virtual ~UDPSocket();
55 
61  UDPSocket& operator=(const UDPSocket& other);
62 
67  static bool IsAvailable();
68 
79  int32_t Bind(const NetAddress& addr,
80  const CompletionCallback& callback);
81 
87 
112  int32_t RecvFrom(
113  char* buffer,
114  int32_t num_bytes,
116 
133  int32_t SendTo(const char* buffer,
134  int32_t num_bytes,
135  const NetAddress& addr,
136  const CompletionCallback& callback);
137 
146  void Close();
147 
158  int32_t SetOption(PP_UDPSocket_Option name,
159  const Var& value,
160  const CompletionCallback& callback);
161 
171  int32_t JoinGroup(const NetAddress& group,
172  const CompletionCallback callback);
173 
183  int32_t LeaveGroup(const NetAddress& group,
184  const CompletionCallback callback);
185 };
186 
187 } // namespace pp
188 
189 #endif // PPAPI_CPP_UDP_SOCKET_H_
int32_t SetOption(PP_UDPSocket_Option name, const Var &value, const CompletionCallback &callback)
int32_t LeaveGroup(const NetAddress &group, const CompletionCallback callback)
Definition: completion_callback.h:189
int32_t JoinGroup(const NetAddress &group, const CompletionCallback callback)
NetAddress GetBoundAddress()
The NetAddress class represents a network address.
Definition: net_address.h:18
Definition: completion_callback.h:26
int32_t SendTo(const char *buffer, int32_t num_bytes, const NetAddress &addr, const CompletionCallback &callback)
virtual ~UDPSocket()
The destructor.
Definition: instance_handle.h:44
PassRef
Definition: pass_ref.h:17
int32_t RecvFrom(char *buffer, int32_t num_bytes, const CompletionCallbackWithOutput< NetAddress > &callback)
Definition: udp_socket.h:30
A generic type used for passing data types between the module and the page.
Definition: var.h:23
static bool IsAvailable()
int32_t Bind(const NetAddress &addr, const CompletionCallback &callback)
A reference counted module resource.
Definition: resource.h:20
UDPSocket & operator=(const UDPSocket &other)