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 label Chrome { | 10 label Chrome { |
11 M29 = 1.0, | 11 M29 = 1.0, |
12 M41 = 1.1 | 12 M41 = 1.1, |
| 13 [channel=dev] M42 = 1.2 |
13 }; | 14 }; |
14 | 15 |
15 /** | 16 /** |
16 * Option names used by <code>SetOption()</code>. | 17 * Option names used by <code>SetOption()</code>. |
17 */ | 18 */ |
18 [assert_size(4)] | 19 [assert_size(4)] |
19 enum PP_UDPSocket_Option { | 20 enum PP_UDPSocket_Option { |
20 /** | 21 /** |
21 * Allows the socket to share the local address to which it will be bound with | 22 * Allows the socket to share the local address to which it will be bound with |
22 * other processes. Value's type should be <code>PP_VARTYPE_BOOL</code>. | 23 * other processes. Value's type should be <code>PP_VARTYPE_BOOL</code>. |
(...skipping 26 matching lines...) Expand all Loading... |
49 * 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 |
50 * type should be <code>PP_VARTYPE_INT32</code>. | 51 * type should be <code>PP_VARTYPE_INT32</code>. |
51 * On version 1.0, this option can only be set after a successful | 52 * 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 * <code>Bind()</code> call. On version 1.1 or later, there is no such |
53 * limitation. | 54 * limitation. |
54 * | 55 * |
55 * 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 |
56 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't | 57 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't |
57 * guarantee it will conform to the size. | 58 * guarantee it will conform to the size. |
58 */ | 59 */ |
59 PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3 | 60 PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3, |
| 61 |
| 62 /** |
| 63 * Specifies whether the packets sent from the host to the multicast group |
| 64 * should be looped back to the host or not. Value's type should be |
| 65 * <code>PP_VARTYPE_BOOL</code>. |
| 66 * This option can only be set before calling <code>Bind()</code>. |
| 67 * |
| 68 * This is only supported in version 1.2 of the API (Chrome 42) and later. |
| 69 */ |
| 70 PP_UDPSOCKET_OPTION_MULTICAST_LOOP = 4, |
| 71 |
| 72 /** |
| 73 * Specifies the time-to-live for packets sent to the multicast group. The |
| 74 * value should be within 0 to 255 range. The default value is 1 and means |
| 75 * that packets will not be routed beyond the local network. Value's type |
| 76 * should be <code>PP_VARTYPE_INT32</code>. |
| 77 * This option can only be set before calling <code>Bind()</code>. |
| 78 * |
| 79 * This is only supported in version 1.2 of the API (Chrome 42) and later. |
| 80 */ |
| 81 PP_UDPSOCKET_OPTION_MULTICAST_TTL = 5 |
60 }; | 82 }; |
61 | 83 |
62 /** | 84 /** |
63 * The <code>PPB_UDPSocket</code> interface provides UDP socket operations. | 85 * The <code>PPB_UDPSocket</code> interface provides UDP socket operations. |
64 * | 86 * |
65 * Permissions: Apps permission <code>socket</code> with subrule | 87 * Permissions: Apps permission <code>socket</code> with subrule |
66 * <code>udp-bind</code> is required for <code>Bind()</code>; subrule | 88 * <code>udp-bind</code> is required for <code>Bind()</code>; subrule |
67 * <code>udp-send-to</code> is required for <code>SendTo()</code>. | 89 * <code>udp-send-to</code> is required for <code>SendTo()</code>. |
68 * For more details about network communication permissions, please see: | 90 * For more details about network communication permissions, please see: |
69 * http://developer.chrome.com/apps/app_network.html | 91 * http://developer.chrome.com/apps/app_network.html |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 235 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
214 * completion. | 236 * completion. |
215 * | 237 * |
216 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 238 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
217 */ | 239 */ |
218 [version=1.1] | 240 [version=1.1] |
219 int32_t SetOption([in] PP_Resource udp_socket, | 241 int32_t SetOption([in] PP_Resource udp_socket, |
220 [in] PP_UDPSocket_Option name, | 242 [in] PP_UDPSocket_Option name, |
221 [in] PP_Var value, | 243 [in] PP_Var value, |
222 [in] PP_CompletionCallback callback); | 244 [in] PP_CompletionCallback callback); |
| 245 |
| 246 /** |
| 247 * Sets a socket option on the UDP socket. |
| 248 * Please see the <code>PP_UDPSocket_Option</code> description for option |
| 249 * names, value types and allowed values. |
| 250 * |
| 251 * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP |
| 252 * socket. |
| 253 * @param[in] name The option to set. |
| 254 * @param[in] value The option value to set. |
| 255 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 256 * completion. |
| 257 * |
| 258 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 259 */ |
| 260 [version=1.2] |
| 261 int32_t SetOption([in] PP_Resource udp_socket, |
| 262 [in] PP_UDPSocket_Option name, |
| 263 [in] PP_Var value, |
| 264 [in] PP_CompletionCallback callback); |
| 265 |
| 266 /** |
| 267 * Joins the multicast group with address specified by <code>group</code> |
| 268 * parameter, which is expected to be a <code>PPB_NetAddress</code> object. |
| 269 * |
| 270 * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP |
| 271 * socket. |
| 272 * @param[in] group A <code>PP_Resource</code> corresponding to the network |
| 273 * address of the multicast group. |
| 274 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 275 * completion. |
| 276 * |
| 277 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 278 */ |
| 279 [version=1.2] |
| 280 int32_t JoinGroup([in] PP_Resource udp_socket, |
| 281 [in] PP_Resource group, |
| 282 [in] PP_CompletionCallback callback); |
| 283 |
| 284 /** |
| 285 * Leaves the multicast group with address specified by <code>group</code> |
| 286 * parameter, which is expected to be a <code>PPB_NetAddress</code> object. |
| 287 * |
| 288 * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP |
| 289 * socket. |
| 290 * @param[in] group A <code>PP_Resource</code> corresponding to the network |
| 291 * address of the multicast group. |
| 292 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 293 * completion. |
| 294 * |
| 295 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 296 */ |
| 297 [version=1.2] |
| 298 int32_t LeaveGroup([in] PP_Resource udp_socket, |
| 299 [in] PP_Resource group, |
| 300 [in] PP_CompletionCallback callback); |
223 }; | 301 }; |
OLD | NEW |