| Index: ppapi/c/ppb_vpn_provider.h
|
| diff --git a/ppapi/c/ppb_vpn_provider.h b/ppapi/c/ppb_vpn_provider.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..09e584afff95b952ac3160862d490f8799aae7d1
|
| --- /dev/null
|
| +++ b/ppapi/c/ppb_vpn_provider.h
|
| @@ -0,0 +1,160 @@
|
| +/* Copyright 2016 The Chromium Authors. All rights reserved.
|
| + * Use of this source code is governed by a BSD-style license that can be
|
| + * found in the LICENSE file.
|
| + */
|
| +
|
| +/* From ppb_vpn_provider.idl modified Tue Mar 15 12:04:58 2016. */
|
| +
|
| +#ifndef PPAPI_C_PPB_VPN_PROVIDER_H_
|
| +#define PPAPI_C_PPB_VPN_PROVIDER_H_
|
| +
|
| +#include "ppapi/c/pp_bool.h"
|
| +#include "ppapi/c/pp_completion_callback.h"
|
| +#include "ppapi/c/pp_instance.h"
|
| +#include "ppapi/c/pp_macros.h"
|
| +#include "ppapi/c/pp_resource.h"
|
| +#include "ppapi/c/pp_stdint.h"
|
| +#include "ppapi/c/pp_var.h"
|
| +
|
| +#define PPB_VPNPROVIDER_INTERFACE_0_1 "PPB_VpnProvider;0.1" /* dev */
|
| +/**
|
| + * @file
|
| + * This file defines the <code>PPB_VpnProvider</code> interface.
|
| + */
|
| +
|
| +
|
| +/**
|
| + * @addtogroup Interfaces
|
| + * @{
|
| + */
|
| +/**
|
| + * Use the <code>PPB_VpnProvider</code> interface to implement a VPN client.
|
| + * Important: This API is available only on Chrome OS.
|
| + */
|
| +struct PPB_VpnProvider_0_1 { /* dev */
|
| + /**
|
| + * Create() creates a VpnProvider instance.
|
| + *
|
| + * @param[in] instance A <code>PP_Instance</code> identifying the instance
|
| + * with the VpnProvider.
|
| + *
|
| + * @return A <code>PP_Resource</code> corresponding to a VpnProvider if
|
| + * successful.
|
| + */
|
| + PP_Resource (*Create)(PP_Instance instance);
|
| + /**
|
| + * IsVpnProvider() determines if the provided <code>resource</code> is a
|
| + * VpnProvider instance.
|
| + *
|
| + * @param[in] resource A <code>PP_Resource</code> corresponding to a
|
| + * VpnProvider.
|
| + *
|
| + * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a
|
| + * <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the
|
| + * <code>resource</code> is invalid or some type other than
|
| + * <code>PPB_VpnProvider</code>.
|
| + */
|
| + PP_Bool (*IsVpnProvider)(PP_Resource resource);
|
| + /**
|
| + * Bind() binds to an existing connection created by
|
| + * <code>chrome.vpnProvider.createConfig</code>. All packets will be routed
|
| + * via <code>SendPacket</code> and <code>GetPacket</code> in the Native
|
| + * Client API.
|
| + *
|
| + * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
|
| + * VpnProvider.
|
| + *
|
| + * @param[in] name A <code>PP_VARTYPE_STRING</code> representing the
|
| + * connection name as defined by the user when calling
|
| + * <code>chrome.vpnProvider.createConfig</code>.
|
| + *
|
| + * @param[in] id A <code>PP_VARTYPE_STRING</code> representing the connection
|
| + * id from the callback of <code>chrome.vpnProvider.createConfig</code>.
|
| + *
|
| + * @param[in] callback A <code>PP_CompletionCallback</code> called when
|
| + * the connection gets bound.
|
| + *
|
| + * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a
|
| + * <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the
|
| + * <code>resource</code> is invalid or some type other than
|
| + * <code>PPB_VpnProvider</code>.
|
| + *
|
| + */
|
| + int32_t (*Bind)(PP_Resource vpn_provider,
|
| + struct PP_Var name,
|
| + struct PP_Var id,
|
| + struct PP_CompletionCallback callback);
|
| + /**
|
| + * GetUnBindEvent() registers a callback that will be called when the current
|
| + * connection gets unbound.
|
| + *
|
| + * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
|
| + * VpnProvider.
|
| + *
|
| + * @param[in] callback A <code>PP_CompletionCallback</code> called when
|
| + * the current connection gets unbound.
|
| + *
|
| + * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a
|
| + * <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the
|
| + * <code>resource</code> is invalid or some type other than
|
| + * <code>PPB_VpnProvider</code>.
|
| + *
|
| + */
|
| + int32_t (*GetUnBindEvent)(PP_Resource vpn_provider,
|
| + struct PP_CompletionCallback callback);
|
| + /**
|
| + * SendPacket() sends an IP packet through the tunnel created for the VPN
|
| + * session. This will succeed only when the VPN session is owned by the
|
| + * module.
|
| + *
|
| + * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
|
| + * VpnProvider.
|
| + *
|
| + * @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to
|
| + * an IP packet to be sent to the platform.
|
| + *
|
| + * @param[in] callback A <code>PP_CompletionCallback</code> called
|
| + * when SendPacket() completes.
|
| + *
|
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>.
|
| + * If an error is detected or connection is closed, GetPacket() returns
|
| + * <code>PP_ERROR_FAILED</code> after all buffered messages are received.
|
| + * Until buffered packets become empty, GetPacket() continues to return
|
| + * <code>PP_OK</code> as if connection is still established without errors.
|
| + */
|
| + int32_t (*SendPacket)(PP_Resource vpn_provider,
|
| + struct PP_Var packet,
|
| + struct PP_CompletionCallback callback);
|
| + /**
|
| + * GetPacket() receives an IP packet from the tunnel for the VPN session.
|
| + * This interface only returns a single packet. That is, this interface must
|
| + * be called at least N times to receive N packet, no matter the size of
|
| + * each packet.
|
| + *
|
| + * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a
|
| + * VpnProvider.
|
| + *
|
| + * @param[out] packet The received packet is copied to provided
|
| + * <code>packet</code>. The <code>packet</code> must remain valid until
|
| + * GetPacket() completes. Its received <code>PP_VarType</code> will be
|
| + * <code>PP_VARTYPE_ARRAY_BUFFER</code>.
|
| + *
|
| + * @param[in] callback A <code>PP_CompletionCallback</code> called
|
| + * when GetPacket() completes.
|
| + *
|
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>.
|
| + * If an error is detected or connection is closed, GetPacket() returns
|
| + * <code>PP_ERROR_FAILED</code> after all buffered messages are received.
|
| + * Until buffered packets become empty, GetPacket() continues to return
|
| + * <code>PP_OK</code> as if connection is still established without errors.
|
| + */
|
| + int32_t (*GetPacket)(PP_Resource vpn_provider,
|
| + struct PP_Var* packet,
|
| + struct PP_CompletionCallback callback);
|
| +};
|
| +/**
|
| + * @}
|
| + */
|
| +
|
| +#endif /* PPAPI_C_PPB_VPN_PROVIDER_H_ */
|
| +
|
|
|