blob: b7b456ad0b7b4b476fb042dce82d2e274031ee30 [file] [log] [blame]
Darin Petkov33af05c2012-02-28 10:10:30 +01001// 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_VPN_SERVICE_
6#define SHILL_VPN_SERVICE_
7
8#include <base/memory/scoped_ptr.h>
9#include <gtest/gtest_prod.h> // for FRIEND_TEST
10
11#include "shill/service.h"
12
13namespace shill {
14
Darin Petkov02867712012-03-12 14:25:05 +010015class KeyValueStore;
Darin Petkov33af05c2012-02-28 10:10:30 +010016class VPNDriver;
17
18class VPNService : public Service {
19 public:
Darin Petkov79d74c92012-03-07 17:20:32 +010020 VPNService(ControlInterface *control,
Darin Petkov33af05c2012-02-28 10:10:30 +010021 EventDispatcher *dispatcher,
22 Metrics *metrics,
23 Manager *manager,
24 VPNDriver *driver); // Takes ownership of |driver|.
25 virtual ~VPNService();
26
27 // Inherited from Service.
Darin Petkov2f903b32012-04-18 12:56:43 +020028 virtual bool TechnologyIs(const Technology::Identifier type) const;
Darin Petkov33af05c2012-02-28 10:10:30 +010029 virtual void Connect(Error *error);
Darin Petkov6aa21872012-03-09 16:10:19 +010030 virtual void Disconnect(Error *error);
Darin Petkov33af05c2012-02-28 10:10:30 +010031 virtual std::string GetStorageIdentifier() const;
Darin Petkovf3c71d72012-03-21 12:32:15 +010032 virtual bool Load(StoreInterface *storage);
33 virtual bool Save(StoreInterface *storage);
Paul Stewart65512e12012-03-26 18:01:08 -070034 virtual bool Unload();
Darin Petkov1d0080a2012-04-30 17:10:36 +020035 virtual void MakeFavorite();
Darin Petkov6aa21872012-03-09 16:10:19 +010036
Paul Stewartebd38562012-03-23 13:06:40 -070037 virtual void InitDriverPropertyStore();
38
Darin Petkov6aa21872012-03-09 16:10:19 +010039 VPNDriver *driver() const { return driver_.get(); }
Darin Petkov33af05c2012-02-28 10:10:30 +010040
Darin Petkov02867712012-03-12 14:25:05 +010041 static std::string CreateStorageIdentifier(const KeyValueStore &args,
42 Error *error);
43 void set_storage_id(const std::string &id) { storage_id_ = id; }
44
Darin Petkov33af05c2012-02-28 10:10:30 +010045 private:
46 FRIEND_TEST(VPNServiceTest, GetDeviceRpcId);
47
48 virtual std::string GetDeviceRpcId(Error *error);
49
Darin Petkov02867712012-03-12 14:25:05 +010050 std::string storage_id_;
Darin Petkov33af05c2012-02-28 10:10:30 +010051 scoped_ptr<VPNDriver> driver_;
52
Paul Stewart22807992012-04-11 08:48:31 -070053 // Provided only for compatibility. crosbug.com/29286
54 std::string vpn_domain_;
55
Darin Petkov33af05c2012-02-28 10:10:30 +010056 DISALLOW_COPY_AND_ASSIGN(VPNService);
57};
58
59} // namespace shill
60
61#endif // SHILL_VPN_SERVICE_