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

Side by Side Diff: ppapi/c/ppb_vpn_provider.h

Issue 1726303003: ppapi: PPB_VpnProvider: Define API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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
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 /* From ppb_vpn_provider.idl modified Tue Mar 29 17:57:47 2016. */
7
8 #ifndef PPAPI_C_PPB_VPN_PROVIDER_H_
9 #define PPAPI_C_PPB_VPN_PROVIDER_H_
10
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_macros.h"
15 #include "ppapi/c/pp_resource.h"
16 #include "ppapi/c/pp_stdint.h"
17 #include "ppapi/c/pp_var.h"
18
19 #define PPB_VPNPROVIDER_INTERFACE_0_1 "PPB_VpnProvider;0.1" /* dev */
20 /**
21 * @file
22 * This file defines the <code>PPB_VpnProvider</code> interface.
23 */
24
25
26 /**
27 * @addtogroup Interfaces
28 * @{
29 */
30 /**
31 * Use the <code>PPB_VpnProvider</code> interface to implement a VPN client.
32 * Important: This API is available only on Chrome OS.
33 */
34 struct PPB_VpnProvider_0_1 { /* dev */
35 /**
36 * Create() creates a VpnProvider instance.
37 *
38 * @param[in] instance A <code>PP_Instance</code> identifying the instance
39 * with the VpnProvider.
40 *
41 * @return A <code>PP_Resource</code> corresponding to a VpnProvider if
42 * successful.
43 */
44 PP_Resource (*Create)(PP_Instance instance);
45 /**
46 * IsVpnProvider() determines if the provided <code>resource</code> is a
47 * VpnProvider instance.
48 *
49 * @param[in] resource A <code>PP_Resource</code> corresponding to a
50 * VpnProvider.
51 *
52 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a
53 * <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the
54 * <code>resource</code> is invalid or some type other than
55 * <code>PPB_VpnProvider</code>.
56 */
57 PP_Bool (*IsVpnProvider)(PP_Resource resource);
58 /**
59 * Bind() binds to an existing configuration created by
60 * <code>chrome.vpnProvider.createConfig</code>. All packets will be routed
61 * via <code>SendPacket</code> and <code>ReceivePacket</code>.
62 *
63 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
64 * VpnProvider.
65 *
66 * @param[in] configuration_id A <code>PP_VARTYPE_STRING</code> representing
67 * the configuration id from the callback of
68 * <code>chrome.vpnProvider.createConfig</code>.
69 *
70 * @param[in] configuration_name A <code>PP_VARTYPE_STRING</code> representing
71 * the configuration name as defined by the user when calling
72 * <code>chrome.vpnProvider.createConfig</code>.
73 *
74 * @param[in] callback A <code>PP_CompletionCallback</code> called when
75 * the configuration gets bound.
76 *
77 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a
78 * <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the
79 * <code>resource</code> is invalid or some type other than
80 * <code>PPB_VpnProvider</code>.
81 *
82 */
83 int32_t (*Bind)(PP_Resource vpn_provider,
84 struct PP_Var configuration_id,
85 struct PP_Var configuration_name,
86 struct PP_CompletionCallback callback);
87 /**
88 * GetUnBindEvent() registers a callback that will be called when the current
89 * configuration gets unbound.
90 *
91 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
92 * VpnProvider.
93 *
94 * @param[in] callback A <code>PP_CompletionCallback</code> called when
95 * the current configuration gets unbound.
96 *
97 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
98 */
99 int32_t (*GetUnBindEvent)(PP_Resource vpn_provider,
100 struct PP_CompletionCallback callback);
101 /**
102 * SendPacket() sends an IP packet through the tunnel created for the VPN
103 * session. This will succeed only when the VPN session is owned by the
104 * module.
105 *
106 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
107 * VpnProvider.
108 *
109 * @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to
110 * an IP packet to be sent to the platform.
111 *
112 * @param[in] callback A <code>PP_CompletionCallback</code> called
113 * when SendPacket() completes.
114 *
115 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
116 */
117 int32_t (*SendPacket)(PP_Resource vpn_provider,
118 struct PP_Var packet,
119 struct PP_CompletionCallback callback);
120 /**
121 * ReceivePacket() receives an IP packet from the tunnel for the VPN session.
122 * This interface only returns a single packet. That is, this interface must
123 * be called at least N times to receive N packet, no matter the size of
124 * each packet.
125 *
126 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
127 * VpnProvider.
128 *
129 * @param[out] packet The received packet is copied to provided
130 * <code>packet</code>. The <code>packet</code> must remain valid until
131 * ReceivePacket() completes. Its received <code>PP_VarType</code> will be
132 * <code>PP_VARTYPE_ARRAY_BUFFER</code>.
133 *
134 * @param[in] callback A <code>PP_CompletionCallback</code> called
135 * when ReceivePacket() completes.
136 *
137 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
138 * If an error is detected or connection is closed, ReceivePacket() returns
139 * <code>PP_ERROR_FAILED</code> after all buffered messages are received.
140 * Until buffered packets become empty, ReceivePacket() continues to return
141 * <code>PP_OK</code> as if connection is still established without errors.
142 */
143 int32_t (*ReceivePacket)(PP_Resource vpn_provider,
144 struct PP_Var* packet,
145 struct PP_CompletionCallback callback);
146 };
147 /**
148 * @}
149 */
150
151 #endif /* PPAPI_C_PPB_VPN_PROVIDER_H_ */
152
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698