summaryrefslogtreecommitdiffstats
path: root/ppapi/c
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-24 21:31:59 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-24 21:31:59 +0000
commiteac63f9897e85f67ec82fb6bf81a661411f7d9d3 (patch)
treec47d59d6cad62043c92171cf8616e45e0cd3a56b /ppapi/c
parent2b8398b5749297e0d5ef02976481db488dbba5d6 (diff)
downloadchromium_src-eac63f9897e85f67ec82fb6bf81a661411f7d9d3.zip
chromium_src-eac63f9897e85f67ec82fb6bf81a661411f7d9d3.tar.gz
chromium_src-eac63f9897e85f67ec82fb6bf81a661411f7d9d3.tar.bz2
Make PPB_NetworkList_Private immutable.
- NetworkList objects are now immutable. - Added PPB_NetworkMonitor_Private interface. - NetworkList resource is passed to PPB_NetworkMonitor_Callback - Replaced GetIPAddress() with GetIPAddresses() to handle the case when there is more than one or two addresses assigned to an interface. BUG=114808 Review URL: http://codereview.chromium.org/9416083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123548 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c')
-rw-r--r--ppapi/c/private/ppb_network_list_private.h94
-rw-r--r--ppapi/c/private/ppb_network_monitor_private.h97
2 files changed, 125 insertions, 66 deletions
diff --git a/ppapi/c/private/ppb_network_list_private.h b/ppapi/c/private/ppb_network_list_private.h
index c01a346..90cbbe8 100644
--- a/ppapi/c/private/ppb_network_list_private.h
+++ b/ppapi/c/private/ppb_network_list_private.h
@@ -4,23 +4,21 @@
*/
/* From private/ppb_network_list_private.idl,
- * modified Fri Feb 17 11:34:34 2012.
+ * modified Fri Feb 24 10:14:10 2012.
*/
#ifndef PPAPI_C_PRIVATE_PPB_NETWORK_LIST_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NETWORK_LIST_PRIVATE_H_
#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_instance.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"
#include "ppapi/c/private/ppb_net_address_private.h"
-#define PPB_NETWORKLIST_PRIVATE_INTERFACE_0_1 "PPB_NetworkList_Private;0.1"
-#define PPB_NETWORKLIST_PRIVATE_INTERFACE PPB_NETWORKLIST_PRIVATE_INTERFACE_0_1
+#define PPB_NETWORKLIST_PRIVATE_INTERFACE_0_2 "PPB_NetworkList_Private;0.2"
+#define PPB_NETWORKLIST_PRIVATE_INTERFACE PPB_NETWORKLIST_PRIVATE_INTERFACE_0_2
/**
* @file
@@ -29,20 +27,6 @@
/**
- * @addtogroup Typedefs
- * @{
- */
-/**
- * <code>PPB_NetworkListChanged_Callback</code> is a callback function
- * type that is used to receive notifications about changes in the
- * NetworkList.
- */
-typedef void (*PPB_NetworkListChanged_Callback)(void* user_data);
-/**
- * @}
- */
-
-/**
* @addtogroup Enums
* @{
*/
@@ -62,8 +46,8 @@ typedef enum {
* Cellular network (e.g. LTE).
*/
PP_NETWORKLIST_CELLULAR = 2
-} PP_NetworkListType;
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListType, 4);
+} PP_NetworkListType_Private;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListType_Private, 4);
/**
* State of a network interface.
@@ -77,8 +61,8 @@ typedef enum {
* Network interface is up.
*/
PP_NETWORKLIST_UP = 1
-} PP_NetworkListState;
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListState, 4);
+} PP_NetworkListState_Private;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListState_Private, 4);
/**
* @}
*/
@@ -88,20 +72,13 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListState, 4);
* @{
*/
/**
- * The <code>PPB_NetworkList_Private</code> provides list of network
- * interfaces and associated IP addressed.
+ * The <code>PPB_NetworkList_Private</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_Private</code>
+ * interface.
*/
-struct PPB_NetworkList_Private_0_1 {
- /**
- * Create() creates a new <code>NetworkList</code> object.
- *
- * @param[in] instance A <code>PP_Instance</code> identifying one instance
- * of a module.
- *
- * @return A <code>PP_Resource</code> corresponding to a NetworkList if
- * successful, 0 if the instance is invalid.
- */
- PP_Resource (*Create)(PP_Instance instance);
+struct PPB_NetworkList_Private_0_2 {
/**
* Determines if the specified <code>resource</code> is a
* <code>NetworkList</code> object.
@@ -114,26 +91,6 @@ struct PPB_NetworkList_Private_0_1 {
*/
PP_Bool (*IsNetworkList)(PP_Resource resource);
/**
- * Updates the list with the current state of the network interfaces
- * in the system.
- */
- int32_t (*Update)(struct PP_CompletionCallback callback);
- /**
- * Starts change notifications. The specified <code>callback</code>
- * will be called every time the network list changes. Every time
- * the callback is called the plugin must call Update() method to
- * actually receive updated list.
- */
- int32_t (*StartNotifications)(PP_Resource resource,
- PPB_NetworkListChanged_Callback callback,
- void* user_data);
- /**
- * Stops change notifications. After this method is called the
- * callback specified in <code>StartNotifications()</code> will not
- * be called anymore.
- */
- int32_t (*StopNotifications)(PP_Resource resource);
- /**
* @return Returns number of available network interfaces or 0 if
* the list has never been updated.
*/
@@ -147,21 +104,26 @@ struct PPB_NetworkList_Private_0_1 {
* @return Returns type of the network interface with the specified
* <code>index</code>.
*/
- PP_NetworkListType (*GetType)(PP_Resource resource, uint32_t index);
+ PP_NetworkListType_Private (*GetType)(PP_Resource resource, uint32_t index);
/**
* @return Returns current state of the network interface with the
* specified <code>index</code>.
*/
- PP_NetworkListState (*GetState)(PP_Resource resource, uint32_t index);
+ PP_NetworkListState_Private (*GetState)(PP_Resource resource, uint32_t index);
/**
- * @return Returns <code>NetAddress</code> object that contains
- * address of the specified <code>family</code> for the network
- * interface with the specified <code>index</code>, or 0 if the
- * address is not assigned.
+ * Gets list of IP addresses for the network interface with the
+ * specified <code>index</code> and stores them in
+ * <code>addresses</code>. If the caller didn't allocate sufficient
+ * space to store all addresses, then only the first
+ * <code>count</code> addresses are filled in.
+ *
+ * @return Returns total number of IP addresses assigned to the
+ * network interface or a negative error code.
*/
- PP_Resource (*GetIpAddress)(PP_Resource resource,
- uint32_t index,
- PP_NetAddressFamily_Private family);
+ int32_t (*GetIpAddresses)(PP_Resource resource,
+ uint32_t index,
+ struct PP_NetAddress_Private* addresses[],
+ int32_t count);
/**
* @return Returns display name for the network interface with the
* specified <code>index</code>.
@@ -174,7 +136,7 @@ struct PPB_NetworkList_Private_0_1 {
uint32_t (*GetMTU)(PP_Resource resource, uint32_t index);
};
-typedef struct PPB_NetworkList_Private_0_1 PPB_NetworkList_Private;
+typedef struct PPB_NetworkList_Private_0_2 PPB_NetworkList_Private;
/**
* @}
*/
diff --git a/ppapi/c/private/ppb_network_monitor_private.h b/ppapi/c/private/ppb_network_monitor_private.h
new file mode 100644
index 0000000..9893150
--- /dev/null
+++ b/ppapi/c/private/ppb_network_monitor_private.h
@@ -0,0 +1,97 @@
+/* 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 private/ppb_network_monitor_private.idl,
+ * modified Fri Feb 24 10:51:22 2012.
+ */
+
+#ifndef PPAPI_C_PRIVATE_PPB_NETWORK_MONITOR_PRIVATE_H_
+#define PPAPI_C_PRIVATE_PPB_NETWORK_MONITOR_PRIVATE_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_stdint.h"
+
+#define PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_2 \
+ "PPB_NetworkMonitor_Private;0.2"
+#define PPB_NETWORKMONITOR_PRIVATE_INTERFACE \
+ PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_2
+
+/**
+ * @file
+ * This file defines the <code>PPB_NetworkMonitor_Private</code> interface.
+ */
+
+
+/**
+ * @addtogroup Typedefs
+ * @{
+ */
+/**
+ * <code>PPB_NetworkMonitor_Callback</code> is a callback function
+ * type that is used to receive notifications about network
+ * configuration changes. The <code>network_list</code> passed to this
+ * callback is a <code>PPB_NetworkList_Private</code> resource that
+ * contains current configuration of network interfaces.
+ */
+typedef void (*PPB_NetworkMonitor_Callback)(void* user_data,
+ PP_Resource network_list);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/**
+ * The <code>PPB_NetworkMonitor_Private</code> provides access to
+ * notifications of network configuration changes.
+ */
+struct PPB_NetworkMonitor_Private_0_2 {
+ /**
+ * Starts network change monitoring. The specified
+ * <code>callback</code> will be called on the main thread once
+ * after this method is called (to supply the initial network
+ * configuarion) and then later every time network configuration
+ * changes. Notifications are stopped when the returned resource is
+ * destroyed. If the plugin doesn't have access to the network list
+ * then the callback will be called once with the
+ * <code>network_list</code> parameter is set to 0.
+ *
+ * @param[in] callback The callback that will be called every time
+ * network configuration changes or NULL to stop network monitoring.
+ *
+ * @param[inout] user_data The data to be passed to the callback on
+ * each call.
+ *
+ * @return A <code>PP_Resource</code> containing the created
+ * NetworkMonitor resource.
+ */
+ PP_Resource (*Create)(PP_Instance instance,
+ PPB_NetworkMonitor_Callback callback,
+ void* user_data);
+ /**
+ * Determines if the specified <code>resource</code> is a
+ * <code>NetworkMonitor</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_NetworkMonitor_Private</code>, <code>PP_FALSE</code>
+ * otherwise.
+ */
+ PP_Bool (*IsNetworkMonitor)(PP_Resource resource);
+};
+
+typedef struct PPB_NetworkMonitor_Private_0_2 PPB_NetworkMonitor_Private;
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_PRIVATE_PPB_NETWORK_MONITOR_PRIVATE_H_ */
+