OLD | NEW |
---|---|
(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] M51 = 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 interface PPB_VpnProvider { | |
21 /** | |
22 * Create() creates a VpnProvider instance. | |
23 * | |
24 * @param[in] instance A <code>PP_Instance</code> identifying the instance | |
25 * with the VpnProvider. | |
26 * | |
27 * @return A <code>PP_Resource</code> corresponding to a VpnProvider if | |
28 * successful. | |
29 */ | |
30 PP_Resource Create([in] PP_Instance instance); | |
31 | |
32 /** | |
33 * IsVpnProvider() determines if the provided <code>resource</code> is a | |
34 * VpnProvider instance. | |
35 * | |
36 * @param[in] resource A <code>PP_Resource</code> corresponding to a | |
37 * VpnProvider. | |
38 * | |
39 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a | |
40 * <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the | |
41 * <code>resource</code> is invalid or some type other than | |
42 * <code>PPB_VpnProvider</code>. | |
43 */ | |
44 PP_Bool IsVpnProvider([in] PP_Resource resource); | |
45 | |
46 /** | |
47 * Bind() binds to an existing connection created by | |
48 * <code>chrome.vpnProvider.createConfig</code>. All packets will be routed | |
49 * via <code>SendPacket</code> and <code>GetPacket</code> in the Native | |
50 * Client API. | |
51 * | |
52 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a | |
53 * VpnProvider. | |
54 * | |
55 * @param[in] name A <code>PP_VARTYPE_STRING</code> representing the | |
56 * connection name as defined by the user when calling | |
57 * <code>chrome.vpnProvider.createConfig</code>. | |
58 * | |
59 * @param[in] id A <code>PP_VARTYPE_STRING</code> representing the connection | |
60 * id from the callback of <code>chrome.vpnProvider.createConfig</code>. | |
61 * | |
62 * @param[in] callback A <code>PP_CompletionCallback</code> called when | |
63 * the connection gets bound. | |
64 * | |
65 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a | |
66 * <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the | |
67 * <code>resource</code> is invalid or some type other than | |
68 * <code>PPB_VpnProvider</code>. | |
69 * | |
70 */ | |
71 int32_t Bind([in] PP_Resource vpn_provider, | |
72 [in] PP_Var name, | |
73 [in] PP_Var id, | |
74 [in] PP_CompletionCallback callback); | |
75 /** | |
76 * GetUnBindEvent() registers a callback that will be called when the current | |
77 * connection gets unbound. | |
78 * | |
79 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a | |
80 * VpnProvider. | |
81 * | |
82 * @param[in] callback A <code>PP_CompletionCallback</code> called when | |
83 * the current connection gets unbound. | |
84 * | |
85 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a | |
86 * <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the | |
87 * <code>resource</code> is invalid or some type other than | |
88 * <code>PPB_VpnProvider</code>. | |
89 * | |
90 */ | |
91 int32_t GetUnBindEvent([in] PP_Resource vpn_provider, | |
92 [in] PP_CompletionCallback callback); | |
93 | |
94 | |
95 /** | |
96 * SendPacket() sends an IP packet through the tunnel created for the VPN | |
97 * session. This will succeed only when the VPN session is owned by the | |
98 * module. | |
99 * | |
100 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a | |
101 * VpnProvider. | |
102 * | |
103 * @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to | |
104 * an IP packet to be sent to the platform. | |
105 * | |
106 * @param[in] callback A <code>PP_CompletionCallback</code> | |
107 * | |
108 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
109 * If an error is detected or connection is closed, GetPacket() returns | |
110 * <code>PP_ERROR_FAILED</code> after all buffered messages are received. | |
111 * Until buffered packets become empty, GetPacket() continues to return | |
112 * <code>PP_OK</code> as if connection is still established without errors. | |
113 */ | |
114 int32_t SendPacket([in] PP_Resource vpn_provider, | |
115 [in] PP_Var packet, | |
116 [in] PP_CompletionCallback callback); | |
117 | |
118 /** | |
119 * SendPacket() sends an IP packet through the tunnel created for the VPN | |
bbudge
2016/03/22 22:38:33
Looks like a duplicate of above.
adrian.belgun
2016/03/29 15:45:44
Done.
| |
120 * session. This will succeed only when the VPN session is owned by the | |
121 * module. | |
122 * | |
123 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a | |
124 * VpnProvider. | |
125 * | |
126 * @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to | |
127 * an IP packet to be sent to the platform. | |
128 * | |
129 * @param[in] callback A <code>PP_CompletionCallback</code> called | |
130 * when SendPacket() completes. | |
131 * | |
132 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
133 * If an error is detected or connection is closed, GetPacket() returns | |
134 * <code>PP_ERROR_FAILED</code> after all buffered messages are received. | |
135 * Until buffered packets become empty, GetPacket() continues to return | |
136 * <code>PP_OK</code> as if connection is still established without errors. | |
137 */ | |
138 int32_t SendPacket([in] PP_Resource vpn_provider, | |
139 [in] PP_Var packet, | |
140 [in] PP_CompletionCallback callback); | |
141 | |
142 /** | |
143 * GetPacket() receives an IP packet from the tunnel for the VPN session. | |
bbudge
2016/03/22 22:38:33
ReceivePacket? (Send / Receive, or Put / Get)
adrian.belgun
2016/03/29 15:45:44
Done.
| |
144 * This interface only returns a single packet. That is, this interface must | |
145 * be called at least N times to receive N packet, no matter the size of | |
146 * each packet. | |
147 * | |
148 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a | |
149 * VpnProvider. | |
150 * | |
151 * @param[out] packet The received packet is copied to provided | |
152 * <code>packet</code>. The <code>packet</code> must remain valid until | |
153 * GetPacket() completes. Its received <code>PP_VarType</code> will be | |
154 * <code>PP_VARTYPE_ARRAY_BUFFER</code>. | |
155 * | |
156 * @param[in] callback A <code>PP_CompletionCallback</code> called | |
157 * when GetPacket() completes. | |
158 * | |
159 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
160 * If an error is detected or connection is closed, GetPacket() returns | |
161 * <code>PP_ERROR_FAILED</code> after all buffered messages are received. | |
162 * Until buffered packets become empty, GetPacket() continues to return | |
163 * <code>PP_OK</code> as if connection is still established without errors. | |
164 */ | |
165 int32_t GetPacket([in] PP_Resource vpn_provider, | |
166 [out] PP_Var packet, | |
167 [in] PP_CompletionCallback callback); | |
168 }; | |
169 | |
OLD | NEW |