Chromium Code Reviews| 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] 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 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 configuration created by | |
| 48 * <code>chrome.vpnProvider.createConfig</code>. All packets will be routed | |
| 49 * via <code>SendPacket</code> and <code>ReceivePacket</code>. | |
| 50 * | |
| 51 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a | |
| 52 * VpnProvider. | |
| 53 * | |
| 54 * @param[in] configuration_id A <code>PP_VARTYPE_STRING</code> representing | |
| 55 * the configuration id from the callback of | |
| 56 * <code>chrome.vpnProvider.createConfig</code>. | |
| 57 * | |
| 58 * @param[in] configuration_name A <code>PP_VARTYPE_STRING</code> representing | |
| 59 * the configuration name as defined by the user when calling | |
| 60 * <code>chrome.vpnProvider.createConfig</code>. | |
| 61 * | |
| 62 * @param[in] callback A <code>PP_CompletionCallback</code> called when | |
| 63 * the configuration gets bound. | |
|
bbudge
2016/04/27 16:07:14
nit: called on completion
It's possible that Bind
adrian.belgun
2016/05/04 13:38:45
Done.
| |
| 64 * | |
| 65 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
| 66 */ | |
| 67 int32_t Bind([in] PP_Resource vpn_provider, | |
| 68 [in] PP_Var configuration_id, | |
| 69 [in] PP_Var configuration_name, | |
| 70 [in] PP_CompletionCallback callback); | |
| 71 | |
| 72 /** | |
| 73 * GetUnbindEvent() registers a callback that will be called when the current | |
| 74 * configuration gets unbound. | |
|
bbudge
2016/04/27 16:07:14
Can this be called before Bind()?
adrian.belgun
2016/05/04 13:38:45
The callback notifies the plugin that an Unbind ev
| |
| 75 * | |
| 76 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a | |
| 77 * VpnProvider. | |
| 78 * | |
| 79 * @param[in] callback A <code>PP_CompletionCallback</code> called when | |
| 80 * the current configuration gets unbound. | |
| 81 * | |
| 82 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
| 83 */ | |
| 84 int32_t GetUnbindEvent([in] PP_Resource vpn_provider, | |
| 85 [in] PP_CompletionCallback callback); | |
| 86 | |
| 87 /** | |
| 88 * SendPacket() sends an IP packet through the tunnel created for the VPN | |
| 89 * session. This will succeed only when the VPN session is owned by the | |
| 90 * module. | |
|
bbudge
2016/04/27 16:07:13
Do you mean this will succeed only when the VpnPro
adrian.belgun
2016/05/04 13:38:45
Yes. The connection must be bound.
As currently i
| |
| 91 * | |
| 92 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a | |
| 93 * VpnProvider. | |
| 94 * | |
| 95 * @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to | |
| 96 * an IP packet to be sent to the platform. | |
| 97 * | |
| 98 * @param[in] callback A <code>PP_CompletionCallback</code> called | |
| 99 * when SendPacket() completes. | |
| 100 * | |
| 101 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
| 102 */ | |
| 103 int32_t SendPacket([in] PP_Resource vpn_provider, | |
| 104 [in] PP_Var packet, | |
| 105 [in] PP_CompletionCallback callback); | |
| 106 | |
| 107 /** | |
| 108 * ReceivePacket() receives an IP packet from the tunnel for the VPN session. | |
| 109 * This function only returns a single packet. That is, this function must | |
| 110 * be called at least N times to receive N packets, no matter the size of | |
| 111 * each packet. | |
|
bbudge
2016/04/27 16:07:14
Can this be called before Bind()?
Document that ca
adrian.belgun
2016/05/04 13:38:45
Done.
| |
| 112 * | |
| 113 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a | |
| 114 * VpnProvider. | |
| 115 * | |
| 116 * @param[out] packet The received packet is copied to provided | |
| 117 * <code>packet</code>. The <code>packet</code> must remain valid until | |
| 118 * ReceivePacket() completes. Its received <code>PP_VarType</code> will be | |
| 119 * <code>PP_VARTYPE_ARRAY_BUFFER</code>. | |
| 120 * | |
| 121 * @param[in] callback A <code>PP_CompletionCallback</code> called | |
| 122 * when ReceivePacket() completes. | |
| 123 * | |
| 124 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
| 125 * If an error is detected or connection is closed, ReceivePacket() returns | |
| 126 * <code>PP_ERROR_FAILED</code> after all buffered messages are received. | |
| 127 * Until buffered packets become empty, ReceivePacket() continues to return | |
| 128 * <code>PP_OK</code> as if connection is still established without errors. | |
|
bbudge
2016/04/27 16:07:13
This error / disconnection behavior seems invisibl
adrian.belgun
2016/05/04 13:38:45
Done.
| |
| 129 */ | |
| 130 int32_t ReceivePacket([in] PP_Resource vpn_provider, | |
| 131 [out] PP_Var packet, | |
| 132 [in] PP_CompletionCallback callback); | |
| 133 }; | |
| OLD | NEW |