blob: 551c4f341c796f123e7c592b568d67f63911d45d [file] [log] [blame]
Jay Srinivasan43488792012-06-19 00:25:31 -07001// Copyright (c) 2012 The Chromium OS 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
Gilad Arnoldcf175a02014-07-10 16:48:47 -07005#ifndef UPDATE_ENGINE_CONNECTION_MANAGER_H_
6#define UPDATE_ENGINE_CONNECTION_MANAGER_H_
Jay Srinivasan43488792012-06-19 00:25:31 -07007
Ben Chan05735a12014-09-03 07:48:22 -07008#include <base/macros.h>
Jay Srinivasan43488792012-06-19 00:25:31 -07009
Alex Deymof6ee0162015-07-31 12:35:22 -070010#include "update_engine/connection_manager_interface.h"
Gilad Arnold1b9d6ae2014-03-03 13:46:07 -080011#include "update_engine/dbus_wrapper_interface.h"
Jay Srinivasan43488792012-06-19 00:25:31 -070012
13namespace chromeos_update_engine {
14
Jay Srinivasan43488792012-06-19 00:25:31 -070015class SystemState;
16
Alex Deymof6ee0162015-07-31 12:35:22 -070017// This class implements the concrete class that talks with the connection
18// manager (shill) over DBus.
19class ConnectionManager : public ConnectionManagerInterface {
Jay Srinivasan43488792012-06-19 00:25:31 -070020 public:
Jay Srinivasan43488792012-06-19 00:25:31 -070021 // Returns the string representation corresponding to the given
22 // connection type.
Alex Deymof6ee0162015-07-31 12:35:22 -070023 static const char* StringForConnectionType(NetworkConnectionType type);
Jay Srinivasan43488792012-06-19 00:25:31 -070024
Alex Deymo6ae91202014-03-10 19:21:25 -070025 // Returns the string representation corresponding to the given tethering
26 // state.
Alex Deymof6ee0162015-07-31 12:35:22 -070027 static const char* StringForTethering(NetworkTethering tethering);
28
29 // Constructs a new ConnectionManager object initialized with the
30 // given system state.
31 explicit ConnectionManager(SystemState* system_state);
32 ~ConnectionManager() override = default;
33
34 // ConnectionManagerInterface overrides
35 bool GetConnectionProperties(DBusWrapperInterface* dbus_iface,
36 NetworkConnectionType* out_type,
37 NetworkTethering* out_tethering) const override;
38 bool IsUpdateAllowedOver(NetworkConnectionType type,
39 NetworkTethering tethering) const override;
Alex Deymo6ae91202014-03-10 19:21:25 -070040
Jay Srinivasan43488792012-06-19 00:25:31 -070041 private:
42 // The global context for update_engine
43 SystemState* system_state_;
44
45 DISALLOW_COPY_AND_ASSIGN(ConnectionManager);
46};
47
48} // namespace chromeos_update_engine
49
Gilad Arnoldcf175a02014-07-10 16:48:47 -070050#endif // UPDATE_ENGINE_CONNECTION_MANAGER_H_