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 6 /* From ppb_network_monitor.idl modified Thu Sep 19 16:42:34 2013. */ 7 8 #ifndef PPAPI_C_PPB_NETWORK_MONITOR_H_ 9 #define PPAPI_C_PPB_NETWORK_MONITOR_H_ 10 11 #include "ppapi/c/pp_bool.h" 12 #include "ppapi/c/pp_completion_callback.h" 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 18 #define PPB_NETWORKMONITOR_INTERFACE_1_0 "PPB_NetworkMonitor;1.0" 19 #define PPB_NETWORKMONITOR_INTERFACE PPB_NETWORKMONITOR_INTERFACE_1_0 20 21 /** 22 * @file 23 * This file defines the <code>PPB_NetworkMonitor</code> interface. 24 */ 25 26 27 /** 28 * @addtogroup Interfaces 29 * @{ 30 */ 31 /** 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 39 */ 40 struct PPB_NetworkMonitor_1_0 { 41 /** 42 * Creates a Network Monitor resource. 43 * 44 * @param[in] instance A <code>PP_Instance</code> identifying one instance of 45 * a module. 46 * 47 * @return A <code>PP_Resource</code> corresponding to a network monitor or 0 48 * on failure. 49 */ 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); 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 * 77 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a 78 * <code>PPB_NetworkMonitor</code>, <code>PP_FALSE</code> otherwise. 79 */ 80 PP_Bool (*IsNetworkMonitor)(PP_Resource resource); 81 }; 82 83 typedef struct PPB_NetworkMonitor_1_0 PPB_NetworkMonitor; 84 /** 85 * @} 86 */ 87 88 #endif /* PPAPI_C_PPB_NETWORK_MONITOR_H_ */ 89 90