Pepper_31_C_interfaces
|
#include <ppb_udp_socket.h>
Public Attributes | |
PP_Resource(* | Create )(PP_Instance instance) |
PP_Bool(* | IsUDPSocket )(PP_Resource resource) |
int32_t(* | Bind )(PP_Resource udp_socket, PP_Resource addr, struct PP_CompletionCallback callback) |
PP_Resource(* | GetBoundAddress )(PP_Resource udp_socket) |
int32_t(* | RecvFrom )(PP_Resource udp_socket, char *buffer, int32_t num_bytes, PP_Resource *addr, struct PP_CompletionCallback callback) |
int32_t(* | SendTo )(PP_Resource udp_socket, const char *buffer, int32_t num_bytes, PP_Resource addr, struct PP_CompletionCallback callback) |
void(* | Close )(PP_Resource udp_socket) |
int32_t(* | SetOption )(PP_Resource udp_socket, PP_UDPSocket_Option name, struct PP_Var value, struct PP_CompletionCallback callback) |
The PPB_UDPSocket
interface provides UDP socket operations.
Permissions: Apps permission socket
with subrule udp-bind
is required for Bind()
; subrule udp-send-to
is required for SendTo()
. For more details about network communication permissions, please see: http://developer.chrome.com/apps/app_network.html
Definition at line 87 of file ppb_udp_socket.h.
int32_t(* PPB_UDPSocket_1_0::Bind)(PP_Resource udp_socket, PP_Resource addr, struct PP_CompletionCallback callback) |
Binds the socket to the given address.
[in] | udp_socket | A PP_Resource corresponding to a UDP socket. |
[in] | addr | A PPB_NetAddress resource. |
[in] | callback | A PP_CompletionCallback to be called upon completion. |
pp_errors.h
. PP_ERROR_NOACCESS
will be returned if the caller doesn't have required permissions. PP_ERROR_ADDRESS_IN_USE
will be returned if the address is already in use. Definition at line 121 of file ppb_udp_socket.h.
void(* PPB_UDPSocket_1_0::Close)(PP_Resource udp_socket) |
Cancels all pending reads and writes, and closes the socket. Any pending callbacks will still run, reporting PP_ERROR_ABORTED
if pending IO was interrupted. After a call to this method, no output parameters passed into previous RecvFrom()
calls will be accessed. It is not valid to call Bind()
again.
The socket is implicitly closed if it is destroyed, so you are not required to call this method.
[in] | udp_socket | A PP_Resource corresponding to a UDP socket. |
Definition at line 190 of file ppb_udp_socket.h.
PP_Resource(* PPB_UDPSocket_1_0::Create)(PP_Instance instance) |
Creates a UDP socket resource.
[in] | instance | A PP_Instance identifying one instance of a module. |
PP_Resource
corresponding to a UDP socket or 0 on failure. Definition at line 97 of file ppb_udp_socket.h.
PP_Resource(* PPB_UDPSocket_1_0::GetBoundAddress)(PP_Resource udp_socket) |
Gets the address that the socket is bound to. The socket must be bound.
[in] | udp_socket | A PP_Resource corresponding to a UDP socket. |
PPB_NetAddress
resource on success or 0 on failure. Definition at line 132 of file ppb_udp_socket.h.
PP_Bool(* PPB_UDPSocket_1_0::IsUDPSocket)(PP_Resource resource) |
Determines if a given resource is a UDP socket.
[in] | resource | A PP_Resource to check. |
PP_TRUE
if the input is a PPB_UDPSocket
resource; PP_FALSE
otherwise. Definition at line 106 of file ppb_udp_socket.h.
int32_t(* PPB_UDPSocket_1_0::RecvFrom)(PP_Resource udp_socket, char *buffer, int32_t num_bytes, PP_Resource *addr, struct PP_CompletionCallback callback) |
Receives data from the socket and stores the source address. The socket must be bound.
[in] | udp_socket | A PP_Resource corresponding to a UDP socket. |
[out] | buffer | The buffer to store the received data on success. It must be at least as large as num_bytes . |
[in] | num_bytes | The number of bytes to receive. |
[out] | addr | A PPB_NetAddress resource to store the source address on success. |
[in] | callback | A PP_CompletionCallback to be called upon completion. |
pp_errors.h
. Definition at line 150 of file ppb_udp_socket.h.
int32_t(* PPB_UDPSocket_1_0::SendTo)(PP_Resource udp_socket, const char *buffer, int32_t num_bytes, PP_Resource addr, struct PP_CompletionCallback callback) |
Sends data to a specific destination. The socket must be bound.
[in] | udp_socket | A PP_Resource corresponding to a UDP socket. |
[in] | buffer | The buffer containing the data to send. |
[in] | num_bytes | The number of bytes to send. |
[in] | addr | A PPB_NetAddress resource holding the destination address. |
[in] | callback | A PP_CompletionCallback to be called upon completion. |
pp_errors.h
. PP_ERROR_NOACCESS
will be returned if the caller doesn't have required permissions. Definition at line 172 of file ppb_udp_socket.h.
int32_t(* PPB_UDPSocket_1_0::SetOption)(PP_Resource udp_socket, PP_UDPSocket_Option name, struct PP_Var value, struct PP_CompletionCallback callback) |
Sets a socket option on the UDP socket. Please see the PP_UDPSocket_Option
description for option names, value types and allowed values.
[in] | udp_socket | A PP_Resource corresponding to a UDP socket. |
[in] | name | The option to set. |
[in] | value | The option value to set. |
[in] | callback | A PP_CompletionCallback to be called upon completion. |
pp_errors.h
. Definition at line 205 of file ppb_udp_socket.h.