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