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_OPENVPN_DRIVER_ |
| 6 | #define SHILL_OPENVPN_DRIVER_ |
| 7 | |
Darin Petkov | fe6a937 | 2012-02-28 16:25:06 +0100 | [diff] [blame] | 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame^] | 11 | #include <base/memory/scoped_ptr.h> |
Darin Petkov | fe6a937 | 2012-02-28 16:25:06 +0100 | [diff] [blame] | 12 | #include <gtest/gtest_prod.h> // for FRIEND_TEST |
| 13 | |
| 14 | #include "shill/key_value_store.h" |
Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 15 | #include "shill/vpn_driver.h" |
| 16 | |
| 17 | namespace shill { |
| 18 | |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame^] | 19 | class ControlInterface; |
Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 20 | class Error; |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame^] | 21 | class RPCTask; |
Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 22 | |
| 23 | class OpenVPNDriver : public VPNDriver { |
| 24 | public: |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame^] | 25 | OpenVPNDriver(ControlInterface *control, const KeyValueStore &args); |
Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 26 | virtual ~OpenVPNDriver(); |
| 27 | |
| 28 | // Inherited from VPNDriver. |
| 29 | virtual void Connect(Error *error); |
| 30 | |
| 31 | private: |
Darin Petkov | fe6a937 | 2012-02-28 16:25:06 +0100 | [diff] [blame] | 32 | friend class OpenVPNDriverTest; |
| 33 | FRIEND_TEST(OpenVPNDriverTest, AppendFlag); |
| 34 | FRIEND_TEST(OpenVPNDriverTest, AppendValueOption); |
| 35 | FRIEND_TEST(OpenVPNDriverTest, InitOptions); |
| 36 | FRIEND_TEST(OpenVPNDriverTest, InitOptionsNoHost); |
| 37 | |
| 38 | void InitOptions(std::vector<std::string> *options, Error *error); |
| 39 | |
| 40 | void AppendValueOption(const std::string &property, |
| 41 | const std::string &option, |
| 42 | std::vector<std::string> *options); |
| 43 | void AppendFlag(const std::string &property, |
| 44 | const std::string &option, |
| 45 | std::vector<std::string> *options); |
| 46 | |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame^] | 47 | ControlInterface *control_; |
Darin Petkov | fe6a937 | 2012-02-28 16:25:06 +0100 | [diff] [blame] | 48 | KeyValueStore args_; |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame^] | 49 | scoped_ptr<RPCTask> rpc_task_; |
Darin Petkov | fe6a937 | 2012-02-28 16:25:06 +0100 | [diff] [blame] | 50 | |
Darin Petkov | 33af05c | 2012-02-28 10:10:30 +0100 | [diff] [blame] | 51 | DISALLOW_COPY_AND_ASSIGN(OpenVPNDriver); |
| 52 | }; |
| 53 | |
| 54 | } // namespace shill |
| 55 | |
| 56 | #endif // SHILL_OPENVPN_DRIVER_ |