Pepper_31_C_interfaces
Public Attributes | List of all members
PPB_UDPSocket_1_0 Struct Reference

#include <ppb_udp_socket.h>

Collaboration diagram for PPB_UDPSocket_1_0:
Collaboration graph

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)
 

Detailed Description

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.

Member Data Documentation

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.

Parameters
[in]udp_socketA PP_Resource corresponding to a UDP socket.
[in]addrA PPB_NetAddress resource.
[in]callbackA PP_CompletionCallback to be called upon completion.
Returns
An int32_t containing an error code from 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.

Parameters
[in]udp_socketA 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.

Parameters
[in]instanceA PP_Instance identifying one instance of a module.
Returns
A 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.

Parameters
[in]udp_socketA PP_Resource corresponding to a UDP socket.
Returns
A 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.

Parameters
[in]resourceA PP_Resource to check.
Returns
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.

Parameters
[in]udp_socketA PP_Resource corresponding to a UDP socket.
[out]bufferThe buffer to store the received data on success. It must be at least as large as num_bytes.
[in]num_bytesThe number of bytes to receive.
[out]addrA PPB_NetAddress resource to store the source address on success.
[in]callbackA PP_CompletionCallback to be called upon completion.
Returns
A non-negative number on success to indicate how many bytes have been received; otherwise, an error code from 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.

Parameters
[in]udp_socketA PP_Resource corresponding to a UDP socket.
[in]bufferThe buffer containing the data to send.
[in]num_bytesThe number of bytes to send.
[in]addrA PPB_NetAddress resource holding the destination address.
[in]callbackA PP_CompletionCallback to be called upon completion.
Returns
A non-negative number on success to indicate how many bytes have been sent; otherwise, an error code from 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.

Parameters
[in]udp_socketA PP_Resource corresponding to a UDP socket.
[in]nameThe option to set.
[in]valueThe option value to set.
[in]callbackA PP_CompletionCallback to be called upon completion.
Returns
An int32_t containing an error code from pp_errors.h.

Definition at line 205 of file ppb_udp_socket.h.


The documentation for this struct was generated from the following file: