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_Dev</code> interface. | 7 * This file defines the <code>PPB_UDPSocket_Dev</code> interface. |
8 * TODO(yzshen): Tidy up the document. | 8 * TODO(yzshen): Tidy up the document. |
9 */ | 9 */ |
10 | 10 |
11 [generate_thunk] | 11 [generate_thunk] |
12 | 12 |
13 label Chrome { | 13 label Chrome { |
14 M29 = 0.1 | 14 M29 = 0.1 |
15 }; | 15 }; |
16 | 16 |
17 [assert_size(4)] | 17 [assert_size(4)] |
18 enum PP_UDPSocket_Option_Dev { | 18 enum PP_UDPSocket_Option_Dev { |
19 // Allows the socket to share the local address to which it will be bound with | 19 // Allows the socket to share the local address to which it will be bound with |
20 // other processes. Value's type should be PP_VARTYPE_BOOL. | 20 // other processes. Value's type should be PP_VARTYPE_BOOL. |
| 21 // This option can only be set before calling Bind(). |
21 PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, | 22 PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, |
22 | 23 |
23 // Allows sending and receiving packets to and from broadcast addresses. | 24 // Allows sending and receiving packets to and from broadcast addresses. |
24 // Value's type should be PP_VARTYPE_BOOL. | 25 // Value's type should be PP_VARTYPE_BOOL. |
| 26 // This option can only be set before calling Bind(). |
25 PP_UDPSOCKET_OPTION_BROADCAST = 1, | 27 PP_UDPSOCKET_OPTION_BROADCAST = 1, |
26 | 28 |
27 // Specifies the total per-socket buffer space reserved for sends. Value's | 29 // Specifies the total per-socket buffer space reserved for sends. Value's |
28 // type should be PP_VARTYPE_INT32. | 30 // type should be PP_VARTYPE_INT32. |
| 31 // This option can only be set after a successful Bind() call. |
29 // Note: This is only treated as a hint for the browser to set the buffer | 32 // Note: This is only treated as a hint for the browser to set the buffer |
30 // size. Even if SetOption() reports that this option has been successfully | 33 // size. Even if SetOption() reports that this option has been successfully |
31 // set, the browser doesn't guarantee it will conform to it. | 34 // set, the browser doesn't guarantee it will conform to it. |
32 PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, | 35 PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, |
33 | 36 |
34 // Specifies the total per-socket buffer space reserved for receives. Value's | 37 // Specifies the total per-socket buffer space reserved for receives. Value's |
35 // type should be PP_VARTYPE_INT32. | 38 // type should be PP_VARTYPE_INT32. |
| 39 // This option can only be set after a successful Bind() call. |
36 // Note: This is only treated as a hint for the browser to set the buffer | 40 // Note: This is only treated as a hint for the browser to set the buffer |
37 // size. Even if SetOption() reports that this option has been successfully | 41 // size. Even if SetOption() reports that this option has been successfully |
38 // set, the browser doesn't guarantee it will conform to it. | 42 // set, the browser doesn't guarantee it will conform to it. |
39 PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3 | 43 PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3 |
40 }; | 44 }; |
41 | 45 |
42 interface PPB_UDPSocket_Dev { | 46 interface PPB_UDPSocket_Dev { |
43 /** | 47 /** |
44 * Creates a UDP socket resource. | 48 * Creates a UDP socket resource. |
45 */ | 49 */ |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 [in] int32_t num_bytes, | 90 [in] int32_t num_bytes, |
87 [in] PP_Resource addr, | 91 [in] PP_Resource addr, |
88 [in] PP_CompletionCallback callback); | 92 [in] PP_CompletionCallback callback); |
89 | 93 |
90 /** | 94 /** |
91 * Cancels all pending reads and writes, and closes the socket. | 95 * Cancels all pending reads and writes, and closes the socket. |
92 */ | 96 */ |
93 void Close([in] PP_Resource udp_socket); | 97 void Close([in] PP_Resource udp_socket); |
94 | 98 |
95 /** | 99 /** |
96 * Sets a socket option to |udp_socket|. Should be called before Bind(). | 100 * Sets a socket option on |udp_socket|. |
97 * See the PP_UDPSocket_Option_Dev description for option names, value types | 101 * See the PP_UDPSocket_Option_Dev description for option names, value types |
98 * and allowed values. | 102 * and allowed values. |
99 * Returns PP_OK on success. Otherwise, returns PP_ERROR_BADRESOURCE (if bad | 103 * Returns PP_OK on success. Otherwise, returns PP_ERROR_BADRESOURCE (if bad |
100 * |udp_socket| provided), PP_ERROR_BADARGUMENT (if bad name/value/value's | 104 * |udp_socket| provided), PP_ERROR_BADARGUMENT (if bad name/value/value's |
101 * type provided) or PP_ERROR_FAILED in the case of internal errors. | 105 * type provided) or PP_ERROR_FAILED in the case of internal errors. |
102 */ | 106 */ |
103 int32_t SetOption([in] PP_Resource udp_socket, | 107 int32_t SetOption([in] PP_Resource udp_socket, |
104 [in] PP_UDPSocket_Option_Dev name, | 108 [in] PP_UDPSocket_Option_Dev name, |
105 [in] PP_Var value, | 109 [in] PP_Var value, |
106 [in] PP_CompletionCallback callback); | 110 [in] PP_CompletionCallback callback); |
107 }; | 111 }; |
OLD | NEW |