cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / ppapi / api / private / ppb_udp_socket_private.idl
blob9888a548e9951bc7197e608cb5d58d32153ef895
1 /* Copyright (c) 2012 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 */
6 /**
7 * This file defines the <code>PPB_UDPSocket_Private</code> interface.
8 */
10 label Chrome {
11 M17 = 0.2,
12 M19 = 0.3,
13 M23 = 0.4
16 [assert_size(4)]
17 enum PP_UDPSocketFeature_Private {
18 // Allow the socket to share the local address to which socket will
19 // be bound with other processes. Value's type should be
20 // PP_VARTYPE_BOOL.
21 PP_UDPSOCKETFEATURE_PRIVATE_ADDRESS_REUSE = 0,
23 // Allow sending and receiving packets sent to and from broadcast
24 // addresses. Value's type should be PP_VARTYPE_BOOL.
25 PP_UDPSOCKETFEATURE_PRIVATE_BROADCAST = 1,
27 // Special value for counting the number of available
28 // features. Should not be passed to SetSocketFeature().
29 PP_UDPSOCKETFEATURE_PRIVATE_COUNT = 2
32 interface PPB_UDPSocket_Private {
33 /**
34 * Creates a UDP socket resource.
36 PP_Resource Create([in] PP_Instance instance_id);
38 /**
39 * Determines if a given resource is a UDP socket.
41 PP_Bool IsUDPSocket([in] PP_Resource resource_id);
43 /**
44 * Sets a socket feature to |udp_socket|. Should be called before
45 * Bind(). Possible values for |name|, |value| and |value|'s type
46 * are described in PP_UDPSocketFeature_Private description. If no
47 * error occurs, returns PP_OK. Otherwise, returns
48 * PP_ERROR_BADRESOURCE (if bad |udp_socket| provided),
49 * PP_ERROR_BADARGUMENT (if bad name/value/value's type provided)
50 * or PP_ERROR_FAILED in the case of internal errors.
52 [version=0.4]
53 int32_t SetSocketFeature([in] PP_Resource udp_socket,
54 [in] PP_UDPSocketFeature_Private name,
55 [in] PP_Var value);
57 /* Creates a socket and binds to the address given by |addr|. */
58 int32_t Bind([in] PP_Resource udp_socket,
59 [in] PP_NetAddress_Private addr,
60 [in] PP_CompletionCallback callback);
62 /* Returns the address that the socket has bound to. A successful
63 * call to Bind must be called first. Returns PP_FALSE if Bind
64 * fails, or if Close has been called.
66 [version=0.3]
67 PP_Bool GetBoundAddress([in] PP_Resource udp_socket,
68 [out] PP_NetAddress_Private addr);
70 /* Performs a non-blocking recvfrom call on socket.
71 * Bind must be called first. |callback| is invoked when recvfrom
72 * reads data. You must call GetRecvFromAddress to recover the
73 * address the data was retrieved from.
75 int32_t RecvFrom([in] PP_Resource udp_socket,
76 [out] str_t buffer,
77 [in] int32_t num_bytes,
78 [in] PP_CompletionCallback callback);
80 /* Upon successful completion of RecvFrom, the address that the data
81 * was received from is stored in |addr|.
83 PP_Bool GetRecvFromAddress([in] PP_Resource udp_socket,
84 [out] PP_NetAddress_Private addr);
86 /* Performs a non-blocking sendto call on the socket created and
87 * bound(has already called Bind). The callback |callback| is
88 * invoked when sendto completes.
90 int32_t SendTo([in] PP_Resource udp_socket,
91 [in] str_t buffer,
92 [in] int32_t num_bytes,
93 [in] PP_NetAddress_Private addr,
94 [in] PP_CompletionCallback callback);
96 /* Cancels all pending reads and writes, and closes the socket. */
97 void Close([in] PP_Resource udp_socket);