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.
6 /* From ppb_network_monitor.idl modified Thu Sep 19 16:42:34 2013. */
8 #ifndef PPAPI_C_PPB_NETWORK_MONITOR_H_
9 #define PPAPI_C_PPB_NETWORK_MONITOR_H_
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"
18 #define PPB_NETWORKMONITOR_INTERFACE_1_0 "PPB_NetworkMonitor;1.0"
19 #define PPB_NETWORKMONITOR_INTERFACE PPB_NETWORKMONITOR_INTERFACE_1_0
23 * This file defines the <code>PPB_NetworkMonitor</code> interface.
28 * @addtogroup Interfaces
32 * The <code>PPB_NetworkMonitor</code> allows to get network interfaces
33 * configuration and monitor network configuration changes.
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
40 struct PPB_NetworkMonitor_1_0
{
42 * Creates a Network Monitor resource.
44 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
47 * @return A <code>PP_Resource</code> corresponding to a network monitor or 0
50 PP_Resource (*Create
)(PP_Instance instance
);
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.
57 * @param[in] network_monitor A <code>PP_Resource</code> corresponding to a
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
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.
68 int32_t (*UpdateNetworkList
)(PP_Resource network_monitor
,
69 PP_Resource
* network_list
,
70 struct PP_CompletionCallback callback
);
72 * Determines if the specified <code>resource</code> is a
73 * <code>NetworkMonitor</code> object.
75 * @param[in] resource A <code>PP_Resource</code> resource.
77 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a
78 * <code>PPB_NetworkMonitor</code>, <code>PP_FALSE</code> otherwise.
80 PP_Bool (*IsNetworkMonitor
)(PP_Resource resource
);
83 typedef struct PPB_NetworkMonitor_1_0 PPB_NetworkMonitor
;
88 #endif /* PPAPI_C_PPB_NETWORK_MONITOR_H_ */