blob: 013f2d9648404509569531a34a48da4972dedf58 [file] [log] [blame]
mukesh agrawal9da07772013-05-15 14:15:17 -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
5#ifndef SHILL_VIRTUAL_DEVICE_H_
6#define SHILL_VIRTUAL_DEVICE_H_
7
8#include <base/basictypes.h>
9
10#include "shill/device.h"
11#include "shill/ipconfig.h"
mukesh agrawal0381f9a2013-07-11 16:41:52 -070012#include "shill/service.h"
mukesh agrawal9da07772013-05-15 14:15:17 -070013#include "shill/technology.h"
14
15namespace shill {
16
17class StorageInterface;
18
19// A VirtualDevice represents a device that doesn't provide its own
20// physical layer. This includes, e.g., tunnel interfaces used for
21// OpenVPN, and PPP devices used for L2TPIPSec and 3G PPP dongles.
22// (PPP devices are represented via the PPPDevice subclass.)
23class VirtualDevice : public Device {
24 public:
25 VirtualDevice(ControlInterface *control,
26 EventDispatcher *dispatcher,
27 Metrics *metrics,
28 Manager *manager,
29 const std::string &link_name,
30 int interface_index,
31 Technology::Identifier technology);
32 virtual ~VirtualDevice() override;
33
34 virtual bool Load(StoreInterface *storage) override;
35 virtual bool Save(StoreInterface *storage) override;
36
37 virtual void Start(Error *error,
38 const EnabledStateChangedCallback &callback) override;
39 virtual void Stop(Error *error,
40 const EnabledStateChangedCallback &callback) override;
41
42 virtual void UpdateIPConfig(const IPConfig::Properties &properties);
43
44 // Expose protected device methods to manager of this device.
45 // (E.g. Cellular, L2TPIPSecDriver, OpenVPNDriver.)
46 virtual void DropConnection();
47 virtual void SelectService(const ServiceRefPtr &service);
mukesh agrawal0381f9a2013-07-11 16:41:52 -070048 virtual void SetServiceState(Service::ConnectState state);
49 virtual void SetServiceFailure(Service::ConnectFailure failure_state);
50 virtual void SetServiceFailureSilent(Service::ConnectFailure failure_state);
mukesh agrawal9da07772013-05-15 14:15:17 -070051
52 private:
53 DISALLOW_COPY_AND_ASSIGN(VirtualDevice);
54};
55
56} // namespace shill
57
58#endif // SHILL_VIRTUAL_DEVICE_H_