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

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: Remove GetUnbindEvent Created 4 years, 7 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 2016 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] M52 = 0.1
14 };
15
16 /**
17 * Use the <code>PPB_VpnProvider</code> interface to implement a VPN client.
18 * Important: This API is available only on Chrome OS.
19 *
20 * This interface enhances the <code>chrome.vpnProvider</code> JavaScript API by
21 * providing a high performance path for packet handling.
22 *
23 * Permissions: Apps permission <code>vpnProvider</code> is required for
24 * <code>PPB_VpnProvider.Bind()</code>.
25 *
26 * Typical usage:
27 * - Create a <code>PPB_VpnProvider</code> instance.
28 * - Register the callback for <code>PPB_VpnProvider.ReceivePacket()</code>.
29 * - In the extension follow the usual workflow for configuring a VPN connection
30 * via the <code>chrome.vpnProvider</code> API until the step for notifying
31 * the connection state as "connected".
32 * - Bind to the previously created connection using
33 * <code>PPB_VpnProvider.Bind()</code>.
34 * - Notify the connection state as "connected" from JavaScript using
35 * <code>chrome.vpnProvider.notifyConnectionStateChanged</code>.
36 * - When the steps above are completed without errors, a virtual tunnel is
37 * created to the network stack of Chrome OS. IP packets can be sent through
38 * the tunnel using <code>PPB_VpnProvider.SendPacket()</code> and any packets
39 * originating on the Chrome OS device will be received using the callback
40 * registered for <code>PPB_VpnProvider.ReceivePacket()</code>.
41 * - When the user disconnects from the VPN configuration or there is an error
42 * the extension will be notfied via
43 * <code>chrome.vpnProvider.onPlatformMessage</code>.
44 */
45 interface PPB_VpnProvider {
46 /**
47 * Create() creates a VpnProvider instance.
48 *
49 * @param[in] instance A <code>PP_Instance</code> identifying the instance
50 * with the VpnProvider.
51 *
52 * @return A <code>PP_Resource</code> corresponding to a VpnProvider if
53 * successful.
54 */
55 PP_Resource Create([in] PP_Instance instance);
56
57 /**
58 * IsVpnProvider() determines if the provided <code>resource</code> is a
59 * VpnProvider instance.
60 *
61 * @param[in] resource A <code>PP_Resource</code> corresponding to a
62 * VpnProvider.
63 *
64 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a
65 * <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the
66 * <code>resource</code> is invalid or some type other than
67 * <code>PPB_VpnProvider</code>.
68 */
69 PP_Bool IsVpnProvider([in] PP_Resource resource);
70
71 /**
72 * Bind() binds to an existing configuration created from JavaScript by
73 * <code>chrome.vpnProvider.createConfig</code>. All packets will be routed
74 * via <code>SendPacket</code> and <code>ReceivePacket</code>. The user should
75 * register the callback for <code>ReceivePacket</code> before calling
76 * <code>Bind()</code>.
77 *
78 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
79 * VpnProvider.
80 *
81 * @param[in] configuration_id A <code>PP_VARTYPE_STRING</code> representing
82 * the configuration id from the callback of
83 * <code>chrome.vpnProvider.createConfig</code>.
84 *
85 * @param[in] configuration_name A <code>PP_VARTYPE_STRING</code> representing
86 * the configuration name as defined by the user when calling
87 * <code>chrome.vpnProvider.createConfig</code>.
88 *
89 * @param[in] callback A <code>PP_CompletionCallback</code> called on
90 * completion.
91 *
92 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
93 * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to
94 * <code>Bind()</code> has not completed.
95 * Returns <code>PP_ERROR_BADARGUMENT</code> if either
96 * <code>configuration_id</code> or <code>configuration_name</code> are not of
97 * type <code>PP_VARTYPE_STRING</code>.
98 * Returns <code>PP_ERROR_NOACCESS</code> if the caller does the have the
99 * required "vpnProvider" permission.
100 * Returns <code>PP_ERROR_FAILED</code> if <code>connection_id</code> and
101 * <code>connection_name</code> could not be matched with the existing
102 * connection, or if the plugin originates from a different extension than the
103 * one that created the connection.
104 */
105 int32_t Bind([in] PP_Resource vpn_provider,
106 [in] PP_Var configuration_id,
107 [in] PP_Var configuration_name,
108 [in] PP_CompletionCallback callback);
109
110 /**
111 * SendPacket() sends an IP packet through the tunnel created for the VPN
112 * session. This will succeed only when the VPN session is owned by the
113 * module and the connection is bound.
114 *
115 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
116 * VpnProvider.
117 *
118 * @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to
119 * an IP packet to be sent to the platform.
120 *
121 * @param[in] callback A <code>PP_CompletionCallback</code> called on
122 * completion.
123 *
124 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
125 * Returns <code>PP_ERROR_FAILED</code> if the connection is not bound.
126 * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to
127 * <code>SendPacket()</code> has not completed.
128 * Returns <code>PP_ERROR_BADARGUMENT</code> if <code>packet</code> is not of
129 * type <code>PP_VARTYPE_ARRAY_BUFFER</code>.
130 */
131 int32_t SendPacket([in] PP_Resource vpn_provider,
132 [in] PP_Var packet,
133 [in] PP_CompletionCallback callback);
134
135 /**
136 * ReceivePacket() receives an IP packet from the tunnel for the VPN session.
137 * This function only returns a single packet. This function must be called at
138 * least N times to receive N packets, no matter the size of each packet. The
139 * callback should be registered before calling <code>Bind()</code>.
140 *
141 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
142 * VpnProvider.
143 *
144 * @param[out] packet The received packet is copied to provided
145 * <code>packet</code>. The <code>packet</code> must remain valid until
146 * ReceivePacket() completes. Its received <code>PP_VarType</code> will be
147 * <code>PP_VARTYPE_ARRAY_BUFFER</code>.
148 *
149 * @param[in] callback A <code>PP_CompletionCallback</code> called on
150 * completion.
151 *
152 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
153 * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to
154 * <code>ReceivePacket()</code> has not completed.
155 */
156 int32_t ReceivePacket([in] PP_Resource vpn_provider,
157 [out] PP_Var packet,
158 [in] PP_CompletionCallback callback);
159 };
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