blob: 186f00a9412b51ad12f70fa6b636ee23792f1560 [file] [log] [blame]
Darin Petkovc90fe522011-07-15 13:59:47 -07001// 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 SHILL_PROXY_FACTORY_
6#define SHILL_PROXY_FACTORY_
7
8#include <string>
9
10#include <base/basictypes.h>
Darin Petkovab565bb2011-10-06 02:55:51 -070011#include <base/lazy_instance.h>
Darin Petkovaceede32011-07-18 15:32:38 -070012#include <base/memory/scoped_ptr.h>
Darin Petkovd1967262011-07-18 14:55:18 -070013#include <dbus-c++/dbus.h>
14
15#include "shill/refptr_types.h"
Darin Petkovc90fe522011-07-15 13:59:47 -070016
17namespace shill {
18
Darin Petkov580c7af2011-10-24 12:32:50 +020019class DBusPropertiesProxyDelegate;
Darin Petkov5c97ac52011-07-19 16:30:49 -070020class DBusPropertiesProxyInterface;
Darin Petkovaceede32011-07-18 15:32:38 -070021class DHCPProxyInterface;
Darin Petkov580c7af2011-10-24 12:32:50 +020022class ModemCDMAProxyDelegate;
Darin Petkovbec79a22011-08-01 14:47:17 -070023class ModemCDMAProxyInterface;
Darin Petkov580c7af2011-10-24 12:32:50 +020024class ModemGSMCardProxyDelegate;
Darin Petkov975b5e72011-08-30 11:48:08 -070025class ModemGSMCardProxyInterface;
Darin Petkov580c7af2011-10-24 12:32:50 +020026class ModemGSMNetworkProxyDelegate;
Darin Petkova1e0a1c2011-08-25 15:08:33 -070027class ModemGSMNetworkProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070028class ModemManager;
29class ModemManagerProxyInterface;
Darin Petkov580c7af2011-10-24 12:32:50 +020030class ModemProxyDelegate;
Darin Petkove9d12e02011-07-27 15:09:37 -070031class ModemProxyInterface;
Darin Petkove604f702011-07-28 15:51:17 -070032class ModemSimpleProxyInterface;
Darin Petkov394b7d42011-11-03 15:48:02 +010033class PowerManagerProxyDelegate;
34class PowerManagerProxyInterface;
Darin Petkovd1967262011-07-18 14:55:18 -070035class SupplicantInterfaceProxyInterface;
36class SupplicantProcessProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070037
38// Global DBus proxy factory that can be mocked out in tests.
39class ProxyFactory {
40 public:
Darin Petkovc90fe522011-07-15 13:59:47 -070041 virtual ~ProxyFactory();
42
Darin Petkovab565bb2011-10-06 02:55:51 -070043 // Since this is a singleton, use ProxyFactory::GetInstance()->Foo()
44 static ProxyFactory *GetInstance();
45
Darin Petkovaceede32011-07-18 15:32:38 -070046 void Init();
47
Darin Petkov5c97ac52011-07-19 16:30:49 -070048 virtual DBusPropertiesProxyInterface *CreateDBusPropertiesProxy(
Darin Petkov580c7af2011-10-24 12:32:50 +020049 DBusPropertiesProxyDelegate *delegate,
Darin Petkov5c97ac52011-07-19 16:30:49 -070050 const std::string &path,
51 const std::string &service);
52
Darin Petkovc90fe522011-07-15 13:59:47 -070053 virtual ModemManagerProxyInterface *CreateModemManagerProxy(
54 ModemManager *manager,
55 const std::string &path,
56 const std::string &service);
57
Darin Petkov580c7af2011-10-24 12:32:50 +020058 virtual ModemProxyInterface *CreateModemProxy(ModemProxyDelegate *delegate,
Darin Petkovc5f56562011-08-06 16:40:05 -070059 const std::string &path,
Darin Petkove9d12e02011-07-27 15:09:37 -070060 const std::string &service);
61
Darin Petkove604f702011-07-28 15:51:17 -070062 virtual ModemSimpleProxyInterface *CreateModemSimpleProxy(
63 const std::string &path,
64 const std::string &service);
65
Darin Petkovbec79a22011-08-01 14:47:17 -070066 virtual ModemCDMAProxyInterface *CreateModemCDMAProxy(
Darin Petkov580c7af2011-10-24 12:32:50 +020067 ModemCDMAProxyDelegate *delegate,
Darin Petkovbec79a22011-08-01 14:47:17 -070068 const std::string &path,
69 const std::string &service);
70
Darin Petkov975b5e72011-08-30 11:48:08 -070071 virtual ModemGSMCardProxyInterface *CreateModemGSMCardProxy(
Darin Petkov580c7af2011-10-24 12:32:50 +020072 ModemGSMCardProxyDelegate *delegate,
Darin Petkov975b5e72011-08-30 11:48:08 -070073 const std::string &path,
74 const std::string &service);
75
Darin Petkova1e0a1c2011-08-25 15:08:33 -070076 virtual ModemGSMNetworkProxyInterface *CreateModemGSMNetworkProxy(
Darin Petkov580c7af2011-10-24 12:32:50 +020077 ModemGSMNetworkProxyDelegate *delegate,
Darin Petkova1e0a1c2011-08-25 15:08:33 -070078 const std::string &path,
79 const std::string &service);
80
Darin Petkov394b7d42011-11-03 15:48:02 +010081 virtual PowerManagerProxyInterface *CreatePowerManagerProxy(
82 PowerManagerProxyDelegate *delegate);
83
Darin Petkovaceede32011-07-18 15:32:38 -070084 virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070085 const char *dbus_path,
86 const char *dbus_addr);
87
Darin Petkovaceede32011-07-18 15:32:38 -070088 virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070089 const WiFiRefPtr &wifi,
90 const DBus::Path &object_path,
91 const char *dbus_addr);
92
Darin Petkova7b89492011-07-27 12:48:17 -070093 virtual DHCPProxyInterface *CreateDHCPProxy(const std::string &service);
Darin Petkovaceede32011-07-18 15:32:38 -070094
Darin Petkovab565bb2011-10-06 02:55:51 -070095 DBus::Connection *connection() const { return connection_.get(); }
Darin Petkovc90fe522011-07-15 13:59:47 -070096
Darin Petkovab565bb2011-10-06 02:55:51 -070097 protected:
98 ProxyFactory();
Darin Petkovaceede32011-07-18 15:32:38 -070099
Darin Petkovc90fe522011-07-15 13:59:47 -0700100 private:
Darin Petkovab565bb2011-10-06 02:55:51 -0700101 friend struct base::DefaultLazyInstanceTraits<ProxyFactory>;
Darin Petkovc90fe522011-07-15 13:59:47 -0700102
Darin Petkovaceede32011-07-18 15:32:38 -0700103 scoped_ptr<DBus::Connection> connection_;
104
Darin Petkovc90fe522011-07-15 13:59:47 -0700105 DISALLOW_COPY_AND_ASSIGN(ProxyFactory);
106};
107
108} // namespace shill
109
110#endif // SHILL_PROXY_FACTORY_