blob: 6408a453b9199f00d8699cea07ecbd97fbd08253 [file] [log] [blame]
Torne (Richard Coles)58218062012-11-14 11:43:16 +00001/* 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)68043e12013-09-26 13:24:57 +01006/* From ppb_network_monitor.idl modified Thu Sep 19 16:42:34 2013. */
Torne (Richard Coles)58218062012-11-14 11:43:16 +00007
Torne (Richard Coles)68043e12013-09-26 13:24:57 +01008#ifndef PPAPI_C_PPB_NETWORK_MONITOR_H_
9#define PPAPI_C_PPB_NETWORK_MONITOR_H_
Torne (Richard Coles)58218062012-11-14 11:43:16 +000010
11#include "ppapi/c/pp_bool.h"
Torne (Richard Coles)58537e22013-09-12 12:10:22 +010012#include "ppapi/c/pp_completion_callback.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000013#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)68043e12013-09-26 13:24:57 +010018#define PPB_NETWORKMONITOR_INTERFACE_1_0 "PPB_NetworkMonitor;1.0"
19#define PPB_NETWORKMONITOR_INTERFACE PPB_NETWORKMONITOR_INTERFACE_1_0
Torne (Richard Coles)58218062012-11-14 11:43:16 +000020
21/**
22 * @file
Torne (Richard Coles)68043e12013-09-26 13:24:57 +010023 * This file defines the <code>PPB_NetworkMonitor</code> interface.
Torne (Richard Coles)58218062012-11-14 11:43:16 +000024 */
25
26
27/**
Torne (Richard Coles)58218062012-11-14 11:43:16 +000028 * @addtogroup Interfaces
29 * @{
30 */
31/**
Torne (Richard Coles)68043e12013-09-26 13:24:57 +010032 * 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)58218062012-11-14 11:43:16 +000039 */
Torne (Richard Coles)68043e12013-09-26 13:24:57 +010040struct PPB_NetworkMonitor_1_0 {
Torne (Richard Coles)58218062012-11-14 11:43:16 +000041 /**
Torne (Richard Coles)58537e22013-09-12 12:10:22 +010042 * Creates a Network Monitor resource.
Torne (Richard Coles)58218062012-11-14 11:43:16 +000043 *
Torne (Richard Coles)58537e22013-09-12 12:10:22 +010044 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
45 * a module.
Torne (Richard Coles)58218062012-11-14 11:43:16 +000046 *
Torne (Richard Coles)58537e22013-09-12 12:10:22 +010047 * @return A <code>PP_Resource</code> corresponding to a network monitor or 0
48 * on failure.
Torne (Richard Coles)58218062012-11-14 11:43:16 +000049 */
Torne (Richard Coles)58537e22013-09-12 12:10:22 +010050 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)58218062012-11-14 11:43:16 +000071 /**
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)68043e12013-09-26 13:24:57 +010077 * @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)58218062012-11-14 11:43:16 +000079 */
80 PP_Bool (*IsNetworkMonitor)(PP_Resource resource);
81};
82
Torne (Richard Coles)68043e12013-09-26 13:24:57 +010083typedef struct PPB_NetworkMonitor_1_0 PPB_NetworkMonitor;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000084/**
85 * @}
86 */
87
Torne (Richard Coles)68043e12013-09-26 13:24:57 +010088#endif /* PPAPI_C_PPB_NETWORK_MONITOR_H_ */
Torne (Richard Coles)58218062012-11-14 11:43:16 +000089