15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chromeos/chromeos_export.h"
12424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#include "chromeos/dbus/dbus_client.h"
13c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "chromeos/dbus/dbus_method_call_status.h"
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chromeos/dbus/shill_client_helper.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace dbus {
17c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)class ObjectPath;
181320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccinamespace net {
211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass IPEndPoint;
221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace chromeos {
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ShillPropertyChangedObserver;
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// ShillManagerClient is used to communicate with the Shill Manager
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// service.  All methods should be called from the origin thread which
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// initializes the DBusThreadManager instance.
31424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)class CHROMEOS_EXPORT ShillManagerClient : public DBusClient {
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler;
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback;
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  typedef ShillClientHelper::ErrorCallback ErrorCallback;
362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  typedef ShillClientHelper::StringCallback StringCallback;
372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  typedef ShillClientHelper::BooleanCallback BooleanCallback;
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Interface for setting up devices, services, and technologies for testing.
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Accessed through GetTestInterface(), only implemented in the Stub Impl.
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  class TestInterface {
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   public:
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual void AddDevice(const std::string& device_path) = 0;
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual void RemoveDevice(const std::string& device_path) = 0;
452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    virtual void ClearDevices() = 0;
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual void AddTechnology(const std::string& type, bool enabled) = 0;
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual void RemoveTechnology(const std::string& type) = 0;
48c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)    virtual void SetTechnologyInitializing(const std::string& type,
49c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)                                           bool initializing) = 0;
502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    virtual void AddGeoNetwork(const std::string& technology,
512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                               const base::DictionaryValue& network) = 0;
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
53b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // Does not create an actual profile in the ProfileClient but update the
54b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // profiles list and sends a notification to observers. This should only be
55b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // called by the ProfileStub. In all other cases, use
56b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // ShillProfileClient::TestInterface::AddProfile.
57b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    virtual void AddProfile(const std::string& profile_path) = 0;
58b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // Used to reset all properties; does not notify observers.
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual void ClearProperties() = 0;
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
62a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    // Set manager property.
63a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    virtual void SetManagerProperty(const std::string& key,
64a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                    const base::Value& value) = 0;
65a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
66cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // Modify services in the Manager's list.
676d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)    virtual void AddManagerService(const std::string& service_path,
686d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)                                   bool notify_observers) = 0;
69f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    virtual void RemoveManagerService(const std::string& service_path) = 0;
70a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)    virtual void ClearManagerServices() = 0;
713240926e260ce088908e02ac07a6cf7b0c0cbf44Ben Murdoch
72a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    // Called by ShillServiceClient when a service's State property changes,
73a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    // before notifying observers. Sets the DefaultService property to empty
74a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    // if the state changes to a non-connected state.
75a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    virtual void ServiceStateChanged(const std::string& service_path,
76a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                     const std::string& state) = 0;
77a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
78f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    // Called by ShillServiceClient when a service's State or Visibile
79f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    // property changes. If |notify| is true, notifies observers if a list
80f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    // changed. Services are sorted first by active, inactive, or disabled
81f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    // state, then by type.
82f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    virtual void SortManagerServices(bool notify) = 0;
83a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)
84a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    // Sets up the default fake environment based on default initial states
85a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    // or states provided by the command line.
86a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    virtual void SetupDefaultEnvironment() = 0;
87a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
88a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    // Returns the interactive delay specified on the command line, 0 for none.
89a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    virtual int GetInteractiveDelay() const = 0;
90a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
91cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    // Sets the 'best' service to connect to on a ConnectToBestServices call.
92cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    virtual void SetBestServiceToConnect(const std::string& service_path) = 0;
93cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   protected:
95c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)    virtual ~TestInterface() {}
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
98b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  // Properties used to verify the origin device.
99b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  struct VerificationProperties {
100b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    VerificationProperties();
101b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    ~VerificationProperties();
102b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
103b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // A string containing a PEM-encoded X.509 certificate for use in verifying
104b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // the signed data.
105b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    std::string certificate;
106b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
107b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // A string containing a PEM-encoded RSA public key to be used to compare
108b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // with the one in signedData
109b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    std::string public_key;
110b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
111b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // A string containing a base64-encoded random binary data for use in
112b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // verifying the signed data.
113b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    std::string nonce;
114b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
115b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // A string containing the identifying data string signed by the device.
116b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    std::string signed_data;
117b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
118b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // A string containing the serial number of the device.
119b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    std::string device_serial;
120b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
121b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // A string containing the SSID of the device. Only set if the device has
122b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // already been setup once.
123b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    std::string device_ssid;
124b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
125b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // A string containing the BSSID of the device. Only set if the device has
126b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    // already been setup.
127b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)    std::string device_bssid;
128b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  };
129b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~ShillManagerClient();
1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Factory function, creates a new instance which is owned by the caller.
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // For normal usage, access the singleton via DBusThreadManager::Get().
134a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  static ShillManagerClient* Create();
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Adds a property changed |observer|.
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void AddPropertyChangedObserver(
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      ShillPropertyChangedObserver* observer) = 0;
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Removes a property changed |observer|.
1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void RemovePropertyChangedObserver(
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      ShillPropertyChangedObserver* observer) = 0;
1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Calls GetProperties method.
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |callback| is called after the method call succeeds.
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void GetProperties(const DictionaryValueCallback& callback) = 0;
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Calls GetNetworksForGeolocation method.
1492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |callback| is called after the method call succeeds.
1502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void GetNetworksForGeolocation(
1512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const DictionaryValueCallback& callback) = 0;
1522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Calls SetProperty method.
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |callback| is called after the method call succeeds.
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetProperty(const std::string& name,
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                           const base::Value& value,
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                           const base::Closure& callback,
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                           const ErrorCallback& error_callback) = 0;
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Calls RequestScan method.
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |callback| is called after the method call succeeds.
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void RequestScan(const std::string& type,
1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                           const base::Closure& callback,
1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                           const ErrorCallback& error_callback) = 0;
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Calls EnableTechnology method.
1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |callback| is called after the method call succeeds.
1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void EnableTechnology(const std::string& type,
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                const base::Closure& callback,
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                const ErrorCallback& error_callback) = 0;
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Calls DisableTechnology method.
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |callback| is called after the method call succeeds.
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void DisableTechnology(const std::string& type,
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                 const base::Closure& callback,
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                 const ErrorCallback& error_callback) = 0;
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Calls ConfigureService method.
1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |callback| is called after the method call succeeds.
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ConfigureService(const base::DictionaryValue& properties,
1812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                const ObjectPathCallback& callback,
1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                const ErrorCallback& error_callback) = 0;
1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
184c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Calls ConfigureServiceForProfile method.
185c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // |callback| is called with the created service if the method call succeeds.
186c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void ConfigureServiceForProfile(
187c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      const dbus::ObjectPath& profile_path,
188c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      const base::DictionaryValue& properties,
189c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      const ObjectPathCallback& callback,
190c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      const ErrorCallback& error_callback) = 0;
191c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Calls GetService method.
1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |callback| is called after the method call succeeds.
1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void GetService(const base::DictionaryValue& properties,
1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                          const ObjectPathCallback& callback,
1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                          const ErrorCallback& error_callback) = 0;
1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1981320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // Verifies that the given data corresponds to a trusted device, and returns
1991320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // true to the callback if it is.
200b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual void VerifyDestination(const VerificationProperties& properties,
2012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                 const BooleanCallback& callback,
2022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                 const ErrorCallback& error_callback) = 0;
2032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2041320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // Verifies that the given data corresponds to a trusted device, and if it is,
2051320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // returns the encrypted credentials for connecting to the network represented
2062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // by the given |service_path|, encrypted using the |public_key| for the
2071320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // trusted device. If the device is not trusted, returns the empty string.
2082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void VerifyAndEncryptCredentials(
209b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)      const VerificationProperties& properties,
2102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const std::string& service_path,
2112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const StringCallback& callback,
2122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const ErrorCallback& error_callback) = 0;
2132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2141320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // Verifies that the given data corresponds to a trusted device, and returns
2151320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // the |data| encrypted using the |public_key| for the trusted device. If the
2161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // device is not trusted, returns the empty string.
217b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual void VerifyAndEncryptData(const VerificationProperties& properties,
218b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                                    const std::string& data,
219b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                                    const StringCallback& callback,
220b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)                                    const ErrorCallback& error_callback) = 0;
221c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
2221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // For each technology present, connects to the "best" service available.
223c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Called once the user is logged in and certificates are loaded.
224c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void ConnectToBestServices(const base::Closure& callback,
225c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)                                     const ErrorCallback& error_callback) = 0;
2262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2271320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // Requests that shill program the NIC so that packets incoming on
2281320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // |ip_connection| wake up the CPU.
2291320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual void AddWakeOnPacketConnection(
2301320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const net::IPEndPoint& ip_endpoint,
2311320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const base::Closure& callback,
2321320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const ErrorCallback& error_callback) = 0;
2331320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
2341320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // Removes a request to wake up on packets coming on |ip_connection|.
2351320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual void RemoveWakeOnPacketConnection(
2361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const net::IPEndPoint& ip_endpoint,
2371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const base::Closure& callback,
2381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const ErrorCallback& error_callback) = 0;
2391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
2401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // Clears all requests to wake up on packets.
2411320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual void RemoveAllWakeOnPacketConnections(
2421320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const base::Closure& callback,
2431320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const ErrorCallback& error_callback) = 0;
2441320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns an interface for testing (stub only), or returns NULL.
2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual TestInterface* GetTestInterface() = 0;
2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected:
249424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  friend class ShillManagerClientTest;
250424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Create() should be used instead.
2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ShillManagerClient();
2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(ShillManagerClient);
2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace chromeos
2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_H_
261