Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: ppapi/api/ppb_vpn_provider.idl

Issue 1726303003: ppapi: PPB_VpnProvider: Define API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « native_client_sdk/src/libraries/ppapi_cpp/library.dsc ('k') | ppapi/c/ppb_vpn_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* Copyright 2015 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6 /**
7 * This file defines the <code>PPB_VpnProvider</code> interface.
8 */
9
10 [generate_thunk]
11
12 label Chrome {
13 [channel=dev] M44 = 0.1
14 };
15
16 /**
17 * This enumeration is used by the VPN client to inform the platform of its
18 * current state. This helps provide meaningful messages to the user.
19 */
20 [assert_size(4)]
21 enum PP_VpnProvider_VpnConnectionState {
bbudge 2016/02/24 19:34:21 nit: PP_VpnProvider_ConnectionState to match enum
adrian.belgun 2016/03/09 11:07:07 Done.
22 // Only for compatibility with the JS API
bbudge 2016/02/24 19:34:22 Follow the existing commenting style for enums: ht
adrian.belgun 2016/03/09 11:07:07 Done.
23 PP_VPN_PROVIDER_CONNECTION_STATE_NONE,
bbudge 2016/02/24 19:34:22 Pepper convention is to explicitly assign the valu
adrian.belgun 2016/03/09 11:07:07 Done.
24 // VPN connection was successful.
25 PP_VPN_PROVIDER_CONNECTION_STATE_CONNECTED,
26 // VPN connection failed.
27 PP_VPN_PROVIDER_CONNECTION_STATE_FAILURE,
28 PP_VPN_PROVIDER_CONNECTION_STATE_LAST = PP_VPN_PROVIDER_CONNECTION_STATE_FAILU RE
bbudge 2016/02/24 19:34:21 We don't usually provide a _LAST or _MAX value, si
adrian.belgun 2016/03/09 11:07:07 Done.
29 };
30
31 /**
32 * This enumeration is used by the platform to notify the client of the VPN
33 * session status.
34 */
35 [assert_size(4)]
36 enum PP_VpnProvider_PlatformMessage {
37 // Only for compatibility with the JS API
38 PP_VPN_PROVIDER_PLATFORM_MESSAGE_NONE,
39 // VPN configuration connected.
40 PP_VPN_PROVIDER_PLATFORM_MESSAGE_CONNECTED,
41 // VPN configuration disconnected.
42 PP_VPN_PROVIDER_PLATFORM_MESSAGE_DISCONNECTED,
43 // An error occurred in VPN connection, for example a timeout. A description
44 // of the error is give as the error argument to
45 // <code>GetPlatformMessage</code>.
46 PP_VPN_PROVIDER_PLATFORM_MESSAGE_ERROR,
47 PP_VPN_PROVIDER_PLATFORM_MESSAGE_LAST = PP_VPN_PROVIDER_PLATFORM_MESSAGE_ERROR
48 };
49
50 /**
51 * This enumeration is used by the platform to notify the client of the VPN
52 * configuration status.
53 */
54 [assert_size(4)]
55 enum PP_VpnProvider_ConfigMessage {
56 // Only for compatibility with the JS API
57 PP_VPN_PROVIDER_CONFIG_NONE,
58 // VPN configuration created by the platform.
59 PP_VPN_PROVIDER_CONFIG_CREATED,
60 // VPN configuration removed by the platform.
61 PP_VPN_PROVIDER_CONFIG_REMOVED,
62 PP_VPN_PROVIDER_CONFIG_LAST = PP_VPN_PROVIDER_CONFIG_REMOVED
63 };
64
65 /**
66 * This enumeration is used by the platform to notify the client of the UI event
67 * type.
68 */
69 [assert_size(4)]
70 enum PP_VpnProvider_UIEvent {
71 // Only for compatibility with the JS API
72 PP_VPN_PROVIDER_UI_EVENT_NONE,
73 // Request the VPN client to show add configuration dialog to the user.
74 PP_VPN_PROVIDER_UI_EVENT_SHOWADDDIALOG,
75 // Request the VPN client to show configuration settings dialog to the user.
76 PP_VPN_PROVIDER_UI_EVENT_SHOWCONFIGUREDIALOG,
77 PP_VPN_PROVIDER_UI_EVENT_LAST = PP_VPN_PROVIDER_UI_EVENT_SHOWCONFIGUREDIALOG
78 };
79
80 /**
81 * Use the <code>PPB_VpnProvider</code> interface to implement a VPN client.
82 * Important: This API is available only on Chrome OS.
83 *
84 * VPN Provider interface:
85 *
86 * Typical usage:
87 * - Create VPN configurations using the
88 * <code>PPB_VpnProvider.CreateConfig()</code> method. A VPN configuration is
89 * a persistent entry shown to the user in a native Chrome OS UI. The user can
90 * select a VPN configuration from a list and connect to it or disconnect from
91 * it.
92 * - Register callbacks to the events via
93 * <code>PPB_VpnProvider.GetPlatformMessage()</code>,
94 * <code>PPB_VpnProvider.GetPacket()</code>,
95 * <code>PPB_VpnProvider.GetConfigMessage()</code> and
96 * <code>PPB_VpnProvider.GetUIMessage()</code>.
97 * - When the user connects to the VPN configuration, the
98 * <code>PPB_VpnProvider.GetPlatformMessage()</code> callback will be called
99 * with the message <code>PP_VPN_PROVIDER_PLATFORM_MESSAGE_CONNECTED</code>.
100 * We refer to the period between the messages
101 * <code>PP_VPN_PROVIDER_PLATFORM_MESSAGE_CONNECTED</code> and
102 * <code>PP_VPN_PROVIDER_PLATFORM_MESSAGE_DISCONNECTED</code> as a VPN
103 * session. In this time period, the module that receives the message is said
104 * to own the VPN session.
105 * - You will need to re-register the callbacks after they are called.
106 * - Initiate connection to the VPN server and start the VPN client.
107 * - Set the Parameters of the connection using
108 * <code>PPB_VpnProvider.SetParameters()</code> .
109 * - Notify the connection state as
110 * <code>PP_VPN_PROVIDER_CONNECTION_STATE_CONNECTED</code> using
111 * <code>PPB_VpnProvider.NotifyConnectionStateChanged()</code>.
112 * - When the steps above are completed without errors, a virtual tunnel is
113 * created to the network stack of Chrome OS. IP packets can be sent through
114 * the tunnel using <code>PPB_VpnProvider.SendPacket()</code> and any packets
115 * originating on the Chrome OS device will be received using the callback of
116 * <code>PPB_VpnProvider.GetPacket()</code>.
117 * - When the user disconnects from the VPN configuration, the
118 * <code>PPB_VpnProvider.GetPlatformMessage()</code> callback will be fired
119 * with the message <code>PP_VPN_PROVIDER_PLATFORM_MESSAGE_DISCONNECTED
120 * </code>.
121 * - If the VPN configuration is no longer necessary, it can be destroyed using
122 * <code>PPB_VpnProvider.DestroyConfig()</code>
123 */
124 interface PPB_VpnProvider {
125 /**
126 * Create() creates a VpnProvider instance.
127 *
128 * @param[in] instance A <code>PP_Instance</code> identifying the instance
129 * with the VpnProvider.
130 *
131 * @return A <code>PP_Resource</code> corresponding to a WebSocket if
bbudge 2016/02/24 19:34:22 WebSocket -> VpnProvider
adrian.belgun 2016/03/09 11:07:07 Done.
132 * successful.
133 */
134 PP_Resource Create( [in] PP_Instance instance );
bbudge 2016/02/24 19:34:22 nit: eliminate excess spaces (Chromium style conve
adrian.belgun 2016/03/09 11:07:07 Done.
135
136 /**
137 * IsVpnProvider() determines if the provided <code>resource</code> is a
138 * VpnProvider instance.
139 *
140 * @param[in] resource A <code>PP_Resource</code> corresponding to a
141 * VpnProvider.
142 *
143 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a
144 * <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the
145 * <code>resource</code> is invalid or some type other than
146 * <code>PPB_VpnProvider</code>.
147 */
148 PP_Bool IsVpnProvider(
149 [in] PP_Resource resource );
150
151 /**
152 * CreateConfig() creates a new VPN configuration that persists across
153 * multiple login sessions of the user.
154 *
155 * @param[in] resource A <code>PP_Resource</code> corresponding to a
156 * VpnProvider.
157 *
158 * @param[in] name A <code>PP_Var</code> representing the name of the VPN
159 * configuration. The <code>PP_VarType</code> must be
160 * <code>PP_VARTYPE_STRING</code>.
161 *
162 * @param[out] id A unique ID for the created configuration. The ID is copied
163 * to provided <code>id</code>. The <code>id</code> must remain valid
164 * until CreateConfig() completes. Its received <code>PP_VarType</code>
165 * will be <code>PP_VARTYPE_STRING</code> if a configuration was created,
166 * otherwise it will be <code>PP_VARTYPE_UNDEFINED</code>
167 *
168 * @param[in] callback A <code>PP_CompletionCallback</code> called
169 * when CreateConfig() completes.</code>.
170 *
171 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
172 */
173 int32_t CreateConfig(
174 [in] PP_Resource vpn_provider,
175 [in] PP_Var name,
176 [out] PP_Var id,
177 [in] PP_CompletionCallback callback );
178
179 /**
180 * DestroyConfig() destroys a VPN configuration created using this API.
181 *
182 * @param[in] resource A <code>PP_Resource</code> corresponding to a
183 * VpnProvider.
184 *
185 * @param[in] name A <code>PP_Var</code> representing the ID of the VPN
186 * configuration to destroy. The <code>PP_VarType</code> must be
187 * <code>PP_VARTYPE_STRING</code>.
188 *
189 * @param[in] callback A <code>PP_CompletionCallback</code> called
190 * when CreateConfig() completes.</code>.
191 *
192 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
193 */
194 int32_t DestroyConfig(
195 [in] PP_Resource vpn_provider,
196 [in] PP_Var id,
197 [in] PP_CompletionCallback callback );
198
199 /**
200 * SetParameters() sets the parameters for the VPN session. This should be
201 * called immediately after <code>PP_VPN_PROVIDER_CONNECTION_STATE_CONNECTED
202 * </code> is received from the platform. This will succeed only when the VPN
203 * session is owned by the module.
204 *
205 * @param[in] address A <code>PP_VARTYPE_STRING</code> corresponding to the
206 * IP address for the VPN interface in CIDR notation. IPv4 is currently the
207 * only supported mode.
208 *
209 * @param[in] broadcast_address A <code>PP_VARTYPE_STRING</code> corresponding
210 * to the broadcast address for the VPN interface. Default: deduced from IP
211 * address and mask.
212 *
213 * @param[in] mtu A <code>int32_t</code> corresponding to the MTU setting for
214 * the VPN interface. Default: 1500 bytes.
215
216 * @param[in] exclusion_list A <code>PP_VARTYPE_ARRAY</code> of
217 * <code>PP_VARTYPE_STRING</code>. Exclude network traffic to the list of IP
218 * blocks in CIDR notation from the tunnel. This can be used to bypass traffic
219 * to and from the VPN server. When many rules match a destination, the rule
220 * with the longest matching prefix wins. Entries that correspond to the same
221 * CIDR block are treated as duplicates. Such duplicates in the collated
222 * (exclusion_list + inclusion_list) list are eliminated and the exact
223 * duplicate entry that will be eliminated is undefined.
224 *
225 * @param[in] inclusion_list A <code>PP_VARTYPE_ARRAY</code> of
226 * <code>PP_VARTYPE_STRING</code>. Include network traffic to the list of IP
227 * blocks in CIDR notation to the tunnel. This parameter can be used to set up
228 * a split tunnel. By default no traffic is directed to the tunnel. Adding the
229 * entry "0.0.0.0/0" to this list gets all the user traffic redirected to the
230 * tunnel. When many rules match a destination, the rule with the longest
231 * matching prefix wins. Entries that correspond to the same CIDR block are
232 * treated as duplicates. Such duplicates in the collated (exclusion_list +
233 * inclusion_list) list are eliminated and the exact duplicate entry that will
234 * be eliminated is undefined.
235 *
236 * @param[in] domain_search A <code>PP_VARTYPE_ARRAY</code> of
237 * <code>PP_VARTYPE_STRING</code> corresponding to a list of search domains.
238 * Default: no search domain.
239 *
240 * @param[in] dns_servers A <code>PP_VARTYPE_ARRAY</code> of
241 * <code>PP_VARTYPE_STRING</code> values corresponding to a list of IPs for
242 * the DNS servers.
243 *
244 * @param[in] callback A <code>PP_CompletionCallback</code> called
245 * when SetParameters() completes.
246 */
247 int32_t SetParameters(
bbudge 2016/02/24 19:34:21 Another approach is to have a SetOption(resource,
adrian.belgun 2016/03/09 11:07:07 Done. Ended up with a SetParameter / CommitParame
248 [in] PP_Resource vpn_provider,
249 [in] PP_Var address,
250 [in] PP_Var broadcast_address,
251 [in] int32_t mtu,
252 [in] PP_Var exclusion_list,
253 [in] PP_Var inclusion_list,
254 [in] PP_Var domain_search,
255 [in] PP_Var dns_servers,
256 [in] PP_CompletionCallback callback );
257
258 /**
259 * SendPacket() sends an IP packet through the tunnel created for the VPN
260 * session. This will succeed only when the VPN session is owned by the
261 * module.
262 *
263 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
264 * VpnProvider.
265 *
266 * @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to
267 * an IP packet to be sent to the platform.
268 */
269 int32_t SendPacket(
270 [in] PP_Resource vpn_provider,
271 [in] PP_Var packet );
bbudge 2016/02/24 19:34:21 There must be some way (such as a callback) to thr
adrian.belgun 2016/03/09 11:07:07 Done. After adding the callback, the performance
272
273 /**
274 * NotifyConnectionStateChanged() notifies the VPN session state to the
275 * platform. This will succeed only when the VPN session is owned by the
276 * module.
277 *
278 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
279 * VpnProvider.
280 *
281 * @param[in] status A <code>PP_VpnProvider_VpnConnectionState</code>
282 * corresponding to the VPN session state of the VPN client.
283 *
284 * @param[in] callback A <code>PP_CompletionCallback</code> called
285 * when NotifyConnectionStateChanged() completes.</code>.
286 */
287 int32_t NotifyConnectionStateChanged(
288 [in] PP_Resource vpn_provider,
289 [in] PP_VpnProvider_VpnConnectionState status,
290 [in] PP_CompletionCallback callback );
291
292 /**
293 * GetPacket() receives an IP packet from the tunnel for the VPN session.
294 * This interface only returns a single packet. That is, this interface must
295 * be called at least N times to receive N packet, no matter the size of
296 * each packet.
297 *
298 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
299 * VpnProvider.
300 *
301 * @param[out] packet The received packet is copied to provided
302 * <code>packet</code>. The <code>packet</code> must remain valid until
303 * GetPacket() completes. Its received <code>PP_VarType</code> will be
304 * <code>PP_VARTYPE_ARRAY_BUFFER</code>.
305 *
306 * @param[in] callback A <code>PP_CompletionCallback</code> called
307 * when GetPacket() completes.</code>.
308 *
309 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
310 * If an error is detected or connection is closed, GetPacket() returns
311 * <code>PP_ERROR_FAILED</code> after all buffered messages are received.
312 * Until buffered packets become empty, GetPacket() continues to return
313 * <code>PP_OK</code> as if connection is still established without errors.
314 */
315 int32_t GetPacket(
316 [in] PP_Resource vpn_provider,
317 [out] PP_Var packet,
318 [in] PP_CompletionCallback callback );
319
320 /**
321 * GetPlatformMessage() receives a platform message from the platform for a
322 * VPN configuration.
323 * This interface only returns a single message. That is, this interface must
324 * be called at least N times to receive N messages.
325 *
326 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
327 * VpnProvider.
328 *
329 * @param[out] message A platform message. The message is copied to the
330 * provided <code>message</code>. The <code>message</code> must remain valid
331 * until GetPlatformMessage() completes. Its received <code>PP_VarType</code>
332 * will be <code>PP_VARTYPE_DICTIONARY</code>. Its key value pairs must be
333 * interpreted as:
334 * - "id": ID of the configuration the message is intended for. Its received
335 * <code>PP_VarType</code> will be <code>PP_VARTYPE_STRING</code>.
336 * - "message": The message type received from the platform. Its received
337 * <code>PP_VarType</code> will be <code>PP_VARTYPE_INT32</code> and must
338 * interpreted as a value in <code>PP_VpnProvider_PlatformMessage</code>.
339 * - "error": Error message when there is an error. Its received
340 * <code>PP_VarType</code> will be <code>PP_VARTYPE_STRING</code>.
341 *
342 * @param[in] callback A <code>PP_CompletionCallback</code> called
343 * when GetPlatformMessage() completes.</code>.
344 *
345 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
346 * If an error is detected, GetPlatformMessage() returns
347 * <code>PP_ERROR_FAILED</code> after all buffered messages are received.
348 * Until buffered messages become empty, GetPlatformMessage() continues to
349 * return <code>PP_OK</code> as if connection is still established without
350 * errors.
351 */
352 int32_t GetPlatformMessage(
bbudge 2016/02/24 19:34:21 I think this API could be significantly simpler an
adrian.belgun 2016/03/09 11:07:07 Done.
353 [in] PP_Resource vpn_provider,
354 [out] PP_Var message,
355 [in] PP_CompletionCallback callback );
356
357 /**
358 * GetConfigMessage() receives an event from the platform for the creation or
359 * destruction of a VPN configuration.
360 * This interface only returns a single message. That is, this interface must
361 * be called at least N times to receive N messages.
362 *
363 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
364 * VpnProvider.
365 *
366 * @param[out] message A configuration message. The message is copied to the
367 * provided <code>message</code>. The <code>message</code> must remain valid
368 * until GetConfigMessage() completes. Its received <code>PP_VarType</code>
369 * will be <code>PP_VARTYPE_DICTIONARY</code>. Its key value pairs must be
370 * interpreted as:
371 * - "id": ID of the configuration the message is intended for. Its received
372 * <code>PP_VarType</code> will be <code>PP_VARTYPE_STRING</code>.
373 * - "message": The message type received from the platform. Its received
374 * <code>PP_VarType</code> will be <code>PP_VARTYPE_INT32</code> and must
375 * interpreted as a value in <code>PP_VpnProvider_ConfigMessage</code>.
376 * - "name": Name of the configuration created. Its received
377 * <code>PP_VarType</code> will be <code>PP_VARTYPE_STRING</code> if a
378 * configuration was created, otherwise it will be
379 * <code>PP_VARTYPE_UNDEFINED</code>.
380 * - "data": Configuration data provided by the administrator.
381 *
382 * @param[in] callback A <code>PP_CompletionCallback</code> called
383 * when GetConfigMessage() completes.</code>.
384 *
385 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
386 * If an error is detected, GetConfigMessage() returns
387 * <code>PP_ERROR_FAILED</code> after all buffered messages are received.
388 * Until buffered messages become empty, GetConfigMessage() continues to
389 * return <code>PP_OK</code> as if connection is still established without
390 * errors.
391 */
392 int32_t GetConfigMessage(
393 [in] PP_Resource vpn_provider,
394 [out] PP_Var message,
395 [in] PP_CompletionCallback callback );
396
397 /**
398 * GetUIMessage() receives an UI event for the extension. UI events are
399 * signals from the platform that indicate to the app that a UI dialog needs
400 * to be shown to the user.
401 * This interface only returns a single message. That is, this interface must
402 * be called at least N times to receive N messages.
403 *
404 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
405 * VpnProvider.
406 *
407 * @param[out] message A configuration message. The message is copied to the
408 * provided <code>message</code>. The <code>message</code> must remain valid
409 * until GetConfigMessage() completes. Its received <code>PP_VarType</code>
410 * will be <code>PP_VARTYPE_DICTIONARY</code>. Its key value pairs must be
411 * interpreted as:
412 * - "event": The UI event that is triggered. Its received
413 * <code>PP_VarType</code> will be <code>PP_VARTYPE_INT32</code> and must
414 * interpreted as a value in <code>PP_VpnProvider_UIEvent</code>.
415 * - "id": ID of the configuration the message is intended for. Its received
416 * <code>PP_VarType</code> will be <code>PP_VARTYPE_STRING</code>.
417 *
418 * @param[in] callback A <code>PP_CompletionCallback</code> called
419 * when GetUIMessage() completes.</code>.
420 *
421 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
422 * If an error is detected, GetUIMessage() returns
423 * <code>PP_ERROR_FAILED</code> after all buffered messages are received.
424 * Until buffered messages become empty, GetUIMessage() continues to
425 * return <code>PP_OK</code> as if connection is still established without
426 * errors.
427 */
428 int32_t GetUIMessage(
429 [in] PP_Resource vpn_provider,
430 [out] PP_Var message,
431 [in] PP_CompletionCallback callback );
432 };
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/ppapi_cpp/library.dsc ('k') | ppapi/c/ppb_vpn_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698