Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 1 | /* Copyright (c) 2012 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 | |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 6 | /* From ppb_network_monitor.idl modified Thu Sep 19 16:42:34 2013. */ |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 7 | |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 8 | #ifndef PPAPI_C_PPB_NETWORK_MONITOR_H_ |
| 9 | #define PPAPI_C_PPB_NETWORK_MONITOR_H_ |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 10 | |
| 11 | #include "ppapi/c/pp_bool.h" |
Torne (Richard Coles) | 58537e2 | 2013-09-12 12:10:22 +0100 | [diff] [blame] | 12 | #include "ppapi/c/pp_completion_callback.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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 | |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 18 | #define PPB_NETWORKMONITOR_INTERFACE_1_0 "PPB_NetworkMonitor;1.0" |
| 19 | #define PPB_NETWORKMONITOR_INTERFACE PPB_NETWORKMONITOR_INTERFACE_1_0 |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 20 | |
| 21 | /** |
| 22 | * @file |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 23 | * This file defines the <code>PPB_NetworkMonitor</code> interface. |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 24 | */ |
| 25 | |
| 26 | |
| 27 | /** |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 28 | * @addtogroup Interfaces |
| 29 | * @{ |
| 30 | */ |
| 31 | /** |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 32 | * The <code>PPB_NetworkMonitor</code> allows to get network interfaces |
| 33 | * configuration and monitor network configuration changes. |
| 34 | * |
| 35 | * Permissions: Apps permission <code>socket</code> with subrule |
| 36 | * <code>network-state</code> is required for <code>UpdateNetworkList()</code>. |
| 37 | * For more details about network communication permissions, please see: |
| 38 | * http://developer.chrome.com/apps/app_network.html |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 39 | */ |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 40 | struct PPB_NetworkMonitor_1_0 { |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 41 | /** |
Torne (Richard Coles) | 58537e2 | 2013-09-12 12:10:22 +0100 | [diff] [blame] | 42 | * Creates a Network Monitor resource. |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 43 | * |
Torne (Richard Coles) | 58537e2 | 2013-09-12 12:10:22 +0100 | [diff] [blame] | 44 | * @param[in] instance A <code>PP_Instance</code> identifying one instance of |
| 45 | * a module. |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 46 | * |
Torne (Richard Coles) | 58537e2 | 2013-09-12 12:10:22 +0100 | [diff] [blame] | 47 | * @return A <code>PP_Resource</code> corresponding to a network monitor or 0 |
| 48 | * on failure. |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 49 | */ |
Torne (Richard Coles) | 58537e2 | 2013-09-12 12:10:22 +0100 | [diff] [blame] | 50 | PP_Resource (*Create)(PP_Instance instance); |
| 51 | /** |
| 52 | * Gets current network configuration. When called for the first time, |
| 53 | * completes as soon as the current network configuration is received from |
| 54 | * the browser. Each consequent call will wait for network list changes, |
| 55 | * returning a new <code>PPB_NetworkList</code> resource every time. |
| 56 | * |
| 57 | * @param[in] network_monitor A <code>PP_Resource</code> corresponding to a |
| 58 | * network monitor. |
| 59 | * @param[out] network_list The <code>PPB_NetworkList<code> resource with the |
| 60 | * current state of network interfaces. |
| 61 | * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 62 | * completion. |
| 63 | * |
| 64 | * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 65 | * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have |
| 66 | * required permissions. |
| 67 | */ |
| 68 | int32_t (*UpdateNetworkList)(PP_Resource network_monitor, |
| 69 | PP_Resource* network_list, |
| 70 | struct PP_CompletionCallback callback); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 71 | /** |
| 72 | * Determines if the specified <code>resource</code> is a |
| 73 | * <code>NetworkMonitor</code> object. |
| 74 | * |
| 75 | * @param[in] resource A <code>PP_Resource</code> resource. |
| 76 | * |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 77 | * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a |
| 78 | * <code>PPB_NetworkMonitor</code>, <code>PP_FALSE</code> otherwise. |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 79 | */ |
| 80 | PP_Bool (*IsNetworkMonitor)(PP_Resource resource); |
| 81 | }; |
| 82 | |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 83 | typedef struct PPB_NetworkMonitor_1_0 PPB_NetworkMonitor; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 84 | /** |
| 85 | * @} |
| 86 | */ |
| 87 | |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 88 | #endif /* PPAPI_C_PPB_NETWORK_MONITOR_H_ */ |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 89 | |