blob: bc27d5947409d2feb2e9455144f3c144ad64ac34 [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
Ben Chanc45688b2014-07-02 23:50:45 -07005#ifndef SHILL_PROXY_FACTORY_H_
6#define SHILL_PROXY_FACTORY_H_
Darin Petkovc90fe522011-07-15 13:59:47 -07007
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
Alex Vakulenko8a532292014-06-16 17:18:44 -070053} // namespace mm1
Jason Glasgow9a0be632012-03-30 08:53:35 -040054
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
mukesh agrawalf407d592013-07-31 11:37:57 -070060 // Since this is a singleton, use ProxyFactory::GetInstance()->Foo().
Darin Petkovab565bb2011-10-06 02:55:51 -070061 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 // The caller retains ownership of 'delegate'. It must not be deleted before
74 // the proxy.
75 virtual PowerManagerProxyInterface *CreatePowerManagerProxy(
76 PowerManagerProxyDelegate *delegate);
77
78 virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy(
79 const char *dbus_path,
80 const char *dbus_addr);
81
82 virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy(
Paul Stewart196f50f2013-03-27 18:02:11 -070083 SupplicantEventDelegateInterface *delegate,
Darin Petkov75f201f2013-03-19 13:01:28 +010084 const DBus::Path &object_path,
85 const char *dbus_addr);
86
87 virtual SupplicantNetworkProxyInterface *CreateSupplicantNetworkProxy(
88 const DBus::Path &object_path,
89 const char *dbus_addr);
90
91 // See comment in supplicant_bss_proxy.h, about bare pointer.
92 virtual SupplicantBSSProxyInterface *CreateSupplicantBSSProxy(
93 WiFiEndpoint *wifi_endpoint,
94 const DBus::Path &object_path,
95 const char *dbus_addr);
96
97 virtual DHCPProxyInterface *CreateDHCPProxy(const std::string &service);
98
99#if !defined(DISABLE_CELLULAR)
100
Darin Petkovbd9f33a2013-03-20 10:38:07 +0100101 virtual DBusObjectManagerProxyInterface *CreateDBusObjectManagerProxy(
102 const std::string &path,
103 const std::string &service);
104
Darin Petkovc90fe522011-07-15 13:59:47 -0700105 virtual ModemManagerProxyInterface *CreateModemManagerProxy(
David Rochberg81030ea2012-03-02 15:44:25 -0500106 ModemManagerClassic *manager,
Darin Petkovc90fe522011-07-15 13:59:47 -0700107 const std::string &path,
108 const std::string &service);
109
Eric Shienbrood9a245532012-03-07 14:20:39 -0500110 virtual ModemProxyInterface *CreateModemProxy(const std::string &path,
Darin Petkove9d12e02011-07-27 15:09:37 -0700111 const std::string &service);
112
Darin Petkove604f702011-07-28 15:51:17 -0700113 virtual ModemSimpleProxyInterface *CreateModemSimpleProxy(
114 const std::string &path,
115 const std::string &service);
116
Darin Petkovbec79a22011-08-01 14:47:17 -0700117 virtual ModemCDMAProxyInterface *CreateModemCDMAProxy(
118 const std::string &path,
119 const std::string &service);
120
Darin Petkov975b5e72011-08-30 11:48:08 -0700121 virtual ModemGSMCardProxyInterface *CreateModemGSMCardProxy(
Darin Petkov975b5e72011-08-30 11:48:08 -0700122 const std::string &path,
123 const std::string &service);
124
Darin Petkova1e0a1c2011-08-25 15:08:33 -0700125 virtual ModemGSMNetworkProxyInterface *CreateModemGSMNetworkProxy(
Darin Petkova1e0a1c2011-08-25 15:08:33 -0700126 const std::string &path,
127 const std::string &service);
128
Darin Petkovc37a9c42012-09-06 15:28:22 +0200129 virtual ModemGobiProxyInterface *CreateModemGobiProxy(
130 const std::string &path,
131 const std::string &service);
132
Jason Glasgow9a0be632012-03-30 08:53:35 -0400133 // Proxies for ModemManager1 interfaces
134 virtual mm1::ModemModem3gppProxyInterface *CreateMM1ModemModem3gppProxy(
135 const std::string &path,
136 const std::string &service);
137
138 virtual mm1::ModemModemCdmaProxyInterface *CreateMM1ModemModemCdmaProxy(
139 const std::string &path,
140 const std::string &service);
141
142 virtual mm1::ModemProxyInterface *CreateMM1ModemProxy(
143 const std::string &path,
144 const std::string &service);
145
Arman Uguray2c39fab2012-12-12 16:56:34 -0800146 virtual mm1::ModemLocationProxyInterface *CreateMM1ModemLocationProxy(
147 const std::string &path,
148 const std::string &service);
149
Jason Glasgow9a0be632012-03-30 08:53:35 -0400150 virtual mm1::ModemSimpleProxyInterface *CreateMM1ModemSimpleProxy(
151 const std::string &path,
152 const std::string &service);
153
Arman Uguray618af2b2012-12-11 19:20:42 -0800154 virtual mm1::ModemTimeProxyInterface *CreateMM1ModemTimeProxy(
155 const std::string &path,
156 const std::string &service);
157
Jason Glasgow9a0be632012-03-30 08:53:35 -0400158 virtual mm1::SimProxyInterface *CreateSimProxy(
159 const std::string &path,
160 const std::string &service);
161
Arman Uguray6e5639f2012-11-15 20:30:19 -0800162 virtual mm1::BearerProxyInterface *CreateBearerProxy(
163 const std::string &path,
164 const std::string &service);
165
Darin Petkov75f201f2013-03-19 13:01:28 +0100166#endif // DISABLE_CELLULAR
Darin Petkovc90fe522011-07-15 13:59:47 -0700167
Ben Chan520eb172013-10-30 20:51:04 -0700168#if !defined(DISABLE_WIMAX)
169
170 virtual WiMaxDeviceProxyInterface *CreateWiMaxDeviceProxy(
171 const std::string &path);
172 virtual WiMaxManagerProxyInterface *CreateWiMaxManagerProxy();
173 virtual WiMaxNetworkProxyInterface *CreateWiMaxNetworkProxy(
174 const std::string &path);
175
176#endif // DISABLE_WIMAX
177
Darin Petkovab565bb2011-10-06 02:55:51 -0700178 protected:
179 ProxyFactory();
Darin Petkovaceede32011-07-18 15:32:38 -0700180
Darin Petkovc90fe522011-07-15 13:59:47 -0700181 private:
Darin Petkovab565bb2011-10-06 02:55:51 -0700182 friend struct base::DefaultLazyInstanceTraits<ProxyFactory>;
Darin Petkovc90fe522011-07-15 13:59:47 -0700183
Darin Petkovaceede32011-07-18 15:32:38 -0700184 scoped_ptr<DBus::Connection> connection_;
185
Darin Petkovc90fe522011-07-15 13:59:47 -0700186 DISALLOW_COPY_AND_ASSIGN(ProxyFactory);
187};
188
189} // namespace shill
190
Ben Chanc45688b2014-07-02 23:50:45 -0700191#endif // SHILL_PROXY_FACTORY_H_