7 #include "ppapi/c/pp_bool.h"
8 #include "ppapi/c/pp_errors.h"
19 template <>
const char* interface_name<PPB_UDPSocket_Private_0_4>() {
20 return PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4;
23 template <>
const char* interface_name<PPB_UDPSocket_Private_0_3>() {
24 return PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3;
30 if (has_interface<PPB_UDPSocket_Private_0_4>()) {
33 }
else if (has_interface<PPB_UDPSocket_Private_0_3>()) {
41 return has_interface<PPB_UDPSocket_Private_0_4>() ||
42 has_interface<PPB_UDPSocket_Private_0_3>();
47 if (has_interface<PPB_UDPSocket_Private_0_4>()) {
51 return PP_ERROR_NOINTERFACE;
56 if (has_interface<PPB_UDPSocket_Private_0_4>()) {
57 return get_interface<PPB_UDPSocket_Private_0_4>()->
Bind(
60 if (has_interface<PPB_UDPSocket_Private_0_3>()) {
61 return get_interface<PPB_UDPSocket_Private_0_3>()->
Bind(
64 return callback.
MayForce(PP_ERROR_NOINTERFACE);
68 if (has_interface<PPB_UDPSocket_Private_0_4>()) {
72 return PP_ToBool(result);
74 if (has_interface<PPB_UDPSocket_Private_0_3>()) {
78 return PP_ToBool(result);
86 if (has_interface<PPB_UDPSocket_Private_0_4>()) {
87 return get_interface<PPB_UDPSocket_Private_0_4>()->
RecvFrom(
90 if (has_interface<PPB_UDPSocket_Private_0_3>()) {
91 return get_interface<PPB_UDPSocket_Private_0_3>()->
RecvFrom(
94 return callback.
MayForce(PP_ERROR_NOINTERFACE);
98 if (has_interface<PPB_UDPSocket_Private_0_4>()) {
102 return PP_ToBool(result);
104 if (has_interface<PPB_UDPSocket_Private_0_3>()) {
108 return PP_ToBool(result);
115 const PP_NetAddress_Private* addr,
117 if (has_interface<PPB_UDPSocket_Private_0_4>()) {
118 return get_interface<PPB_UDPSocket_Private_0_4>()->
SendTo(
122 if (has_interface<PPB_UDPSocket_Private_0_3>()) {
123 return get_interface<PPB_UDPSocket_Private_0_3>()->
SendTo(
127 return callback.
MayForce(PP_ERROR_NOINTERFACE);
131 if (has_interface<PPB_UDPSocket_Private_0_4>())
133 if (has_interface<PPB_UDPSocket_Private_0_3>())
134 return get_interface<PPB_UDPSocket_Private_0_3>()->Close(
pp_resource());
void PassRefFromConstructor(PP_Resource resource)
int32_t MayForce(int32_t result) const
const PP_CompletionCallback & pp_completion_callback() const
bool GetRecvFromAddress(PP_NetAddress_Private *addr)
int32_t Bind(const PP_NetAddress_Private *addr, const CompletionCallback &callback)
int32_t RecvFrom(char *buffer, int32_t num_bytes, const CompletionCallback &callback)
const PP_Var & pp_var() const
static bool IsAvailable()
UDPSocketPrivate(const InstanceHandle &instance)
PP_Resource pp_resource() const
bool GetBoundAddress(PP_NetAddress_Private *addr)
int32_t SendTo(const char *buffer, int32_t num_bytes, const PP_NetAddress_Private *addr, const CompletionCallback &callback)
int32_t SetSocketFeature(PP_UDPSocketFeature_Private name, const Var &value)
A generic type used for passing data types between the module and the page.
PP_Instance pp_instance() const