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. | |
| 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>. | |
|
bbudge
2016/04/26 18:25:21
Comment seems to be from IsVpnProvider.
It's help
adrian.belgun
2016/04/27 14:55:20
Acknowledged.
| |
| 69 * | |
| 70 */ | |
| 71 int32_t Bind([in] PP_Resource vpn_provider, | |
| 72 [in] PP_Var configuration_id, | |
| 73 [in] PP_Var configuration_name, | |
| 74 [in] PP_CompletionCallback callback); | |
|
bbudge
2016/04/26 18:25:20
nit: blank line
adrian.belgun
2016/04/27 14:55:20
Done.
| |
| 75 /** | |
| 76 * GetUnBindEvent() registers a callback that will be called when the current | |
| 77 * configuration gets unbound. | |
|
bbudge
2016/04/26 18:25:20
Is it OK to call this before calling Bind? More do
adrian.belgun
2016/05/04 13:38:45
Done.
| |
| 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 configuration gets unbound. | |
| 84 * | |
| 85 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
| 86 */ | |
| 87 int32_t GetUnBindEvent([in] PP_Resource vpn_provider, | |
|
bbudge
2016/04/26 18:25:20
s/UnBind/Unbind
Here and everywhere else in this
adrian.belgun
2016/04/27 14:55:20
Done.
| |
| 88 [in] PP_CompletionCallback callback); | |
| 89 | |
| 90 /** | |
| 91 * SendPacket() sends an IP packet through the tunnel created for the VPN | |
| 92 * session. This will succeed only when the VPN session is owned by the | |
| 93 * module. | |
|
bbudge
2016/04/26 18:25:20
I'm guessing Bind() must have completed successful
adrian.belgun
2016/05/04 13:38:44
Done.
| |
| 94 * | |
| 95 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a | |
| 96 * VpnProvider. | |
| 97 * | |
| 98 * @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to | |
| 99 * an IP packet to be sent to the platform. | |
| 100 * | |
| 101 * @param[in] callback A <code>PP_CompletionCallback</code> called | |
| 102 * when SendPacket() completes. | |
| 103 * | |
| 104 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
| 105 */ | |
| 106 int32_t SendPacket([in] PP_Resource vpn_provider, | |
| 107 [in] PP_Var packet, | |
| 108 [in] PP_CompletionCallback callback); | |
| 109 | |
| 110 /** | |
| 111 * ReceivePacket() receives an IP packet from the tunnel for the VPN session. | |
| 112 * This interface only returns a single packet. That is, this interface must | |
|
bbudge
2016/04/26 18:25:20
s/interface/function
adrian.belgun
2016/04/27 14:55:20
Done.
| |
| 113 * be called at least N times to receive N packet, no matter the size of | |
|
bbudge
2016/04/26 18:25:20
s/packet/packets
adrian.belgun
2016/04/27 14:55:20
Done.
| |
| 114 * each packet. | |
|
bbudge
2016/04/26 18:25:21
Same comments as SendPacket regarding behavior.
adrian.belgun
2016/05/04 13:38:44
Done.
| |
| 115 * | |
| 116 * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a | |
| 117 * VpnProvider. | |
| 118 * | |
| 119 * @param[out] packet The received packet is copied to provided | |
| 120 * <code>packet</code>. The <code>packet</code> must remain valid until | |
|
bbudge
2016/04/26 18:25:21
nit: delete 'The' since you're referring to the fu
adrian.belgun
2016/04/27 14:55:20
Done.
| |
| 121 * ReceivePacket() completes. Its received <code>PP_VarType</code> will be | |
| 122 * <code>PP_VARTYPE_ARRAY_BUFFER</code>. | |
| 123 * | |
| 124 * @param[in] callback A <code>PP_CompletionCallback</code> called | |
| 125 * when ReceivePacket() completes. | |
| 126 * | |
| 127 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
| 128 * If an error is detected or connection is closed, ReceivePacket() returns | |
| 129 * <code>PP_ERROR_FAILED</code> after all buffered messages are received. | |
| 130 * Until buffered packets become empty, ReceivePacket() continues to return | |
| 131 * <code>PP_OK</code> as if connection is still established without errors. | |
|
bbudge
2016/04/26 18:25:21
Is this by design? Why not just abort all pending
adrian.belgun
2016/05/04 13:38:44
Done.
| |
| 132 */ | |
| 133 int32_t ReceivePacket([in] PP_Resource vpn_provider, | |
| 134 [out] PP_Var packet, | |
| 135 [in] PP_CompletionCallback callback); | |
| 136 }; | |
| OLD | NEW |