Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Ben Chan | c45688b | 2014-07-02 23:50:45 -0700 | [diff] [blame] | 5 | #ifndef SHILL_PROXY_FACTORY_H_ |
| 6 | #define SHILL_PROXY_FACTORY_H_ |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include <base/basictypes.h> |
Darin Petkov | ab565bb | 2011-10-06 02:55:51 -0700 | [diff] [blame] | 11 | #include <base/lazy_instance.h> |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 12 | #include <base/memory/scoped_ptr.h> |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 13 | #include <dbus-c++/dbus.h> |
| 14 | |
| 15 | #include "shill/refptr_types.h" |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 16 | |
| 17 | namespace shill { |
| 18 | |
David Rochberg | 24c6c62 | 2012-03-05 11:30:44 -0500 | [diff] [blame] | 19 | class DBusObjectManagerProxyInterface; |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 20 | class DBusPropertiesProxyInterface; |
Darin Petkov | 18fb2f7 | 2012-06-14 09:09:34 +0200 | [diff] [blame] | 21 | class DBusServiceProxyInterface; |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 22 | class DHCPProxyInterface; |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 23 | class ModemCDMAProxyInterface; |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 24 | class ModemGSMCardProxyInterface; |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 25 | class ModemGSMNetworkProxyInterface; |
Darin Petkov | c37a9c4 | 2012-09-06 15:28:22 +0200 | [diff] [blame] | 26 | class ModemGobiProxyInterface; |
David Rochberg | 81030ea | 2012-03-02 15:44:25 -0500 | [diff] [blame] | 27 | class ModemManagerClassic; |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 28 | class ModemManagerProxyInterface; |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 29 | class ModemProxyInterface; |
Darin Petkov | e604f70 | 2011-07-28 15:51:17 -0700 | [diff] [blame] | 30 | class ModemSimpleProxyInterface; |
Darin Petkov | 394b7d4 | 2011-11-03 15:48:02 +0100 | [diff] [blame] | 31 | class PowerManagerProxyDelegate; |
| 32 | class PowerManagerProxyInterface; |
mukesh agrawal | b20776f | 2012-02-10 16:00:36 -0800 | [diff] [blame] | 33 | class SupplicantBSSProxyInterface; |
Paul Stewart | 196f50f | 2013-03-27 18:02:11 -0700 | [diff] [blame] | 34 | class SupplicantEventDelegateInterface; |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 35 | class SupplicantInterfaceProxyInterface; |
Paul Stewart | 835934a | 2012-12-06 19:27:09 -0800 | [diff] [blame] | 36 | class SupplicantNetworkProxyInterface; |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 37 | class SupplicantProcessProxyInterface; |
Darin Petkov | 096b347 | 2012-05-15 10:26:22 +0200 | [diff] [blame] | 38 | class WiMaxDeviceProxyInterface; |
| 39 | class WiMaxManagerProxyInterface; |
Darin Petkov | 9893d9c | 2012-05-17 15:27:31 -0700 | [diff] [blame] | 40 | class WiMaxNetworkProxyInterface; |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 41 | |
Jason Glasgow | 9a0be63 | 2012-03-30 08:53:35 -0400 | [diff] [blame] | 42 | namespace mm1 { |
| 43 | |
Arman Uguray | 6e5639f | 2012-11-15 20:30:19 -0800 | [diff] [blame] | 44 | class BearerProxyInterface; |
Arman Uguray | 2c39fab | 2012-12-12 16:56:34 -0800 | [diff] [blame] | 45 | class ModemLocationProxyInterface; |
Jason Glasgow | 9a0be63 | 2012-03-30 08:53:35 -0400 | [diff] [blame] | 46 | class ModemModem3gppProxyInterface; |
| 47 | class ModemModemCdmaProxyInterface; |
| 48 | class ModemProxyInterface; |
| 49 | class ModemSimpleProxyInterface; |
Arman Uguray | 618af2b | 2012-12-11 19:20:42 -0800 | [diff] [blame] | 50 | class ModemTimeProxyInterface; |
Jason Glasgow | 9a0be63 | 2012-03-30 08:53:35 -0400 | [diff] [blame] | 51 | class SimProxyInterface; |
| 52 | |
Alex Vakulenko | 8a53229 | 2014-06-16 17:18:44 -0700 | [diff] [blame] | 53 | } // namespace mm1 |
Jason Glasgow | 9a0be63 | 2012-03-30 08:53:35 -0400 | [diff] [blame] | 54 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 55 | // Global DBus proxy factory that can be mocked out in tests. |
| 56 | class ProxyFactory { |
| 57 | public: |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 58 | virtual ~ProxyFactory(); |
| 59 | |
mukesh agrawal | f407d59 | 2013-07-31 11:37:57 -0700 | [diff] [blame] | 60 | // Since this is a singleton, use ProxyFactory::GetInstance()->Foo(). |
Darin Petkov | ab565bb | 2011-10-06 02:55:51 -0700 | [diff] [blame] | 61 | static ProxyFactory *GetInstance(); |
| 62 | |
Thieu Le | fb46caf | 2012-03-08 11:57:15 -0800 | [diff] [blame] | 63 | virtual void Init(); |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 64 | |
Darin Petkov | 75f201f | 2013-03-19 13:01:28 +0100 | [diff] [blame] | 65 | DBus::Connection *connection() const { return connection_.get(); } |
| 66 | |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 67 | virtual DBusPropertiesProxyInterface *CreateDBusPropertiesProxy( |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 68 | const std::string &path, |
| 69 | const std::string &service); |
| 70 | |
Darin Petkov | 18fb2f7 | 2012-06-14 09:09:34 +0200 | [diff] [blame] | 71 | virtual DBusServiceProxyInterface *CreateDBusServiceProxy(); |
| 72 | |
Darin Petkov | 75f201f | 2013-03-19 13:01:28 +0100 | [diff] [blame] | 73 | // 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 Stewart | 196f50f | 2013-03-27 18:02:11 -0700 | [diff] [blame] | 83 | SupplicantEventDelegateInterface *delegate, |
Darin Petkov | 75f201f | 2013-03-19 13:01:28 +0100 | [diff] [blame] | 84 | 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 Petkov | bd9f33a | 2013-03-20 10:38:07 +0100 | [diff] [blame] | 101 | virtual DBusObjectManagerProxyInterface *CreateDBusObjectManagerProxy( |
| 102 | const std::string &path, |
| 103 | const std::string &service); |
| 104 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 105 | virtual ModemManagerProxyInterface *CreateModemManagerProxy( |
David Rochberg | 81030ea | 2012-03-02 15:44:25 -0500 | [diff] [blame] | 106 | ModemManagerClassic *manager, |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 107 | const std::string &path, |
| 108 | const std::string &service); |
| 109 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 110 | virtual ModemProxyInterface *CreateModemProxy(const std::string &path, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 111 | const std::string &service); |
| 112 | |
Darin Petkov | e604f70 | 2011-07-28 15:51:17 -0700 | [diff] [blame] | 113 | virtual ModemSimpleProxyInterface *CreateModemSimpleProxy( |
| 114 | const std::string &path, |
| 115 | const std::string &service); |
| 116 | |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 117 | virtual ModemCDMAProxyInterface *CreateModemCDMAProxy( |
| 118 | const std::string &path, |
| 119 | const std::string &service); |
| 120 | |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 121 | virtual ModemGSMCardProxyInterface *CreateModemGSMCardProxy( |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 122 | const std::string &path, |
| 123 | const std::string &service); |
| 124 | |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 125 | virtual ModemGSMNetworkProxyInterface *CreateModemGSMNetworkProxy( |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 126 | const std::string &path, |
| 127 | const std::string &service); |
| 128 | |
Darin Petkov | c37a9c4 | 2012-09-06 15:28:22 +0200 | [diff] [blame] | 129 | virtual ModemGobiProxyInterface *CreateModemGobiProxy( |
| 130 | const std::string &path, |
| 131 | const std::string &service); |
| 132 | |
Jason Glasgow | 9a0be63 | 2012-03-30 08:53:35 -0400 | [diff] [blame] | 133 | // 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 Uguray | 2c39fab | 2012-12-12 16:56:34 -0800 | [diff] [blame] | 146 | virtual mm1::ModemLocationProxyInterface *CreateMM1ModemLocationProxy( |
| 147 | const std::string &path, |
| 148 | const std::string &service); |
| 149 | |
Jason Glasgow | 9a0be63 | 2012-03-30 08:53:35 -0400 | [diff] [blame] | 150 | virtual mm1::ModemSimpleProxyInterface *CreateMM1ModemSimpleProxy( |
| 151 | const std::string &path, |
| 152 | const std::string &service); |
| 153 | |
Arman Uguray | 618af2b | 2012-12-11 19:20:42 -0800 | [diff] [blame] | 154 | virtual mm1::ModemTimeProxyInterface *CreateMM1ModemTimeProxy( |
| 155 | const std::string &path, |
| 156 | const std::string &service); |
| 157 | |
Jason Glasgow | 9a0be63 | 2012-03-30 08:53:35 -0400 | [diff] [blame] | 158 | virtual mm1::SimProxyInterface *CreateSimProxy( |
| 159 | const std::string &path, |
| 160 | const std::string &service); |
| 161 | |
Arman Uguray | 6e5639f | 2012-11-15 20:30:19 -0800 | [diff] [blame] | 162 | virtual mm1::BearerProxyInterface *CreateBearerProxy( |
| 163 | const std::string &path, |
| 164 | const std::string &service); |
| 165 | |
Darin Petkov | 75f201f | 2013-03-19 13:01:28 +0100 | [diff] [blame] | 166 | #endif // DISABLE_CELLULAR |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 167 | |
Ben Chan | 520eb17 | 2013-10-30 20:51:04 -0700 | [diff] [blame] | 168 | #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 Petkov | ab565bb | 2011-10-06 02:55:51 -0700 | [diff] [blame] | 178 | protected: |
| 179 | ProxyFactory(); |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 180 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 181 | private: |
Darin Petkov | ab565bb | 2011-10-06 02:55:51 -0700 | [diff] [blame] | 182 | friend struct base::DefaultLazyInstanceTraits<ProxyFactory>; |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 183 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 184 | scoped_ptr<DBus::Connection> connection_; |
| 185 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 186 | DISALLOW_COPY_AND_ASSIGN(ProxyFactory); |
| 187 | }; |
| 188 | |
| 189 | } // namespace shill |
| 190 | |
Ben Chan | c45688b | 2014-07-02 23:50:45 -0700 | [diff] [blame] | 191 | #endif // SHILL_PROXY_FACTORY_H_ |