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 PP_ERROR_FAILED. |
| 48 */ |
| 49 [version=0.4] |
| 50 int32_t SetSocketFeature([in] PP_Resource udp_socket, |
| 51 [in] PP_UDPSocketFeature_Private name, |
| 52 [in] PP_Var value); |
| 53 |
26 /* Creates a socket and binds to the address given by |addr|. */ | 54 /* Creates a socket and binds to the address given by |addr|. */ |
27 int32_t Bind([in] PP_Resource udp_socket, | 55 int32_t Bind([in] PP_Resource udp_socket, |
28 [in] PP_NetAddress_Private addr, | 56 [in] PP_NetAddress_Private addr, |
29 [in] PP_CompletionCallback callback); | 57 [in] PP_CompletionCallback callback); |
30 | 58 |
31 /* Returns the address that the socket has bound to. A successful | 59 /* Returns the address that the socket has bound to. A successful |
32 * call to Bind must be called first. Returns PP_FALSE if Bind | 60 * call to Bind must be called first. Returns PP_FALSE if Bind |
33 * fails, or if Close has been called. | 61 * fails, or if Close has been called. |
34 */ | 62 */ |
35 [version=0.3] | 63 [version=0.3] |
(...skipping 22 matching lines...) Expand all Loading... |
58 */ | 86 */ |
59 int32_t SendTo([in] PP_Resource udp_socket, | 87 int32_t SendTo([in] PP_Resource udp_socket, |
60 [in] str_t buffer, | 88 [in] str_t buffer, |
61 [in] int32_t num_bytes, | 89 [in] int32_t num_bytes, |
62 [in] PP_NetAddress_Private addr, | 90 [in] PP_NetAddress_Private addr, |
63 [in] PP_CompletionCallback callback); | 91 [in] PP_CompletionCallback callback); |
64 | 92 |
65 /* Cancels all pending reads and writes, and closes the socket. */ | 93 /* Cancels all pending reads and writes, and closes the socket. */ |
66 void Close([in] PP_Resource udp_socket); | 94 void Close([in] PP_Resource udp_socket); |
67 }; | 95 }; |
OLD | NEW |