blob: 4eaf0b11295466a0e60e4a13bda7da36ca606b92 [file] [log] [blame]
Darin Petkove6ca3202012-10-19 14:49:56 +02001// 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 agrawald1bd02e2013-05-24 16:03:56 -070011#include <base/lazy_instance.h>
Darin Petkove6ca3202012-10-19 14:49:56 +020012#include <base/memory/scoped_ptr.h>
13
Darin Petkove6ca3202012-10-19 14:49:56 +020014namespace DBus {
15class BusDispatcher;
16class Connection;
17} // namespace DBus
18
19namespace shill {
20
21namespace shims {
22
23class TaskProxy;
24
25class PPP {
26 public:
Darin Petkove6ca3202012-10-19 14:49:56 +020027 ~PPP();
28
mukesh agrawalf407d592013-07-31 11:37:57 -070029 // This is a singleton -- use PPP::GetInstance()->Foo().
mukesh agrawald1bd02e2013-05-24 16:03:56 -070030 static PPP *GetInstance();
31
32 void Init();
Darin Petkove6ca3202012-10-19 14:49:56 +020033
34 bool GetSecret(std::string *username, std::string *password);
mukesh agrawalfc362912013-08-06 18:10:07 -070035 void OnAuthenticateStart();
36 void OnAuthenticateDone();
Darin Petkove6ca3202012-10-19 14:49:56 +020037 void OnConnect(const std::string &ifname);
38 void OnDisconnect();
39
mukesh agrawald1bd02e2013-05-24 16:03:56 -070040 protected:
41 PPP();
42
Darin Petkove6ca3202012-10-19 14:49:56 +020043 private:
mukesh agrawald1bd02e2013-05-24 16:03:56 -070044 friend struct base::DefaultLazyInstanceTraits<PPP>;
45
Darin Petkove6ca3202012-10-19 14:49:56 +020046 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 agrawald1bd02e2013-05-24 16:03:56 -070054 bool running_;
Darin Petkove6ca3202012-10-19 14:49:56 +020055
56 DISALLOW_COPY_AND_ASSIGN(PPP);
57};
58
59} // namespace shims
60
61} // namespace shill
62
63#endif // SHILL_SHIMS_PPP_H_