OLD | NEW |
1 /* Copyright 2013 The Chromium Authors. All rights reserved. | 1 /* Copyright 2013 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</code> interface. | 7 * This file defines the <code>PPB_UDPSocket</code> interface. |
8 */ | 8 */ |
9 | 9 |
10 [generate_thunk] | |
11 | |
12 label Chrome { | 10 label Chrome { |
13 M29 = 1.0 | 11 M29 = 1.0, |
| 12 M41 = 1.1 |
14 }; | 13 }; |
15 | 14 |
16 /** | 15 /** |
17 * Option names used by <code>SetOption()</code>. | 16 * Option names used by <code>SetOption()</code>. |
18 */ | 17 */ |
19 [assert_size(4)] | 18 [assert_size(4)] |
20 enum PP_UDPSocket_Option { | 19 enum PP_UDPSocket_Option { |
21 /** | 20 /** |
22 * Allows the socket to share the local address to which it will be bound with | 21 * Allows the socket to share the local address to which it will be bound with |
23 * other processes. Value's type should be <code>PP_VARTYPE_BOOL</code>. | 22 * other processes. Value's type should be <code>PP_VARTYPE_BOOL</code>. |
24 * This option can only be set before calling <code>Bind()</code>. | 23 * This option can only be set before calling <code>Bind()</code>. |
25 */ | 24 */ |
26 PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, | 25 PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, |
27 | 26 |
28 /** | 27 /** |
29 * Allows sending and receiving packets to and from broadcast addresses. | 28 * Allows sending and receiving packets to and from broadcast addresses. |
30 * Value's type should be <code>PP_VARTYPE_BOOL</code>. | 29 * Value's type should be <code>PP_VARTYPE_BOOL</code>. |
31 * This option can only be set before calling <code>Bind()</code>. | 30 * On version 1.0, this option can only be set before calling |
| 31 * <code>Bind()</code>. On version 1.1 or later, there is no such limitation. |
32 */ | 32 */ |
33 PP_UDPSOCKET_OPTION_BROADCAST = 1, | 33 PP_UDPSOCKET_OPTION_BROADCAST = 1, |
34 | 34 |
35 /** | 35 /** |
36 * Specifies the total per-socket buffer space reserved for sends. Value's | 36 * Specifies the total per-socket buffer space reserved for sends. Value's |
37 * type should be <code>PP_VARTYPE_INT32</code>. | 37 * type should be <code>PP_VARTYPE_INT32</code>. |
38 * This option can only be set after a successful <code>Bind()</code> call. | 38 * On version 1.0, this option can only be set after a successful |
| 39 * <code>Bind()</code> call. On version 1.1 or later, there is no such |
| 40 * limitation. |
39 * | 41 * |
40 * Note: This is only treated as a hint for the browser to set the buffer | 42 * Note: This is only treated as a hint for the browser to set the buffer |
41 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't | 43 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't |
42 * guarantee it will conform to the size. | 44 * guarantee it will conform to the size. |
43 */ | 45 */ |
44 PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, | 46 PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, |
45 | 47 |
46 /** | 48 /** |
47 * Specifies the total per-socket buffer space reserved for receives. Value's | 49 * Specifies the total per-socket buffer space reserved for receives. Value's |
48 * type should be <code>PP_VARTYPE_INT32</code>. | 50 * type should be <code>PP_VARTYPE_INT32</code>. |
49 * This option can only be set after a successful <code>Bind()</code> call. | 51 * On version 1.0, this option can only be set after a successful |
| 52 * <code>Bind()</code> call. On version 1.1 or later, there is no such |
| 53 * limitation. |
50 * | 54 * |
51 * Note: This is only treated as a hint for the browser to set the buffer | 55 * Note: This is only treated as a hint for the browser to set the buffer |
52 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't | 56 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't |
53 * guarantee it will conform to the size. | 57 * guarantee it will conform to the size. |
54 */ | 58 */ |
55 PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3 | 59 PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3 |
56 }; | 60 }; |
57 | 61 |
58 /** | 62 /** |
59 * The <code>PPB_UDPSocket</code> interface provides UDP socket operations. | 63 * The <code>PPB_UDPSocket</code> interface provides UDP socket operations. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 * @param[in] value The option value to set. | 190 * @param[in] value The option value to set. |
187 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 191 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
188 * completion. | 192 * completion. |
189 * | 193 * |
190 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 194 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
191 */ | 195 */ |
192 int32_t SetOption([in] PP_Resource udp_socket, | 196 int32_t SetOption([in] PP_Resource udp_socket, |
193 [in] PP_UDPSocket_Option name, | 197 [in] PP_UDPSocket_Option name, |
194 [in] PP_Var value, | 198 [in] PP_Var value, |
195 [in] PP_CompletionCallback callback); | 199 [in] PP_CompletionCallback callback); |
| 200 |
| 201 /** |
| 202 * Sets a socket option on the UDP socket. |
| 203 * Please see the <code>PP_UDPSocket_Option</code> description for option |
| 204 * names, value types and allowed values. |
| 205 * |
| 206 * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP |
| 207 * socket. |
| 208 * @param[in] name The option to set. |
| 209 * @param[in] value The option value to set. |
| 210 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 211 * completion. |
| 212 * |
| 213 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 214 */ |
| 215 [version=1.1] |
| 216 int32_t SetOption([in] PP_Resource udp_socket, |
| 217 [in] PP_UDPSocket_Option name, |
| 218 [in] PP_Var value, |
| 219 [in] PP_CompletionCallback callback); |
196 }; | 220 }; |
OLD | NEW |