Darin Petkov | e6ca320 | 2012-10-19 14:49:56 +0200 | [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_SHIMS_PPP_H_ |
| 6 | #define SHILL_SHIMS_PPP_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include <base/basictypes.h> |
mukesh agrawal | d1bd02e | 2013-05-24 16:03:56 -0700 | [diff] [blame] | 11 | #include <base/lazy_instance.h> |
Darin Petkov | e6ca320 | 2012-10-19 14:49:56 +0200 | [diff] [blame] | 12 | #include <base/memory/scoped_ptr.h> |
| 13 | |
Darin Petkov | e6ca320 | 2012-10-19 14:49:56 +0200 | [diff] [blame] | 14 | namespace DBus { |
| 15 | class BusDispatcher; |
| 16 | class Connection; |
| 17 | } // namespace DBus |
| 18 | |
| 19 | namespace shill { |
| 20 | |
| 21 | namespace shims { |
| 22 | |
| 23 | class TaskProxy; |
| 24 | |
| 25 | class PPP { |
| 26 | public: |
Darin Petkov | e6ca320 | 2012-10-19 14:49:56 +0200 | [diff] [blame] | 27 | ~PPP(); |
| 28 | |
mukesh agrawal | f407d59 | 2013-07-31 11:37:57 -0700 | [diff] [blame] | 29 | // This is a singleton -- use PPP::GetInstance()->Foo(). |
mukesh agrawal | d1bd02e | 2013-05-24 16:03:56 -0700 | [diff] [blame] | 30 | static PPP *GetInstance(); |
| 31 | |
| 32 | void Init(); |
Darin Petkov | e6ca320 | 2012-10-19 14:49:56 +0200 | [diff] [blame] | 33 | |
| 34 | bool GetSecret(std::string *username, std::string *password); |
mukesh agrawal | fc36291 | 2013-08-06 18:10:07 -0700 | [diff] [blame^] | 35 | void OnAuthenticateStart(); |
| 36 | void OnAuthenticateDone(); |
Darin Petkov | e6ca320 | 2012-10-19 14:49:56 +0200 | [diff] [blame] | 37 | void OnConnect(const std::string &ifname); |
| 38 | void OnDisconnect(); |
| 39 | |
mukesh agrawal | d1bd02e | 2013-05-24 16:03:56 -0700 | [diff] [blame] | 40 | protected: |
| 41 | PPP(); |
| 42 | |
Darin Petkov | e6ca320 | 2012-10-19 14:49:56 +0200 | [diff] [blame] | 43 | private: |
mukesh agrawal | d1bd02e | 2013-05-24 16:03:56 -0700 | [diff] [blame] | 44 | friend struct base::DefaultLazyInstanceTraits<PPP>; |
| 45 | |
Darin Petkov | e6ca320 | 2012-10-19 14:49:56 +0200 | [diff] [blame] | 46 | bool CreateProxy(); |
| 47 | void DestroyProxy(); |
| 48 | |
| 49 | static std::string ConvertIPToText(const void *addr); |
| 50 | |
| 51 | scoped_ptr<DBus::BusDispatcher> dispatcher_; |
| 52 | scoped_ptr<DBus::Connection> connection_; |
| 53 | scoped_ptr<TaskProxy> proxy_; |
mukesh agrawal | d1bd02e | 2013-05-24 16:03:56 -0700 | [diff] [blame] | 54 | bool running_; |
Darin Petkov | e6ca320 | 2012-10-19 14:49:56 +0200 | [diff] [blame] | 55 | |
| 56 | DISALLOW_COPY_AND_ASSIGN(PPP); |
| 57 | }; |
| 58 | |
| 59 | } // namespace shims |
| 60 | |
| 61 | } // namespace shill |
| 62 | |
| 63 | #endif // SHILL_SHIMS_PPP_H_ |