Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: ppapi/c/ppb_network_list.h

Issue 23450012: Make NetworkList and NetworkMonitor APIs public (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/c/ppb_network_list.h
diff --git a/ppapi/c/ppb_network_list.h b/ppapi/c/ppb_network_list.h
new file mode 100644
index 0000000000000000000000000000000000000000..073a89dcf31abd7a3af953392b9e1babd7bcd9fe
--- /dev/null
+++ b/ppapi/c/ppb_network_list.h
@@ -0,0 +1,180 @@
+/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* From ppb_network_list.idl modified Thu Aug 29 18:00:54 2013. */
+
+#ifndef PPAPI_C_PPB_NETWORK_LIST_H_
+#define PPAPI_C_PPB_NETWORK_LIST_H_
+
+#include "ppapi/c/pp_array_output.h"
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_var.h"
+
+#define PPB_NETWORKLIST_INTERFACE_1_0 "PPB_NetworkList;1.0"
+#define PPB_NETWORKLIST_INTERFACE PPB_NETWORKLIST_INTERFACE_1_0
+
+/**
+ * @file
+ * This file defines the <code>PPB_NetworkList</code> interface.
+ */
+
+
+/**
+ * @addtogroup Enums
+ * @{
+ */
+/**
+ * Type of a network interface.
+ */
+typedef enum {
+ /**
+ * 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
+} PP_NetworkListType;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListType, 4);
+
+/**
+ * State of a network interface.
+ */
+typedef enum {
+ /**
+ * Network interface is down.
+ */
+ PP_NETWORKLIST_DOWN = 0,
+ /**
+ * Network interface is up.
+ */
+ PP_NETWORKLIST_UP = 1
+} PP_NetworkListState;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListState, 4);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/**
+ * 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.
+ */
+struct PPB_NetworkList_1_0 {
+ /**
+ * 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)(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)(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>.
+ */
+ struct PP_Var (*GetName)(PP_Resource resource, 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>.
+ */
+ PP_NetworkListType (*GetType)(PP_Resource resource, 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>.
+ */
+ PP_NetworkListState (*GetState)(PP_Resource resource, 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)(PP_Resource resource,
+ uint32_t index,
+ struct 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>.
+ */
+ struct PP_Var (*GetDisplayName)(PP_Resource resource, 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)(PP_Resource resource, uint32_t index);
+};
+
+typedef struct PPB_NetworkList_1_0 PPB_NetworkList;
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_PPB_NETWORK_LIST_H_ */
+

Powered by Google App Engine
This is Rietveld 408576698