Chromium Code Reviews| Index: ppapi/api/ppb_network_list.idl |
| diff --git a/ppapi/api/ppb_network_list.idl b/ppapi/api/ppb_network_list.idl |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0d14ba28716db085740319f0f221556b73fe7a8b |
| --- /dev/null |
| +++ b/ppapi/api/ppb_network_list.idl |
| @@ -0,0 +1,169 @@ |
| +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
yzshen1
2013/08/30 17:31:46
nit: 2013.
|
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +/** |
| + * This file defines the <code>PPB_NetworkList</code> interface. |
| + */ |
| + |
| +[generate_thunk] |
| + |
| +label Chrome { |
| + M31 = 1.0 |
| +}; |
| + |
| +/** |
| + * Type of a network interface. |
| + */ |
| +[assert_size(4)] |
| +enum PP_NetworkListType { |
| + /** |
| + * Type of the network interface is not known. |
| + */ |
| + PP_NETWORKLIST_UNKNOWN = 0, |
| + |
| + /** |
| + * Wired Ethernet network. |
| + */ |
| + PP_NETWORKLIST_ETHERNET = 1, |
| + |
| + /** |
| + * Wireless Wi-Fi network. |
| + */ |
| + PP_NETWORKLIST_WIFI = 2, |
| + |
| + /** |
| + * Cellular network (e.g. LTE). |
| + */ |
| + PP_NETWORKLIST_CELLULAR = 3 |
| +}; |
| + |
| +/** |
| + * State of a network interface. |
| + */ |
| +[assert_size(4)] |
| +enum PP_NetworkListState { |
| + /** |
| + * Network interface is down. |
| + */ |
| + PP_NETWORKLIST_DOWN = 0, |
|
yzshen1
2013/08/30 17:31:46
- Both enum has PP_NETWORKLIST_ prefix. Shall we u
|
| + |
| + /** |
| + * Network interface is up. |
| + */ |
| + PP_NETWORKLIST_UP = 1 |
| +}; |
| + |
| +/** |
| + * The <code>PPB_NetworkList</code> is used to represent a list of |
| + * network interfaces and their configuration. The content of the list |
| + * is immutable. The current networks configuration can be received |
| + * using the <code>PPB_NetworkMonitor</code> interface. |
| + */ |
| +interface PPB_NetworkList { |
| + /** |
| + * Determines if the specified <code>resource</code> is a |
| + * <code>NetworkList</code> object. |
| + * |
| + * @param[in] resource A <code>PP_Resource</code> resource. |
| + * |
| + * @return Returns <code>PP_TRUE</code> if <code>resource</code> is |
| + * a <code>PPB_NetworkList</code>, <code>PP_FALSE</code> |
| + * otherwise. |
| + */ |
| + PP_Bool IsNetworkList([in] PP_Resource resource); |
| + |
| + /** |
| + * Gets number of interfaces in the list. |
| + * |
| + * @return Returns number of available network interfaces or 0 if |
| + * the list has never been updated. |
| + */ |
| + uint32_t GetCount([in] PP_Resource resource); |
| + |
| + /** |
| + * Gets name of a network interface. |
| + * |
| + * @param[in] resource A <code>PP_Resource</code> corresponding to a |
| + * network list. |
| + * @param[in] index Index of the network interface. |
| + * |
| + * @return Returns name for the network interface with the specified |
| + * <code>index</code>. |
| + */ |
| + PP_Var GetName([in] PP_Resource resource, |
| + [in] uint32_t index); |
| + |
| + /** |
| + * Gets type of a network interface. |
| + * |
| + * @param[in] resource A <code>PP_Resource</code> corresponding to a |
| + * network list. |
| + * @param[in] index Index of the network interface. |
| + * |
| + * @return Returns type of the network interface with the specified |
| + * <code>index</code>. |
| + */ |
| + [on_failure=PP_NETWORKLIST_UNKNOWN] |
| + PP_NetworkListType GetType([in] PP_Resource resource, |
| + [in] uint32_t index); |
| + |
| + /** |
| + * Gets state of a network interface. |
| + * |
| + * @param[in] resource A <code>PP_Resource</code> corresponding to a |
| + * network list. |
| + * @param[in] index Index of the network interface. |
| + * |
| + * @return Returns current state of the network interface with the |
| + * specified <code>index</code>. |
| + */ |
| + [on_failure=PP_NETWORKLIST_DOWN] |
| + PP_NetworkListState GetState([in] PP_Resource resource, |
| + [in] uint32_t index); |
| + |
| + /** |
| + * Gets list of IP addresses for a network interface. |
| + * |
| + * @param[in] resource A <code>PP_Resource</code> corresponding to a |
| + * network list. |
| + * @param[in] index Index of the network interface. |
| + * @param[in] output An output array which will receive |
| + * <code>PPB_NetAddress</code> resources on success. Please note that the |
| + * ref count of those resources has already been increased by 1 for the |
| + * caller. |
| + * |
| + * @return An error code from <code>pp_errors.h</code>. |
| + */ |
| + int32_t GetIpAddresses([in] PP_Resource resource, |
| + [in] uint32_t index, |
| + [in] PP_ArrayOutput output); |
| + |
| + /** |
| + * Gets display name of a network interface. |
| + * |
| + * @param[in] resource A <code>PP_Resource</code> corresponding to a |
| + * network list. |
| + * @param[in] index Index of the network interface. |
| + * |
| + * @return Returns display name for the network interface with the |
| + * specified <code>index</code>. |
|
yzshen1
2013/08/30 17:31:46
It seems good to comment about the failure output.
|
| + */ |
| + PP_Var GetDisplayName([in] PP_Resource resource, |
| + [in] uint32_t index); |
| + |
| + /** |
| + * Gets MTU (Maximum Transmission Unit) of a network interface. |
| + * |
| + * @param[in] resource A <code>PP_Resource</code> corresponding to a |
| + * network list. |
| + * @param[in] index Index of the network interface. |
| + * |
| + * @return Returns MTU for the network interface with the specified |
| + * <code>index</code> or 0 if MTU is unknown. |
| + */ |
| + uint32_t GetMTU([in] PP_Resource resource, |
| + [in] uint32_t index); |
| + |
| +}; |