Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_CROS_NETWORK_FUNCTIONS_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_CROS_CROS_NETWORK_FUNCTIONS_H_ | |
| 7 | |
| 8 #include "third_party/cros/chromeos_network.h" | |
| 9 | |
| 10 namespace chromeos { | |
| 11 | |
| 12 // This header is introduced to make it easy to switch from chromeos_network.cc | |
| 13 // to Chrome's own DBus code. crosbug.com/16557 | |
| 14 // All calls to functions in chromeos_network.h should be made through | |
| 15 // functions provided by this header. | |
| 16 | |
| 17 // Activates the cellular modem specified by |service_path| with carrier | |
| 18 // specified by |carrier|. | |
| 19 // |carrier| is NULL or an empty string, this will activate with the currently | |
| 20 // active carrier. | |
| 21 // | |
|
stevenjb
2012/03/14 21:42:45
nit: no blank lines in function comments here and
hashimoto
2012/03/14 22:48:19
Done.
| |
| 22 // Returns false on failure and true on success. | |
| 23 bool CrosActivateCellularModem(const char* service_path, const char* carrier); | |
| 24 | |
| 25 | |
| 26 // Set a property of a service to the provided value | |
| 27 // | |
| 28 // Success is indicated by the receipt of a matching PropertyChanged signal. | |
| 29 void CrosSetNetworkServicePropertyGValue(const char* service_path, | |
| 30 const char* property, | |
| 31 const GValue* gvalue); | |
| 32 | |
| 33 // Clear a property of a service | |
| 34 void CrosClearNetworkServiceProperty(const char* service_path, | |
| 35 const char* property); | |
| 36 | |
| 37 // Set a property of a device to the provided value | |
| 38 // | |
| 39 // Success is indicated by the receipt of a matching PropertyChanged signal. | |
| 40 void CrosSetNetworkDevicePropertyGValue(const char* device_path, | |
| 41 const char* property, | |
| 42 const GValue* gvalue); | |
| 43 | |
| 44 // Set a property of an ip config to the provided value | |
| 45 // | |
| 46 // Success is indicated by the receipt of a matching PropertyChanged signal. | |
| 47 void CrosSetNetworkIPConfigPropertyGValue(const char* ipconfig_path, | |
| 48 const char* property, | |
| 49 const GValue* gvalue); | |
| 50 | |
| 51 // Delete a remembered service from a profile. | |
| 52 void CrosDeleteServiceFromProfile(const char* profile_path, | |
| 53 const char* service_path); | |
| 54 | |
| 55 // Request an update of the data plans. A callback will be received by any | |
| 56 // object that invoked MonitorCellularDataPlan when up to date data is ready. | |
| 57 void CrosRequestCellularDataPlanUpdate(const char* modem_service_path); | |
| 58 | |
| 59 // Sets up monitoring of the PropertyChanged signal on the flimflam manager. | |
| 60 // The provided |callback| will be called whenever a manager property changes. | |
| 61 // |object| will be supplied as the first argument to the callback. | |
| 62 NetworkPropertiesMonitor CrosMonitorNetworkManagerProperties( | |
| 63 MonitorPropertyGValueCallback callback, | |
| 64 void* object); | |
| 65 | |
| 66 // Similar to MonitorNetworkManagerProperties for a specified network service. | |
| 67 NetworkPropertiesMonitor CrosMonitorNetworkServiceProperties( | |
| 68 MonitorPropertyGValueCallback callback, | |
| 69 const char* service_path, | |
| 70 void* object); | |
| 71 | |
| 72 // Similar to MonitorNetworkManagerProperties for a specified network device. | |
| 73 NetworkPropertiesMonitor CrosMonitorNetworkDeviceProperties( | |
| 74 MonitorPropertyGValueCallback callback, | |
| 75 const char* device_path, | |
| 76 void* object); | |
| 77 | |
| 78 // Disconnects a PropertyChangeMonitor. | |
| 79 void CrosDisconnectNetworkPropertiesMonitor( | |
| 80 NetworkPropertiesMonitor monitor); | |
| 81 | |
| 82 // Sets up monitoring of the cellular data plan updates from Cashew. | |
| 83 DataPlanUpdateMonitor CrosMonitorCellularDataPlan( | |
| 84 MonitorDataPlanCallback callback, | |
| 85 void* object); | |
| 86 | |
| 87 // Disconnects a DataPlanUpdateMonitor. | |
| 88 void CrosDisconnectDataPlanUpdateMonitor(DataPlanUpdateMonitor monitor); | |
| 89 | |
| 90 SMSMonitor CrosMonitorSMS(const char* modem_device_path, | |
| 91 MonitorSMSCallback callback, | |
| 92 void* object); | |
| 93 | |
| 94 void CrosDisconnectSMSMonitor(SMSMonitor monitor); | |
|
stevenjb
2012/03/14 21:42:45
These functions should have comments.
hashimoto
2012/03/14 22:48:19
Done.
| |
| 95 | |
| 96 // Connect to the service with the |service_path|. | |
| 97 // | |
| 98 // Service parameters such as authentication must already be configured. | |
| 99 // | |
| 100 // Note, a successful invocation of the callback only indicates that | |
| 101 // the connection process has started. You will have to query the | |
| 102 // connection state to determine if the connection was established | |
| 103 // successfully. | |
| 104 void CrosRequestNetworkServiceConnect(const char* service_path, | |
| 105 NetworkActionCallback callback, | |
| 106 void* object); | |
| 107 | |
| 108 void CrosRequestNetworkManagerProperties( | |
| 109 NetworkPropertiesGValueCallback callback, | |
| 110 void* object); | |
| 111 | |
| 112 void CrosRequestNetworkServiceProperties( | |
| 113 const char* service_path, | |
| 114 NetworkPropertiesGValueCallback callback, | |
| 115 void* object); | |
| 116 | |
| 117 // Retrieve the latest info for a particular device. | |
| 118 void CrosRequestNetworkDeviceProperties( | |
| 119 const char* device_path, | |
| 120 NetworkPropertiesGValueCallback callback, | |
| 121 void* object); | |
| 122 | |
| 123 // Retrieve the list of remembered services for a profile. | |
| 124 void CrosRequestNetworkProfileProperties( | |
| 125 const char* profile_path, | |
| 126 NetworkPropertiesGValueCallback callback, | |
| 127 void* object); | |
| 128 | |
| 129 // Retrieve the latest info for a profile service entry. | |
| 130 void CrosRequestNetworkProfileEntryProperties( | |
| 131 const char* profile_path, | |
| 132 const char* profile_entry_path, | |
| 133 NetworkPropertiesGValueCallback callback, | |
| 134 void* object); | |
| 135 | |
| 136 // Request a wifi service not in the network list (i.e. hidden). | |
| 137 void CrosRequestHiddenWifiNetworkProperties( | |
| 138 const char* ssid, | |
| 139 const char* security, | |
| 140 NetworkPropertiesGValueCallback callback, | |
| 141 void* object); | |
| 142 | |
| 143 // Request a new VPN service. | |
| 144 void CrosRequestVirtualNetworkProperties( | |
| 145 const char* service_name, | |
| 146 const char* server_hostname, | |
| 147 const char* provider_type, | |
| 148 NetworkPropertiesGValueCallback callback, | |
| 149 void* object); | |
| 150 | |
| 151 // Asynchronous disconnect from network service. | |
| 152 void CrosRequestNetworkServiceDisconnect(const char* service_path); | |
| 153 | |
| 154 // Remove an exisiting network service (e.g. after forgetting a VPN). | |
| 155 void CrosRequestRemoveNetworkService(const char* service_path); | |
| 156 | |
| 157 // Requests a scan of services of |type|. | |
| 158 // |type| should be is a string recognized by flimflam's Manager API. | |
| 159 void CrosRequestNetworkScan(const char* network_type); | |
| 160 | |
| 161 // Request enabling or disabling a device. | |
| 162 void CrosRequestNetworkDeviceEnable(const char* network_type, bool enable); | |
| 163 | |
| 164 // Enable or disable PIN protection for a SIM card. | |
| 165 void CrosRequestRequirePin(const char* device_path, | |
| 166 const char* pin, | |
| 167 bool enable, | |
| 168 NetworkActionCallback callback, | |
| 169 void* object); | |
| 170 | |
| 171 // Enter a PIN to unlock a SIM card. | |
| 172 void CrosRequestEnterPin(const char* device_path, | |
| 173 const char* pin, | |
| 174 NetworkActionCallback callback, | |
| 175 void* object); | |
| 176 | |
| 177 // Enter a PUK to unlock a SIM card whose PIN has been entered | |
| 178 // incorrectly too many times. A new |pin| must be supplied | |
| 179 // along with the |unblock_code| (PUK). | |
| 180 void CrosRequestUnblockPin(const char* device_path, | |
| 181 const char* unblock_code, | |
| 182 const char* pin, | |
| 183 NetworkActionCallback callback, | |
| 184 void* object); | |
| 185 | |
| 186 // Change the PIN used to unlock a SIM card. | |
| 187 void CrosRequestChangePin(const char* device_path, | |
| 188 const char* old_pin, | |
| 189 const char* new_pin, | |
| 190 NetworkActionCallback callback, | |
| 191 void* object); | |
| 192 | |
| 193 // Proposes to trigger a scan transaction. For cellular networks scan result | |
| 194 // is set in the property Cellular.FoundNetworks. | |
| 195 void CrosProposeScan(const char* device_path); | |
| 196 | |
| 197 // Initiate registration on the network specified by network_id, which is in the | |
| 198 // form MCCMNC. If the network ID is the empty string, then switch back to | |
| 199 // automatic registration mode before initiating registration. | |
| 200 void CrosRequestCellularRegister(const char* device_path, | |
| 201 const char* network_id, | |
| 202 NetworkActionCallback callback, | |
| 203 void* object); | |
| 204 | |
| 205 ////////////////////////////////////////////////////////////////////////////// | |
| 206 // Enable or disable the specific network device for connection. | |
| 207 // | |
| 208 // Set offline mode. This will turn off all radios. | |
| 209 // | |
| 210 // Returns false on failure and true on success. | |
| 211 bool CrosSetOfflineMode(bool offline); | |
| 212 | |
| 213 // Gets a list of all the IPConfigs using a given device path | |
| 214 IPConfigStatus* CrosListIPConfigs(const char* device_path); | |
| 215 | |
| 216 // Add a IPConfig of the given type to the device | |
| 217 bool CrosAddIPConfig(const char* device_path, IPConfigType type); | |
| 218 | |
| 219 // Remove an existing IP Config | |
| 220 bool CrosRemoveIPConfig(IPConfig* config); | |
| 221 | |
| 222 // Free out a full status | |
| 223 void CrosFreeIPConfigStatus(IPConfigStatus* status); | |
| 224 | |
| 225 // Retrieves the list of visible network objects. This structure is not cached | |
| 226 // within the DLL, and is fetched via d-bus on each call. | |
| 227 // Ownership of the DeviceNetworkList is returned to the caller; use | |
| 228 // FreeDeviceNetworkList to release it. | |
| 229 DeviceNetworkList* CrosGetDeviceNetworkList(); | |
| 230 | |
| 231 // Deletes a DeviceNetworkList type that was allocated in the ChromeOS dll. We | |
| 232 // need to do this to safely pass data over the dll boundary between our .so | |
| 233 // and Chrome. | |
| 234 void CrosFreeDeviceNetworkList(DeviceNetworkList* network_list); | |
| 235 | |
| 236 // Configures the network service specified by |properties|. | |
| 237 // |identifier| can be the service path, guid, or any other identifier | |
| 238 // specified by the calling code; it is ignored by libcros and flimflam, | |
| 239 // except to pass it back in |callback| as |path|. | |
| 240 void CrosConfigureService(const char* identifier, | |
| 241 const GHashTable* properties, | |
| 242 NetworkActionCallback callback, | |
| 243 void* object); | |
| 244 | |
| 245 } // namespace chromeos | |
| 246 | |
| 247 #endif // CHROME_BROWSER_CHROMEOS_CROS_CROS_NETWORK_FUNCTIONS_H_ | |
| OLD | NEW |