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

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: Split patch & responded to reviews 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 Wed Apr 27 17:33:07 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 An int32_t containing an error code from <code>pp_errors.h</code>.
78 */
79 int32_t (*Bind)(PP_Resource vpn_provider,
80 struct PP_Var configuration_id,
81 struct PP_Var configuration_name,
82 struct PP_CompletionCallback callback);
83 /**
84 * GetUnbindEvent() registers a callback that will be called when the current
85 * configuration gets unbound.
86 *
87 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
88 * VpnProvider.
89 *
90 * @param[in] callback A <code>PP_CompletionCallback</code> called when
91 * the current configuration gets unbound.
92 *
93 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
94 */
95 int32_t (*GetUnbindEvent)(PP_Resource vpn_provider,
96 struct PP_CompletionCallback callback);
97 /**
98 * SendPacket() sends an IP packet through the tunnel created for the VPN
99 * session. This will succeed only when the VPN session is owned by the
100 * module.
101 *
102 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
103 * VpnProvider.
104 *
105 * @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to
106 * an IP packet to be sent to the platform.
107 *
108 * @param[in] callback A <code>PP_CompletionCallback</code> called
109 * when SendPacket() completes.
110 *
111 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
112 */
113 int32_t (*SendPacket)(PP_Resource vpn_provider,
114 struct PP_Var packet,
115 struct PP_CompletionCallback callback);
116 /**
117 * ReceivePacket() receives an IP packet from the tunnel for the VPN session.
118 * This function only returns a single packet. That is, this function must
119 * be called at least N times to receive N packets, no matter the size of
120 * each packet.
121 *
122 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
123 * VpnProvider.
124 *
125 * @param[out] packet The received packet is copied to provided
126 * <code>packet</code>. The <code>packet</code> must remain valid until
127 * ReceivePacket() completes. Its received <code>PP_VarType</code> will be
128 * <code>PP_VARTYPE_ARRAY_BUFFER</code>.
129 *
130 * @param[in] callback A <code>PP_CompletionCallback</code> called
131 * when ReceivePacket() completes.
132 *
133 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
134 * If an error is detected or connection is closed, ReceivePacket() returns
135 * <code>PP_ERROR_FAILED</code> after all buffered messages are received.
136 * Until buffered packets become empty, ReceivePacket() continues to return
137 * <code>PP_OK</code> as if connection is still established without errors.
138 */
139 int32_t (*ReceivePacket)(PP_Resource vpn_provider,
140 struct PP_Var* packet,
141 struct PP_CompletionCallback callback);
142 };
143 /**
144 * @}
145 */
146
147 #endif /* PPAPI_C_PPB_VPN_PROVIDER_H_ */
148
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698