blob: 642f60fc6bfd0d573d048151699b4bb0b8367d7d [file] [log] [blame]
Alex Deymof6ee0162015-07-31 12:35:22 -07001// Copyright 2015 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
5#ifndef UPDATE_ENGINE_CONNECTION_MANAGER_INTERFACE_H_
6#define UPDATE_ENGINE_CONNECTION_MANAGER_INTERFACE_H_
7
8#include <base/macros.h>
9
Alex Deymof6ee0162015-07-31 12:35:22 -070010namespace chromeos_update_engine {
11
12enum class NetworkConnectionType {
13 kEthernet,
14 kWifi,
15 kWimax,
16 kBluetooth,
17 kCellular,
18 kUnknown
19};
20
21enum class NetworkTethering {
22 kNotDetected,
23 kSuspected,
24 kConfirmed,
25 kUnknown
26};
27
28// This class exposes a generic interface to the connection manager
29// (e.g FlimFlam, Shill, etc.) to consolidate all connection-related
30// logic in update_engine.
31class ConnectionManagerInterface {
32 public:
33 virtual ~ConnectionManagerInterface() = default;
34
35 // Populates |out_type| with the type of the network connection
36 // that we are currently connected and |out_tethering| with the estimate of
37 // whether that network is being tethered.
Alex Deymo30534502015-07-20 15:06:33 -070038 virtual bool GetConnectionProperties(NetworkConnectionType* out_type,
39 NetworkTethering* out_tethering) = 0;
Alex Deymof6ee0162015-07-31 12:35:22 -070040
41 // Returns true if we're allowed to update the system when we're
42 // connected to the internet through the given network connection type and the
43 // given tethering state.
44 virtual bool IsUpdateAllowedOver(NetworkConnectionType type,
45 NetworkTethering tethering) const = 0;
46
47 protected:
48 ConnectionManagerInterface() = default;
49
50 private:
51 DISALLOW_COPY_AND_ASSIGN(ConnectionManagerInterface);
52};
53
54} // namespace chromeos_update_engine
55
56#endif // UPDATE_ENGINE_CONNECTION_MANAGER_INTERFACE_H_