Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 1 | // 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 | |
| 13 | namespace shill { |
| 14 | |
Darin Petkov | 0286771 | 2012-03-12 14:25:05 +0100 | [diff] [blame] | 15 | class KeyValueStore; |
Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 16 | class VPNDriver; |
| 17 | |
| 18 | class VPNService : public Service { |
| 19 | public: |
Darin Petkov | 79d74c9 | 2012-03-07 17:20:32 +0100 | [diff] [blame] | 20 | VPNService(ControlInterface *control, |
Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 21 | EventDispatcher *dispatcher, |
| 22 | Metrics *metrics, |
| 23 | Manager *manager, |
| 24 | VPNDriver *driver); // Takes ownership of |driver|. |
| 25 | virtual ~VPNService(); |
| 26 | |
| 27 | // Inherited from Service. |
Darin Petkov | 2f903b3 | 2012-04-18 12:56:43 +0200 | [diff] [blame] | 28 | virtual bool TechnologyIs(const Technology::Identifier type) const; |
Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 29 | virtual void Connect(Error *error); |
Darin Petkov | 6aa2187 | 2012-03-09 16:10:19 +0100 | [diff] [blame] | 30 | virtual void Disconnect(Error *error); |
Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 31 | virtual std::string GetStorageIdentifier() const; |
Darin Petkov | f3c71d7 | 2012-03-21 12:32:15 +0100 | [diff] [blame] | 32 | virtual bool Load(StoreInterface *storage); |
| 33 | virtual bool Save(StoreInterface *storage); |
Paul Stewart | 65512e1 | 2012-03-26 18:01:08 -0700 | [diff] [blame] | 34 | virtual bool Unload(); |
Darin Petkov | 6aa2187 | 2012-03-09 16:10:19 +0100 | [diff] [blame] | 35 | |
Paul Stewart | ebd3856 | 2012-03-23 13:06:40 -0700 | [diff] [blame] | 36 | virtual void InitDriverPropertyStore(); |
| 37 | |
Darin Petkov | 6aa2187 | 2012-03-09 16:10:19 +0100 | [diff] [blame] | 38 | VPNDriver *driver() const { return driver_.get(); } |
Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 39 | |
Darin Petkov | 0286771 | 2012-03-12 14:25:05 +0100 | [diff] [blame] | 40 | static std::string CreateStorageIdentifier(const KeyValueStore &args, |
| 41 | Error *error); |
| 42 | void set_storage_id(const std::string &id) { storage_id_ = id; } |
| 43 | |
Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 44 | private: |
| 45 | FRIEND_TEST(VPNServiceTest, GetDeviceRpcId); |
| 46 | |
| 47 | virtual std::string GetDeviceRpcId(Error *error); |
| 48 | |
Darin Petkov | 0286771 | 2012-03-12 14:25:05 +0100 | [diff] [blame] | 49 | std::string storage_id_; |
Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 50 | scoped_ptr<VPNDriver> driver_; |
| 51 | |
Paul Stewart | 2280799 | 2012-04-11 08:48:31 -0700 | [diff] [blame] | 52 | // Provided only for compatibility. crosbug.com/29286 |
| 53 | std::string vpn_domain_; |
| 54 | |
Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 55 | DISALLOW_COPY_AND_ASSIGN(VPNService); |
| 56 | }; |
| 57 | |
| 58 | } // namespace shill |
| 59 | |
| 60 | #endif // SHILL_VPN_SERVICE_ |