blob: 81eb78163ed2ddd343e6486e2caf98442d76380d [file] [log] [blame]
Paul Stewart75897df2011-04-27 09:05:53 -07001// Copyright (c) 2011 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 SHILL_DEVICE_
6#define SHILL_DEVICE_
7
Chris Masone9be4a9d2011-05-16 15:44:09 -07008#include <vector>
9
Chris Masone487b8bf2011-05-13 16:27:57 -070010#include <base/memory/ref_counted.h>
Paul Stewartd5843772011-05-11 15:40:42 -070011
Chris Masone9be4a9d2011-05-16 15:44:09 -070012#include "shill/service.h"
Paul Stewart75897df2011-04-27 09:05:53 -070013#include "shill/shill_event.h"
14
15namespace shill {
16
Chris Masone9be4a9d2011-05-16 15:44:09 -070017class ControlInterface;
18class DeviceAdaptorInterface;
19class EventDispatcher;
20
Paul Stewart75897df2011-04-27 09:05:53 -070021// Device superclass. Individual network interfaces types will inherit from
22// this class.
Paul Stewartd5843772011-05-11 15:40:42 -070023class Device : public base::RefCounted<Device> {
Paul Stewart75897df2011-04-27 09:05:53 -070024 public:
Chris Masone9be4a9d2011-05-16 15:44:09 -070025 enum Technology {
26 kEthernet,
27 kWifi,
28 kCellular,
29 kNumTechnologies
30 };
Chris Masone0e1d1042011-05-09 18:07:03 -070031
Chris Masone9be4a9d2011-05-16 15:44:09 -070032 // A constructor for the Device object
33 Device(ControlInterface *control_interface,
34 EventDispatcher *dispatcher);
35 virtual ~Device();
36
37 virtual void Start();
38 virtual void Stop();
39
40 virtual bool TechnologyIs(Technology type) = 0;
Paul Stewart75897df2011-04-27 09:05:53 -070041
Paul Stewartd5843772011-05-11 15:40:42 -070042 protected:
Chris Masone9be4a9d2011-05-16 15:44:09 -070043 std::vector<scoped_refptr<Service> > services_;
Paul Stewartd5843772011-05-11 15:40:42 -070044
Paul Stewart75897df2011-04-27 09:05:53 -070045 private:
Chris Masone413a3192011-05-09 17:10:05 -070046 DeviceAdaptorInterface *adaptor_;
Paul Stewart75897df2011-04-27 09:05:53 -070047 bool running_;
Chris Masone413a3192011-05-09 17:10:05 -070048 friend class DeviceAdaptorInterface;
Chris Masone9be4a9d2011-05-16 15:44:09 -070049 DISALLOW_COPY_AND_ASSIGN(Device);
Paul Stewart75897df2011-04-27 09:05:53 -070050};
51
52} // namespace shill
53
54#endif // SHILL_DEVICE_