Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: l2tp_manager.h

Issue 6508016: vpn-manager: Add l2tp/ipsec vpn manager (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vpn-manager.git@master
Patch Set: respond to petkov Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ipsec_manager_test.cc ('k') | l2tp_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 _VPN_MANAGER_L2TP_MANAGER_H_
6 #define _VPN_MANAGER_L2TP_MANAGER_H_
7
8 #include "base/file_util.h"
9 #include "base/scoped_ptr.h"
10 #include "base/time.h"
11 #include "gtest/gtest_prod.h" // for FRIEND_TEST
12 #include "vpn-manager/service_manager.h"
13
14 namespace chromeos {
15 class Process;
16 }
17
18 // Manages the L2TP daemon. This manager orchestrates configuring and
19 // launching the L2TP daemon, initiating the L2TP connection, and
20 // detecting when PPP has been set up. It also sends user credentials
21 // to PPP through the L2TP control fifo unless the user has specified
22 // a PPP plugin should be used, which it will defer to. Current
23 // implementation assumes a connection that has been stopped will not
24 // be started again with the same object.
25 class L2tpManager : public ServiceManager {
26 public:
27 L2tpManager();
28
29 // Initialize the object using |remote_address|. Returns false if
30 // an illegal set of parameters has been given. Has no side effects
31 // other than setting up the object.
32 bool Initialize(const std::string& remote_address);
33
34 virtual bool Start();
35 virtual void Stop();
36 virtual int Poll();
37 virtual void ProcessOutput();
38 virtual bool IsChild(pid_t pid);
39
40 // Returns the stderr output file descriptor of our child process.
41 int output_fd() const { return output_fd_; }
42
43 private:
44 friend class L2tpManagerTest;
45 FRIEND_TEST(L2tpManagerTest, FormatL2tpdConfiguration);
46 FRIEND_TEST(L2tpManagerTest, FormatPppdConfiguration);
47 FRIEND_TEST(L2tpManagerTest, Initiate);
48 FRIEND_TEST(L2tpManagerTest, PollInitiateConnection);
49 FRIEND_TEST(L2tpManagerTest, PollNothingIfRunning);
50 FRIEND_TEST(L2tpManagerTest, PollTimeoutWaitingForControl);
51 FRIEND_TEST(L2tpManagerTest, PollTimeoutWaitingForUp);
52 FRIEND_TEST(L2tpManagerTest, PollTransitionToUp);
53 FRIEND_TEST(L2tpManagerTest, PollWaitIfNotUpYet);
54 FRIEND_TEST(L2tpManagerTest, Start);
55 FRIEND_TEST(L2tpManagerTest, Terminate);
56
57 std::string FormatL2tpdConfiguration(const std::string& ppp_config_path);
58 std::string FormatPppdConfiguration();
59 bool Initiate();
60 bool Terminate();
61
62 // Has the L2TP connection been initiated yet.
63 bool was_initiated_;
64 // l2tp daemon stderr pipe file descriptor.
65 int output_fd_;
66 // Start time of the l2tp daemon.
67 base::TimeTicks start_ticks_;
68 // Remote address for L2TP connection.
69 std::string remote_address_;
70 // Last partial line read from output_fd_.
71 std::string partial_output_line_;
72 // Path to a file whose existence indicates the ppp device is up.
73 FilePath ppp_interface_path_;
74 // Path to l2tp daemon's control file.
75 FilePath l2tpd_control_path_;
76 // Running l2tp process.
77 scoped_ptr<chromeos::Process> l2tpd_;
78 };
79
80 #endif // _VPN_MANAGER_L2TP_MANAGER_H_
OLDNEW
« no previous file with comments | « ipsec_manager_test.cc ('k') | l2tp_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698