blob: 8fd45cb9866fbc4a7ab48343d16ca2aeefce2427 [file] [log] [blame]
Eric Shienbrood5de44ab2011-12-05 10:46:27 -05001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Darin Petkovc90fe522011-07-15 13:59:47 -07002// 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
David Rochberg24c6c622012-03-05 11:30:44 -050019class DBusObjectManagerProxyInterface;
Darin Petkov5c97ac52011-07-19 16:30:49 -070020class DBusPropertiesProxyInterface;
Darin Petkov18fb2f72012-06-14 09:09:34 +020021class DBusServiceProxyInterface;
Darin Petkovaceede32011-07-18 15:32:38 -070022class DHCPProxyInterface;
Darin Petkovbec79a22011-08-01 14:47:17 -070023class ModemCDMAProxyInterface;
Darin Petkov975b5e72011-08-30 11:48:08 -070024class ModemGSMCardProxyInterface;
Darin Petkova1e0a1c2011-08-25 15:08:33 -070025class ModemGSMNetworkProxyInterface;
Darin Petkovc37a9c42012-09-06 15:28:22 +020026class ModemGobiProxyInterface;
David Rochberg81030ea2012-03-02 15:44:25 -050027class ModemManagerClassic;
Darin Petkovc90fe522011-07-15 13:59:47 -070028class ModemManagerProxyInterface;
Darin Petkove9d12e02011-07-27 15:09:37 -070029class ModemProxyInterface;
Darin Petkove604f702011-07-28 15:51:17 -070030class ModemSimpleProxyInterface;
Darin Petkov394b7d42011-11-03 15:48:02 +010031class PowerManagerProxyDelegate;
32class PowerManagerProxyInterface;
mukesh agrawalb20776f2012-02-10 16:00:36 -080033class SupplicantBSSProxyInterface;
Paul Stewart196f50f2013-03-27 18:02:11 -070034class SupplicantEventDelegateInterface;
Darin Petkovd1967262011-07-18 14:55:18 -070035class SupplicantInterfaceProxyInterface;
Paul Stewart835934a2012-12-06 19:27:09 -080036class SupplicantNetworkProxyInterface;
Darin Petkovd1967262011-07-18 14:55:18 -070037class SupplicantProcessProxyInterface;
Darin Petkov096b3472012-05-15 10:26:22 +020038class WiMaxDeviceProxyInterface;
39class WiMaxManagerProxyInterface;
Darin Petkov9893d9c2012-05-17 15:27:31 -070040class WiMaxNetworkProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070041
Jason Glasgow9a0be632012-03-30 08:53:35 -040042namespace mm1 {
43
Arman Uguray6e5639f2012-11-15 20:30:19 -080044class BearerProxyInterface;
Arman Uguray2c39fab2012-12-12 16:56:34 -080045class ModemLocationProxyInterface;
Jason Glasgow9a0be632012-03-30 08:53:35 -040046class ModemModem3gppProxyInterface;
47class ModemModemCdmaProxyInterface;
48class ModemProxyInterface;
49class ModemSimpleProxyInterface;
Arman Uguray618af2b2012-12-11 19:20:42 -080050class ModemTimeProxyInterface;
Jason Glasgow9a0be632012-03-30 08:53:35 -040051class SimProxyInterface;
52
53} // namespace mm1
54
Darin Petkovc90fe522011-07-15 13:59:47 -070055// Global DBus proxy factory that can be mocked out in tests.
56class ProxyFactory {
57 public:
Darin Petkovc90fe522011-07-15 13:59:47 -070058 virtual ~ProxyFactory();
59
Darin Petkovab565bb2011-10-06 02:55:51 -070060 // Since this is a singleton, use ProxyFactory::GetInstance()->Foo()
61 static ProxyFactory *GetInstance();
62
Thieu Lefb46caf2012-03-08 11:57:15 -080063 virtual void Init();
Darin Petkovaceede32011-07-18 15:32:38 -070064
Darin Petkov75f201f2013-03-19 13:01:28 +010065 DBus::Connection *connection() const { return connection_.get(); }
66
Darin Petkov5c97ac52011-07-19 16:30:49 -070067 virtual DBusPropertiesProxyInterface *CreateDBusPropertiesProxy(
Darin Petkov5c97ac52011-07-19 16:30:49 -070068 const std::string &path,
69 const std::string &service);
70
Darin Petkov18fb2f72012-06-14 09:09:34 +020071 virtual DBusServiceProxyInterface *CreateDBusServiceProxy();
72
Darin Petkov75f201f2013-03-19 13:01:28 +010073 virtual WiMaxDeviceProxyInterface *CreateWiMaxDeviceProxy(
74 const std::string &path);
75 virtual WiMaxManagerProxyInterface *CreateWiMaxManagerProxy();
76 virtual WiMaxNetworkProxyInterface *CreateWiMaxNetworkProxy(
77 const std::string &path);
78
79 // The caller retains ownership of 'delegate'. It must not be deleted before
80 // the proxy.
81 virtual PowerManagerProxyInterface *CreatePowerManagerProxy(
82 PowerManagerProxyDelegate *delegate);
83
84 virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy(
85 const char *dbus_path,
86 const char *dbus_addr);
87
88 virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy(
Paul Stewart196f50f2013-03-27 18:02:11 -070089 SupplicantEventDelegateInterface *delegate,
Darin Petkov75f201f2013-03-19 13:01:28 +010090 const DBus::Path &object_path,
91 const char *dbus_addr);
92
93 virtual SupplicantNetworkProxyInterface *CreateSupplicantNetworkProxy(
94 const DBus::Path &object_path,
95 const char *dbus_addr);
96
97 // See comment in supplicant_bss_proxy.h, about bare pointer.
98 virtual SupplicantBSSProxyInterface *CreateSupplicantBSSProxy(
99 WiFiEndpoint *wifi_endpoint,
100 const DBus::Path &object_path,
101 const char *dbus_addr);
102
103 virtual DHCPProxyInterface *CreateDHCPProxy(const std::string &service);
104
105#if !defined(DISABLE_CELLULAR)
106
Darin Petkovbd9f33a2013-03-20 10:38:07 +0100107 virtual DBusObjectManagerProxyInterface *CreateDBusObjectManagerProxy(
108 const std::string &path,
109 const std::string &service);
110
Darin Petkovc90fe522011-07-15 13:59:47 -0700111 virtual ModemManagerProxyInterface *CreateModemManagerProxy(
David Rochberg81030ea2012-03-02 15:44:25 -0500112 ModemManagerClassic *manager,
Darin Petkovc90fe522011-07-15 13:59:47 -0700113 const std::string &path,
114 const std::string &service);
115
Eric Shienbrood9a245532012-03-07 14:20:39 -0500116 virtual ModemProxyInterface *CreateModemProxy(const std::string &path,
Darin Petkove9d12e02011-07-27 15:09:37 -0700117 const std::string &service);
118
Darin Petkove604f702011-07-28 15:51:17 -0700119 virtual ModemSimpleProxyInterface *CreateModemSimpleProxy(
120 const std::string &path,
121 const std::string &service);
122
Darin Petkovbec79a22011-08-01 14:47:17 -0700123 virtual ModemCDMAProxyInterface *CreateModemCDMAProxy(
124 const std::string &path,
125 const std::string &service);
126
Darin Petkov975b5e72011-08-30 11:48:08 -0700127 virtual ModemGSMCardProxyInterface *CreateModemGSMCardProxy(
Darin Petkov975b5e72011-08-30 11:48:08 -0700128 const std::string &path,
129 const std::string &service);
130
Darin Petkova1e0a1c2011-08-25 15:08:33 -0700131 virtual ModemGSMNetworkProxyInterface *CreateModemGSMNetworkProxy(
Darin Petkova1e0a1c2011-08-25 15:08:33 -0700132 const std::string &path,
133 const std::string &service);
134
Darin Petkovc37a9c42012-09-06 15:28:22 +0200135 virtual ModemGobiProxyInterface *CreateModemGobiProxy(
136 const std::string &path,
137 const std::string &service);
138
Jason Glasgow9a0be632012-03-30 08:53:35 -0400139 // Proxies for ModemManager1 interfaces
140 virtual mm1::ModemModem3gppProxyInterface *CreateMM1ModemModem3gppProxy(
141 const std::string &path,
142 const std::string &service);
143
144 virtual mm1::ModemModemCdmaProxyInterface *CreateMM1ModemModemCdmaProxy(
145 const std::string &path,
146 const std::string &service);
147
148 virtual mm1::ModemProxyInterface *CreateMM1ModemProxy(
149 const std::string &path,
150 const std::string &service);
151
Arman Uguray2c39fab2012-12-12 16:56:34 -0800152 virtual mm1::ModemLocationProxyInterface *CreateMM1ModemLocationProxy(
153 const std::string &path,
154 const std::string &service);
155
Jason Glasgow9a0be632012-03-30 08:53:35 -0400156 virtual mm1::ModemSimpleProxyInterface *CreateMM1ModemSimpleProxy(
157 const std::string &path,
158 const std::string &service);
159
Arman Uguray618af2b2012-12-11 19:20:42 -0800160 virtual mm1::ModemTimeProxyInterface *CreateMM1ModemTimeProxy(
161 const std::string &path,
162 const std::string &service);
163
Jason Glasgow9a0be632012-03-30 08:53:35 -0400164 virtual mm1::SimProxyInterface *CreateSimProxy(
165 const std::string &path,
166 const std::string &service);
167
Arman Uguray6e5639f2012-11-15 20:30:19 -0800168 virtual mm1::BearerProxyInterface *CreateBearerProxy(
169 const std::string &path,
170 const std::string &service);
171
Darin Petkov75f201f2013-03-19 13:01:28 +0100172#endif // DISABLE_CELLULAR
Darin Petkovc90fe522011-07-15 13:59:47 -0700173
Darin Petkovab565bb2011-10-06 02:55:51 -0700174 protected:
175 ProxyFactory();
Darin Petkovaceede32011-07-18 15:32:38 -0700176
Darin Petkovc90fe522011-07-15 13:59:47 -0700177 private:
Darin Petkovab565bb2011-10-06 02:55:51 -0700178 friend struct base::DefaultLazyInstanceTraits<ProxyFactory>;
Darin Petkovc90fe522011-07-15 13:59:47 -0700179
Darin Petkovaceede32011-07-18 15:32:38 -0700180 scoped_ptr<DBus::Connection> connection_;
181
Darin Petkovc90fe522011-07-15 13:59:47 -0700182 DISALLOW_COPY_AND_ASSIGN(ProxyFactory);
183};
184
185} // namespace shill
186
187#endif // SHILL_PROXY_FACTORY_