blob: b37842d3097c563c26a40b9f07d4a19374ac316e [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"
12#include "shill/technology.h"
13
14namespace shill {
15
16class StorageInterface;
17
18// A VirtualDevice represents a device that doesn't provide its own
19// physical layer. This includes, e.g., tunnel interfaces used for
20// OpenVPN, and PPP devices used for L2TPIPSec and 3G PPP dongles.
21// (PPP devices are represented via the PPPDevice subclass.)
22class VirtualDevice : public Device {
23 public:
24 VirtualDevice(ControlInterface *control,
25 EventDispatcher *dispatcher,
26 Metrics *metrics,
27 Manager *manager,
28 const std::string &link_name,
29 int interface_index,
30 Technology::Identifier technology);
31 virtual ~VirtualDevice() override;
32
33 virtual bool Load(StoreInterface *storage) override;
34 virtual bool Save(StoreInterface *storage) override;
35
36 virtual void Start(Error *error,
37 const EnabledStateChangedCallback &callback) override;
38 virtual void Stop(Error *error,
39 const EnabledStateChangedCallback &callback) override;
40
41 virtual void UpdateIPConfig(const IPConfig::Properties &properties);
42
43 // Expose protected device methods to manager of this device.
44 // (E.g. Cellular, L2TPIPSecDriver, OpenVPNDriver.)
45 virtual void DropConnection();
46 virtual void SelectService(const ServiceRefPtr &service);
47
48 private:
49 DISALLOW_COPY_AND_ASSIGN(VirtualDevice);
50};
51
52} // namespace shill
53
54#endif // SHILL_VIRTUAL_DEVICE_H_