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 M40 = 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 * On version 1.0, this option can only be set before calling |
| 24 * <code>Bind()</code>. On version 1.1 or later, there is no such limitation. |
25 */ | 25 */ |
26 PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, | 26 PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, |
27 | 27 |
28 /** | 28 /** |
29 * Allows sending and receiving packets to and from broadcast addresses. | 29 * Allows sending and receiving packets to and from broadcast addresses. |
30 * Value's type should be <code>PP_VARTYPE_BOOL</code>. | 30 * Value's type should be <code>PP_VARTYPE_BOOL</code>. |
31 * This option can only be set before calling <code>Bind()</code>. | 31 * On version 1.0, this option can only be set before calling |
| 32 * <code>Bind()</code>. On version 1.1 or later, there is no such limitation. |
32 */ | 33 */ |
33 PP_UDPSOCKET_OPTION_BROADCAST = 1, | 34 PP_UDPSOCKET_OPTION_BROADCAST = 1, |
34 | 35 |
35 /** | 36 /** |
36 * Specifies the total per-socket buffer space reserved for sends. Value's | 37 * Specifies the total per-socket buffer space reserved for sends. Value's |
37 * type should be <code>PP_VARTYPE_INT32</code>. | 38 * type should be <code>PP_VARTYPE_INT32</code>. |
38 * This option can only be set after a successful <code>Bind()</code> call. | 39 * On version 1.0, this option can only be set after a successful |
| 40 * <code>Bind()</code> call. On version 1.1 or later, there is no such |
| 41 * limitation. |
39 * | 42 * |
40 * Note: This is only treated as a hint for the browser to set the buffer | 43 * 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 | 44 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't |
42 * guarantee it will conform to the size. | 45 * guarantee it will conform to the size. |
43 */ | 46 */ |
44 PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, | 47 PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, |
45 | 48 |
46 /** | 49 /** |
47 * Specifies the total per-socket buffer space reserved for receives. Value's | 50 * Specifies the total per-socket buffer space reserved for receives. Value's |
48 * type should be <code>PP_VARTYPE_INT32</code>. | 51 * type should be <code>PP_VARTYPE_INT32</code>. |
49 * This option can only be set after a successful <code>Bind()</code> call. | 52 * On version 1.0, this option can only be set after a successful |
| 53 * <code>Bind()</code> call. On version 1.1 or later, there is no such |
| 54 * limitation. |
50 * | 55 * |
51 * Note: This is only treated as a hint for the browser to set the buffer | 56 * 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 | 57 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't |
53 * guarantee it will conform to the size. | 58 * guarantee it will conform to the size. |
54 */ | 59 */ |
55 PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3 | 60 PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3 |
56 }; | 61 }; |
57 | 62 |
58 /** | 63 /** |
59 * The <code>PPB_UDPSocket</code> interface provides UDP socket operations. | 64 * 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. | 191 * @param[in] value The option value to set. |
187 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 192 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
188 * completion. | 193 * completion. |
189 * | 194 * |
190 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 195 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
191 */ | 196 */ |
192 int32_t SetOption([in] PP_Resource udp_socket, | 197 int32_t SetOption([in] PP_Resource udp_socket, |
193 [in] PP_UDPSocket_Option name, | 198 [in] PP_UDPSocket_Option name, |
194 [in] PP_Var value, | 199 [in] PP_Var value, |
195 [in] PP_CompletionCallback callback); | 200 [in] PP_CompletionCallback callback); |
| 201 |
| 202 /** |
| 203 * Sets a socket option on the UDP socket. |
| 204 * Please see the <code>PP_UDPSocket_Option</code> description for option |
| 205 * names, value types and allowed values. |
| 206 * |
| 207 * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP |
| 208 * socket. |
| 209 * @param[in] name The option to set. |
| 210 * @param[in] value The option value to set. |
| 211 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 212 * completion. |
| 213 * |
| 214 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 215 */ |
| 216 [version=1.1] |
| 217 int32_t SetOption([in] PP_Resource udp_socket, |
| 218 [in] PP_UDPSocket_Option name, |
| 219 [in] PP_Var value, |
| 220 [in] PP_CompletionCallback callback); |
196 }; | 221 }; |
OLD | NEW |