Chromium Code Reviews| Index: chrome/browser/chromeos/cros/cros_network_functions.h |
| diff --git a/chrome/browser/chromeos/cros/cros_network_functions.h b/chrome/browser/chromeos/cros/cros_network_functions.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c8aae83d3410c9216bf3a59adba71052336fef9e |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/cros/cros_network_functions.h |
| @@ -0,0 +1,247 @@ |
| +// 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. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_CROS_CROS_NETWORK_FUNCTIONS_H_ |
| +#define CHROME_BROWSER_CHROMEOS_CROS_CROS_NETWORK_FUNCTIONS_H_ |
| + |
| +#include "third_party/cros/chromeos_network.h" |
| + |
| +namespace chromeos { |
| + |
| +// This header is introduced to make it easy to switch from chromeos_network.cc |
| +// to Chrome's own DBus code. crosbug.com/16557 |
| +// All calls to functions in chromeos_network.h should be made through |
| +// functions provided by this header. |
| + |
| +// Activates the cellular modem specified by |service_path| with carrier |
| +// specified by |carrier|. |
| +// |carrier| is NULL or an empty string, this will activate with the currently |
| +// active carrier. |
| +// |
|
stevenjb
2012/03/14 21:42:45
nit: no blank lines in function comments here and
hashimoto
2012/03/14 22:48:19
Done.
|
| +// Returns false on failure and true on success. |
| +bool CrosActivateCellularModem(const char* service_path, const char* carrier); |
| + |
| + |
| +// Set a property of a service to the provided value |
| +// |
| +// Success is indicated by the receipt of a matching PropertyChanged signal. |
| +void CrosSetNetworkServicePropertyGValue(const char* service_path, |
| + const char* property, |
| + const GValue* gvalue); |
| + |
| +// Clear a property of a service |
| +void CrosClearNetworkServiceProperty(const char* service_path, |
| + const char* property); |
| + |
| +// Set a property of a device to the provided value |
| +// |
| +// Success is indicated by the receipt of a matching PropertyChanged signal. |
| +void CrosSetNetworkDevicePropertyGValue(const char* device_path, |
| + const char* property, |
| + const GValue* gvalue); |
| + |
| +// Set a property of an ip config to the provided value |
| +// |
| +// Success is indicated by the receipt of a matching PropertyChanged signal. |
| +void CrosSetNetworkIPConfigPropertyGValue(const char* ipconfig_path, |
| + const char* property, |
| + const GValue* gvalue); |
| + |
| +// Delete a remembered service from a profile. |
| +void CrosDeleteServiceFromProfile(const char* profile_path, |
| + const char* service_path); |
| + |
| +// Request an update of the data plans. A callback will be received by any |
| +// object that invoked MonitorCellularDataPlan when up to date data is ready. |
| +void CrosRequestCellularDataPlanUpdate(const char* modem_service_path); |
| + |
| +// Sets up monitoring of the PropertyChanged signal on the flimflam manager. |
| +// The provided |callback| will be called whenever a manager property changes. |
| +// |object| will be supplied as the first argument to the callback. |
| +NetworkPropertiesMonitor CrosMonitorNetworkManagerProperties( |
| + MonitorPropertyGValueCallback callback, |
| + void* object); |
| + |
| +// Similar to MonitorNetworkManagerProperties for a specified network service. |
| +NetworkPropertiesMonitor CrosMonitorNetworkServiceProperties( |
| + MonitorPropertyGValueCallback callback, |
| + const char* service_path, |
| + void* object); |
| + |
| +// Similar to MonitorNetworkManagerProperties for a specified network device. |
| +NetworkPropertiesMonitor CrosMonitorNetworkDeviceProperties( |
| + MonitorPropertyGValueCallback callback, |
| + const char* device_path, |
| + void* object); |
| + |
| +// Disconnects a PropertyChangeMonitor. |
| +void CrosDisconnectNetworkPropertiesMonitor( |
| + NetworkPropertiesMonitor monitor); |
| + |
| +// Sets up monitoring of the cellular data plan updates from Cashew. |
| +DataPlanUpdateMonitor CrosMonitorCellularDataPlan( |
| + MonitorDataPlanCallback callback, |
| + void* object); |
| + |
| +// Disconnects a DataPlanUpdateMonitor. |
| +void CrosDisconnectDataPlanUpdateMonitor(DataPlanUpdateMonitor monitor); |
| + |
| +SMSMonitor CrosMonitorSMS(const char* modem_device_path, |
| + MonitorSMSCallback callback, |
| + void* object); |
| + |
| +void CrosDisconnectSMSMonitor(SMSMonitor monitor); |
|
stevenjb
2012/03/14 21:42:45
These functions should have comments.
hashimoto
2012/03/14 22:48:19
Done.
|
| + |
| +// Connect to the service with the |service_path|. |
| +// |
| +// Service parameters such as authentication must already be configured. |
| +// |
| +// Note, a successful invocation of the callback only indicates that |
| +// the connection process has started. You will have to query the |
| +// connection state to determine if the connection was established |
| +// successfully. |
| +void CrosRequestNetworkServiceConnect(const char* service_path, |
| + NetworkActionCallback callback, |
| + void* object); |
| + |
| +void CrosRequestNetworkManagerProperties( |
| + NetworkPropertiesGValueCallback callback, |
| + void* object); |
| + |
| +void CrosRequestNetworkServiceProperties( |
| + const char* service_path, |
| + NetworkPropertiesGValueCallback callback, |
| + void* object); |
| + |
| +// Retrieve the latest info for a particular device. |
| +void CrosRequestNetworkDeviceProperties( |
| + const char* device_path, |
| + NetworkPropertiesGValueCallback callback, |
| + void* object); |
| + |
| +// Retrieve the list of remembered services for a profile. |
| +void CrosRequestNetworkProfileProperties( |
| + const char* profile_path, |
| + NetworkPropertiesGValueCallback callback, |
| + void* object); |
| + |
| +// Retrieve the latest info for a profile service entry. |
| +void CrosRequestNetworkProfileEntryProperties( |
| + const char* profile_path, |
| + const char* profile_entry_path, |
| + NetworkPropertiesGValueCallback callback, |
| + void* object); |
| + |
| +// Request a wifi service not in the network list (i.e. hidden). |
| +void CrosRequestHiddenWifiNetworkProperties( |
| + const char* ssid, |
| + const char* security, |
| + NetworkPropertiesGValueCallback callback, |
| + void* object); |
| + |
| +// Request a new VPN service. |
| +void CrosRequestVirtualNetworkProperties( |
| + const char* service_name, |
| + const char* server_hostname, |
| + const char* provider_type, |
| + NetworkPropertiesGValueCallback callback, |
| + void* object); |
| + |
| +// Asynchronous disconnect from network service. |
| +void CrosRequestNetworkServiceDisconnect(const char* service_path); |
| + |
| +// Remove an exisiting network service (e.g. after forgetting a VPN). |
| +void CrosRequestRemoveNetworkService(const char* service_path); |
| + |
| +// Requests a scan of services of |type|. |
| +// |type| should be is a string recognized by flimflam's Manager API. |
| +void CrosRequestNetworkScan(const char* network_type); |
| + |
| +// Request enabling or disabling a device. |
| +void CrosRequestNetworkDeviceEnable(const char* network_type, bool enable); |
| + |
| +// Enable or disable PIN protection for a SIM card. |
| +void CrosRequestRequirePin(const char* device_path, |
| + const char* pin, |
| + bool enable, |
| + NetworkActionCallback callback, |
| + void* object); |
| + |
| +// Enter a PIN to unlock a SIM card. |
| +void CrosRequestEnterPin(const char* device_path, |
| + const char* pin, |
| + NetworkActionCallback callback, |
| + void* object); |
| + |
| +// Enter a PUK to unlock a SIM card whose PIN has been entered |
| +// incorrectly too many times. A new |pin| must be supplied |
| +// along with the |unblock_code| (PUK). |
| +void CrosRequestUnblockPin(const char* device_path, |
| + const char* unblock_code, |
| + const char* pin, |
| + NetworkActionCallback callback, |
| + void* object); |
| + |
| +// Change the PIN used to unlock a SIM card. |
| +void CrosRequestChangePin(const char* device_path, |
| + const char* old_pin, |
| + const char* new_pin, |
| + NetworkActionCallback callback, |
| + void* object); |
| + |
| +// Proposes to trigger a scan transaction. For cellular networks scan result |
| +// is set in the property Cellular.FoundNetworks. |
| +void CrosProposeScan(const char* device_path); |
| + |
| +// Initiate registration on the network specified by network_id, which is in the |
| +// form MCCMNC. If the network ID is the empty string, then switch back to |
| +// automatic registration mode before initiating registration. |
| +void CrosRequestCellularRegister(const char* device_path, |
| + const char* network_id, |
| + NetworkActionCallback callback, |
| + void* object); |
| + |
| +////////////////////////////////////////////////////////////////////////////// |
| +// Enable or disable the specific network device for connection. |
| +// |
| +// Set offline mode. This will turn off all radios. |
| +// |
| +// Returns false on failure and true on success. |
| +bool CrosSetOfflineMode(bool offline); |
| + |
| +// Gets a list of all the IPConfigs using a given device path |
| +IPConfigStatus* CrosListIPConfigs(const char* device_path); |
| + |
| +// Add a IPConfig of the given type to the device |
| +bool CrosAddIPConfig(const char* device_path, IPConfigType type); |
| + |
| +// Remove an existing IP Config |
| +bool CrosRemoveIPConfig(IPConfig* config); |
| + |
| +// Free out a full status |
| +void CrosFreeIPConfigStatus(IPConfigStatus* status); |
| + |
| +// Retrieves the list of visible network objects. This structure is not cached |
| +// within the DLL, and is fetched via d-bus on each call. |
| +// Ownership of the DeviceNetworkList is returned to the caller; use |
| +// FreeDeviceNetworkList to release it. |
| +DeviceNetworkList* CrosGetDeviceNetworkList(); |
| + |
| +// Deletes a DeviceNetworkList type that was allocated in the ChromeOS dll. We |
| +// need to do this to safely pass data over the dll boundary between our .so |
| +// and Chrome. |
| +void CrosFreeDeviceNetworkList(DeviceNetworkList* network_list); |
| + |
| +// Configures the network service specified by |properties|. |
| +// |identifier| can be the service path, guid, or any other identifier |
| +// specified by the calling code; it is ignored by libcros and flimflam, |
| +// except to pass it back in |callback| as |path|. |
| +void CrosConfigureService(const char* identifier, |
| + const GHashTable* properties, |
| + NetworkActionCallback callback, |
| + void* object); |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_CROS_CROS_NETWORK_FUNCTIONS_H_ |