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_TCPSocket_Dev</code> interface. | 7 * This file defines the <code>PPB_TCPSocket</code> interface. |
8 */ | 8 */ |
9 | 9 |
10 [generate_thunk] | 10 [generate_thunk] |
11 | 11 |
12 label Chrome { | 12 label Chrome { |
13 M29 = 0.1 | 13 M29 = 1.0 |
14 }; | 14 }; |
15 | 15 |
16 /** | 16 /** |
17 * Option names used by <code>SetOption()</code>. | 17 * Option names used by <code>SetOption()</code>. |
18 */ | 18 */ |
19 [assert_size(4)] | 19 [assert_size(4)] |
20 enum PP_TCPSocket_Option_Dev { | 20 enum PP_TCPSocket_Option { |
21 /** | 21 /** |
22 * Disables coalescing of small writes to make TCP segments, and instead | 22 * Disables coalescing of small writes to make TCP segments, and instead |
23 * delivers data immediately. Value's type is <code>PP_VARTYPE_BOOL</code>. | 23 * delivers data immediately. Value's type is <code>PP_VARTYPE_BOOL</code>. |
24 * This option can only be set after a successful <code>Connect()</code> call. | 24 * This option can only be set after a successful <code>Connect()</code> call. |
25 */ | 25 */ |
26 PP_TCPSOCKET_OPTION_NO_DELAY = 0, | 26 PP_TCPSOCKET_OPTION_NO_DELAY = 0, |
27 | 27 |
28 /** | 28 /** |
29 * 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 |
30 * type should be <code>PP_VARTYPE_INT32</code>. | 30 * type should be <code>PP_VARTYPE_INT32</code>. |
(...skipping 11 matching lines...) Expand all Loading... |
42 * This option can only be set after a successful <code>Connect()</code> call. | 42 * This option can only be set after a successful <code>Connect()</code> call. |
43 * | 43 * |
44 * Note: This is only treated as a hint for the browser to set the buffer | 44 * Note: This is only treated as a hint for the browser to set the buffer |
45 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't | 45 * size. Even if <code>SetOption()</code> succeeds, the browser doesn't |
46 * guarantee it will conform to the size. | 46 * guarantee it will conform to the size. |
47 */ | 47 */ |
48 PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2 | 48 PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2 |
49 }; | 49 }; |
50 | 50 |
51 /** | 51 /** |
52 * The <code>PPB_TCPSocket_Dev</code> interface provides TCP socket operations. | 52 * The <code>PPB_TCPSocket</code> interface provides TCP socket operations. |
53 * | 53 * |
54 * Permissions: Apps permission <code>socket</code> with subrule | 54 * Permissions: Apps permission <code>socket</code> with subrule |
55 * <code>tcp-connect</code> is required for <code>Connect()</code>. | 55 * <code>tcp-connect</code> is required for <code>Connect()</code>. |
56 * For more details about network communication permissions, please see: | 56 * For more details about network communication permissions, please see: |
57 * http://developer.chrome.com/apps/app_network.html | 57 * http://developer.chrome.com/apps/app_network.html |
58 */ | 58 */ |
59 interface PPB_TCPSocket_Dev { | 59 interface PPB_TCPSocket { |
60 /** | 60 /** |
61 * Creates a TCP socket resource. | 61 * Creates a TCP socket resource. |
62 * | 62 * |
63 * @param[in] instance A <code>PP_Instance</code> identifying one instance of | 63 * @param[in] instance A <code>PP_Instance</code> identifying one instance of |
64 * a module. | 64 * a module. |
65 * | 65 * |
66 * @return A <code>PP_Resource</code> corresponding to a TCP socket or 0 | 66 * @return A <code>PP_Resource</code> corresponding to a TCP socket or 0 |
67 * on failure. | 67 * on failure. |
68 */ | 68 */ |
69 PP_Resource Create([in] PP_Instance instance); | 69 PP_Resource Create([in] PP_Instance instance); |
70 | 70 |
71 /** | 71 /** |
72 * Determines if a given resource is a TCP socket. | 72 * Determines if a given resource is a TCP socket. |
73 * | 73 * |
74 * @param[in] resource A <code>PP_Resource</code> to check. | 74 * @param[in] resource A <code>PP_Resource</code> to check. |
75 * | 75 * |
76 * @return <code>PP_TRUE</code> if the input is a | 76 * @return <code>PP_TRUE</code> if the input is a |
77 * <code>PPB_TCPSocket_Dev</code> resource; <code>PP_FALSE</code> | 77 * <code>PPB_TCPSocket</code> resource; <code>PP_FALSE</code> otherwise. |
78 * otherwise. | |
79 */ | 78 */ |
80 PP_Bool IsTCPSocket([in] PP_Resource resource); | 79 PP_Bool IsTCPSocket([in] PP_Resource resource); |
81 | 80 |
82 /** | 81 /** |
83 * Connects the socket to the given address. | 82 * Connects the socket to the given address. |
84 * | 83 * |
85 * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP | 84 * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP |
86 * socket. | 85 * socket. |
87 * @param[in] addr A <code>PPB_NetAddress</code> resource. | 86 * @param[in] addr A <code>PPB_NetAddress</code> resource. |
88 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 87 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 * The socket is implicitly closed if it is destroyed, so you are not required | 173 * The socket is implicitly closed if it is destroyed, so you are not required |
175 * to call this method. | 174 * to call this method. |
176 * | 175 * |
177 * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP | 176 * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP |
178 * socket. | 177 * socket. |
179 */ | 178 */ |
180 void Close([in] PP_Resource tcp_socket); | 179 void Close([in] PP_Resource tcp_socket); |
181 | 180 |
182 /** | 181 /** |
183 * Sets a socket option on the TCP socket. | 182 * Sets a socket option on the TCP socket. |
184 * Please see the <code>PP_TCPSocket_Option_Dev</code> description for option | 183 * Please see the <code>PP_TCPSocket_Option</code> description for option |
185 * names, value types and allowed values. | 184 * names, value types and allowed values. |
186 * | 185 * |
187 * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP | 186 * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP |
188 * socket. | 187 * socket. |
189 * @param[in] name The option to set. | 188 * @param[in] name The option to set. |
190 * @param[in] value The option value to set. | 189 * @param[in] value The option value to set. |
191 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 190 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
192 * completion. | 191 * completion. |
193 * | 192 * |
194 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 193 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
195 */ | 194 */ |
196 int32_t SetOption([in] PP_Resource tcp_socket, | 195 int32_t SetOption([in] PP_Resource tcp_socket, |
197 [in] PP_TCPSocket_Option_Dev name, | 196 [in] PP_TCPSocket_Option name, |
198 [in] PP_Var value, | 197 [in] PP_Var value, |
199 [in] PP_CompletionCallback callback); | 198 [in] PP_CompletionCallback callback); |
200 }; | 199 }; |
OLD | NEW |