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