OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /** | 6 /** |
7 * This file defines the <code>PPB_UDPSocket_Private</code> interface. | 7 * This file defines the <code>PPB_UDPSocket_Private</code> interface. |
8 */ | 8 */ |
9 | 9 |
10 label Chrome { | 10 label Chrome { |
11 M17 = 0.2, | 11 M17 = 0.2, |
12 M19 = 0.3 | 12 M19 = 0.3, |
| 13 M23 = 0.4 |
| 14 }; |
| 15 |
| 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_ADDRESS_REUSE = 0, |
| 22 |
| 23 // Allow sending and receiving packets sent to and from broadcast |
| 24 // addresses. Value's type should be PP_VARTYPE_BOOL. |
| 25 PP_UDPSOCKETFEATURE_BROADCAST = 1, |
| 26 |
| 27 // Special value for counting the number of available |
| 28 // features. Should not be passed to SetSocketFeature(). |
| 29 PP_UDPSOCKETFEATURE_COUNT = 2 |
13 }; | 30 }; |
14 | 31 |
15 interface PPB_UDPSocket_Private { | 32 interface PPB_UDPSocket_Private { |
16 /** | 33 /** |
17 * Creates a UDP socket resource. | 34 * Creates a UDP socket resource. |
18 */ | 35 */ |
19 PP_Resource Create([in] PP_Instance instance_id); | 36 PP_Resource Create([in] PP_Instance instance_id); |
20 | 37 |
21 /** | 38 /** |
22 * Determines if a given resource is a UDP socket. | 39 * Determines if a given resource is a UDP socket. |
23 */ | 40 */ |
24 PP_Bool IsUDPSocket([in] PP_Resource resource_id); | 41 PP_Bool IsUDPSocket([in] PP_Resource resource_id); |
25 | 42 |
| 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. |
| 51 */ |
| 52 [version=0.4] |
| 53 int32_t SetSocketFeature([in] PP_Resource udp_socket, |
| 54 [in] PP_UDPSocketFeature_Private name, |
| 55 [in] PP_Var value); |
| 56 |
26 /* Creates a socket and binds to the address given by |addr|. */ | 57 /* Creates a socket and binds to the address given by |addr|. */ |
27 int32_t Bind([in] PP_Resource udp_socket, | 58 int32_t Bind([in] PP_Resource udp_socket, |
28 [in] PP_NetAddress_Private addr, | 59 [in] PP_NetAddress_Private addr, |
29 [in] PP_CompletionCallback callback); | 60 [in] PP_CompletionCallback callback); |
30 | 61 |
31 /* Returns the address that the socket has bound to. A successful | 62 /* Returns the address that the socket has bound to. A successful |
32 * call to Bind must be called first. Returns PP_FALSE if Bind | 63 * call to Bind must be called first. Returns PP_FALSE if Bind |
33 * fails, or if Close has been called. | 64 * fails, or if Close has been called. |
34 */ | 65 */ |
35 [version=0.3] | 66 [version=0.3] |
(...skipping 22 matching lines...) Expand all Loading... |
58 */ | 89 */ |
59 int32_t SendTo([in] PP_Resource udp_socket, | 90 int32_t SendTo([in] PP_Resource udp_socket, |
60 [in] str_t buffer, | 91 [in] str_t buffer, |
61 [in] int32_t num_bytes, | 92 [in] int32_t num_bytes, |
62 [in] PP_NetAddress_Private addr, | 93 [in] PP_NetAddress_Private addr, |
63 [in] PP_CompletionCallback callback); | 94 [in] PP_CompletionCallback callback); |
64 | 95 |
65 /* Cancels all pending reads and writes, and closes the socket. */ | 96 /* Cancels all pending reads and writes, and closes the socket. */ |
66 void Close([in] PP_Resource udp_socket); | 97 void Close([in] PP_Resource udp_socket); |
67 }; | 98 }; |
OLD | NEW |