| OLD | NEW |
| 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 /* From private/ppb_network_list_private.idl, | 6 /* From private/ppb_network_list_private.idl, |
| 7 * modified Fri Feb 17 11:34:34 2012. | 7 * modified Fri Feb 24 10:14:10 2012. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 #ifndef PPAPI_C_PRIVATE_PPB_NETWORK_LIST_PRIVATE_H_ | 10 #ifndef PPAPI_C_PRIVATE_PPB_NETWORK_LIST_PRIVATE_H_ |
| 11 #define PPAPI_C_PRIVATE_PPB_NETWORK_LIST_PRIVATE_H_ | 11 #define PPAPI_C_PRIVATE_PPB_NETWORK_LIST_PRIVATE_H_ |
| 12 | 12 |
| 13 #include "ppapi/c/pp_bool.h" | 13 #include "ppapi/c/pp_bool.h" |
| 14 #include "ppapi/c/pp_completion_callback.h" | |
| 15 #include "ppapi/c/pp_instance.h" | |
| 16 #include "ppapi/c/pp_macros.h" | 14 #include "ppapi/c/pp_macros.h" |
| 17 #include "ppapi/c/pp_resource.h" | 15 #include "ppapi/c/pp_resource.h" |
| 18 #include "ppapi/c/pp_stdint.h" | 16 #include "ppapi/c/pp_stdint.h" |
| 19 #include "ppapi/c/pp_var.h" | 17 #include "ppapi/c/pp_var.h" |
| 20 #include "ppapi/c/private/ppb_net_address_private.h" | 18 #include "ppapi/c/private/ppb_net_address_private.h" |
| 21 | 19 |
| 22 #define PPB_NETWORKLIST_PRIVATE_INTERFACE_0_1 "PPB_NetworkList_Private;0.1" | 20 #define PPB_NETWORKLIST_PRIVATE_INTERFACE_0_2 "PPB_NetworkList_Private;0.2" |
| 23 #define PPB_NETWORKLIST_PRIVATE_INTERFACE PPB_NETWORKLIST_PRIVATE_INTERFACE_0_1 | 21 #define PPB_NETWORKLIST_PRIVATE_INTERFACE PPB_NETWORKLIST_PRIVATE_INTERFACE_0_2 |
| 24 | 22 |
| 25 /** | 23 /** |
| 26 * @file | 24 * @file |
| 27 * This file defines the <code>PPB_NetworkList_Private</code> interface. | 25 * This file defines the <code>PPB_NetworkList_Private</code> interface. |
| 28 */ | 26 */ |
| 29 | 27 |
| 30 | 28 |
| 31 /** | 29 /** |
| 32 * @addtogroup Typedefs | |
| 33 * @{ | |
| 34 */ | |
| 35 /** | |
| 36 * <code>PPB_NetworkListChanged_Callback</code> is a callback function | |
| 37 * type that is used to receive notifications about changes in the | |
| 38 * NetworkList. | |
| 39 */ | |
| 40 typedef void (*PPB_NetworkListChanged_Callback)(void* user_data); | |
| 41 /** | |
| 42 * @} | |
| 43 */ | |
| 44 | |
| 45 /** | |
| 46 * @addtogroup Enums | 30 * @addtogroup Enums |
| 47 * @{ | 31 * @{ |
| 48 */ | 32 */ |
| 49 /** | 33 /** |
| 50 * Type of a network interface. | 34 * Type of a network interface. |
| 51 */ | 35 */ |
| 52 typedef enum { | 36 typedef enum { |
| 53 /** | 37 /** |
| 54 * Wired Ethernet network. | 38 * Wired Ethernet network. |
| 55 */ | 39 */ |
| 56 PP_NETWORKLIST_ETHERNET = 0, | 40 PP_NETWORKLIST_ETHERNET = 0, |
| 57 /** | 41 /** |
| 58 * Wireless Wi-Fi network. | 42 * Wireless Wi-Fi network. |
| 59 */ | 43 */ |
| 60 PP_NETWORKLIST_WIFI = 1, | 44 PP_NETWORKLIST_WIFI = 1, |
| 61 /** | 45 /** |
| 62 * Cellular network (e.g. LTE). | 46 * Cellular network (e.g. LTE). |
| 63 */ | 47 */ |
| 64 PP_NETWORKLIST_CELLULAR = 2 | 48 PP_NETWORKLIST_CELLULAR = 2 |
| 65 } PP_NetworkListType; | 49 } PP_NetworkListType_Private; |
| 66 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListType, 4); | 50 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListType_Private, 4); |
| 67 | 51 |
| 68 /** | 52 /** |
| 69 * State of a network interface. | 53 * State of a network interface. |
| 70 */ | 54 */ |
| 71 typedef enum { | 55 typedef enum { |
| 72 /** | 56 /** |
| 73 * Network interface is down. | 57 * Network interface is down. |
| 74 */ | 58 */ |
| 75 PP_NETWORKLIST_DOWN = 0, | 59 PP_NETWORKLIST_DOWN = 0, |
| 76 /** | 60 /** |
| 77 * Network interface is up. | 61 * Network interface is up. |
| 78 */ | 62 */ |
| 79 PP_NETWORKLIST_UP = 1 | 63 PP_NETWORKLIST_UP = 1 |
| 80 } PP_NetworkListState; | 64 } PP_NetworkListState_Private; |
| 81 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListState, 4); | 65 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListState_Private, 4); |
| 82 /** | 66 /** |
| 83 * @} | 67 * @} |
| 84 */ | 68 */ |
| 85 | 69 |
| 86 /** | 70 /** |
| 87 * @addtogroup Interfaces | 71 * @addtogroup Interfaces |
| 88 * @{ | 72 * @{ |
| 89 */ | 73 */ |
| 90 /** | 74 /** |
| 91 * The <code>PPB_NetworkList_Private</code> provides list of network | 75 * The <code>PPB_NetworkList_Private</code> is used to represent a |
| 92 * interfaces and associated IP addressed. | 76 * list of network interfaces and their configuration. The content of |
| 77 * the list is immutable. The current networks configuration can be |
| 78 * received using the <code>PPB_NetworkMonitor_Private</code> |
| 79 * interface. |
| 93 */ | 80 */ |
| 94 struct PPB_NetworkList_Private_0_1 { | 81 struct PPB_NetworkList_Private_0_2 { |
| 95 /** | |
| 96 * Create() creates a new <code>NetworkList</code> object. | |
| 97 * | |
| 98 * @param[in] instance A <code>PP_Instance</code> identifying one instance | |
| 99 * of a module. | |
| 100 * | |
| 101 * @return A <code>PP_Resource</code> corresponding to a NetworkList if | |
| 102 * successful, 0 if the instance is invalid. | |
| 103 */ | |
| 104 PP_Resource (*Create)(PP_Instance instance); | |
| 105 /** | 82 /** |
| 106 * Determines if the specified <code>resource</code> is a | 83 * Determines if the specified <code>resource</code> is a |
| 107 * <code>NetworkList</code> object. | 84 * <code>NetworkList</code> object. |
| 108 * | 85 * |
| 109 * @param[in] resource A <code>PP_Resource</code> resource. | 86 * @param[in] resource A <code>PP_Resource</code> resource. |
| 110 * | 87 * |
| 111 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is | 88 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is |
| 112 * a <code>PPB_NetworkList_Private</code>, <code>PP_FALSE</code> | 89 * a <code>PPB_NetworkList_Private</code>, <code>PP_FALSE</code> |
| 113 * otherwise. | 90 * otherwise. |
| 114 */ | 91 */ |
| 115 PP_Bool (*IsNetworkList)(PP_Resource resource); | 92 PP_Bool (*IsNetworkList)(PP_Resource resource); |
| 116 /** | 93 /** |
| 117 * Updates the list with the current state of the network interfaces | |
| 118 * in the system. | |
| 119 */ | |
| 120 int32_t (*Update)(struct PP_CompletionCallback callback); | |
| 121 /** | |
| 122 * Starts change notifications. The specified <code>callback</code> | |
| 123 * will be called every time the network list changes. Every time | |
| 124 * the callback is called the plugin must call Update() method to | |
| 125 * actually receive updated list. | |
| 126 */ | |
| 127 int32_t (*StartNotifications)(PP_Resource resource, | |
| 128 PPB_NetworkListChanged_Callback callback, | |
| 129 void* user_data); | |
| 130 /** | |
| 131 * Stops change notifications. After this method is called the | |
| 132 * callback specified in <code>StartNotifications()</code> will not | |
| 133 * be called anymore. | |
| 134 */ | |
| 135 int32_t (*StopNotifications)(PP_Resource resource); | |
| 136 /** | |
| 137 * @return Returns number of available network interfaces or 0 if | 94 * @return Returns number of available network interfaces or 0 if |
| 138 * the list has never been updated. | 95 * the list has never been updated. |
| 139 */ | 96 */ |
| 140 uint32_t (*GetCount)(PP_Resource resource); | 97 uint32_t (*GetCount)(PP_Resource resource); |
| 141 /** | 98 /** |
| 142 * @return Returns name for the network interface with the specified | 99 * @return Returns name for the network interface with the specified |
| 143 * <code>index</code>. | 100 * <code>index</code>. |
| 144 */ | 101 */ |
| 145 struct PP_Var (*GetName)(PP_Resource resource, uint32_t index); | 102 struct PP_Var (*GetName)(PP_Resource resource, uint32_t index); |
| 146 /** | 103 /** |
| 147 * @return Returns type of the network interface with the specified | 104 * @return Returns type of the network interface with the specified |
| 148 * <code>index</code>. | 105 * <code>index</code>. |
| 149 */ | 106 */ |
| 150 PP_NetworkListType (*GetType)(PP_Resource resource, uint32_t index); | 107 PP_NetworkListType_Private (*GetType)(PP_Resource resource, uint32_t index); |
| 151 /** | 108 /** |
| 152 * @return Returns current state of the network interface with the | 109 * @return Returns current state of the network interface with the |
| 153 * specified <code>index</code>. | 110 * specified <code>index</code>. |
| 154 */ | 111 */ |
| 155 PP_NetworkListState (*GetState)(PP_Resource resource, uint32_t index); | 112 PP_NetworkListState_Private (*GetState)(PP_Resource resource, uint32_t index); |
| 156 /** | 113 /** |
| 157 * @return Returns <code>NetAddress</code> object that contains | 114 * Gets list of IP addresses for the network interface with the |
| 158 * address of the specified <code>family</code> for the network | 115 * specified <code>index</code> and stores them in |
| 159 * interface with the specified <code>index</code>, or 0 if the | 116 * <code>addresses</code>. If the caller didn't allocate sufficient |
| 160 * address is not assigned. | 117 * space to store all addresses, then only the first |
| 118 * <code>count</code> addresses are filled in. |
| 119 * |
| 120 * @return Returns total number of IP addresses assigned to the |
| 121 * network interface or a negative error code. |
| 161 */ | 122 */ |
| 162 PP_Resource (*GetIpAddress)(PP_Resource resource, | 123 int32_t (*GetIpAddresses)(PP_Resource resource, |
| 163 uint32_t index, | 124 uint32_t index, |
| 164 PP_NetAddressFamily_Private family); | 125 struct PP_NetAddress_Private* addresses[], |
| 126 int32_t count); |
| 165 /** | 127 /** |
| 166 * @return Returns display name for the network interface with the | 128 * @return Returns display name for the network interface with the |
| 167 * specified <code>index</code>. | 129 * specified <code>index</code>. |
| 168 */ | 130 */ |
| 169 struct PP_Var (*GetDisplayName)(PP_Resource resource, uint32_t index); | 131 struct PP_Var (*GetDisplayName)(PP_Resource resource, uint32_t index); |
| 170 /** | 132 /** |
| 171 * @return Returns MTU for the network interface with the specified | 133 * @return Returns MTU for the network interface with the specified |
| 172 * <code>index</code>. | 134 * <code>index</code>. |
| 173 */ | 135 */ |
| 174 uint32_t (*GetMTU)(PP_Resource resource, uint32_t index); | 136 uint32_t (*GetMTU)(PP_Resource resource, uint32_t index); |
| 175 }; | 137 }; |
| 176 | 138 |
| 177 typedef struct PPB_NetworkList_Private_0_1 PPB_NetworkList_Private; | 139 typedef struct PPB_NetworkList_Private_0_2 PPB_NetworkList_Private; |
| 178 /** | 140 /** |
| 179 * @} | 141 * @} |
| 180 */ | 142 */ |
| 181 | 143 |
| 182 #endif /* PPAPI_C_PRIVATE_PPB_NETWORK_LIST_PRIVATE_H_ */ | 144 #endif /* PPAPI_C_PRIVATE_PPB_NETWORK_LIST_PRIVATE_H_ */ |
| 183 | 145 |
| OLD | NEW |