Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 1 | // 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 Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 11 | #include <base/memory/scoped_ptr.h> |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 12 | #include <dbus-c++/dbus.h> |
| 13 | |
| 14 | #include "shill/refptr_types.h" |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 15 | |
| 16 | namespace shill { |
| 17 | |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 18 | class DBusPropertiesProxyInterface; |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 19 | class DHCPProxyInterface; |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 20 | class Modem; |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 21 | class ModemCDMAProxyInterface; |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 22 | class ModemCDMAProxyListener; |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 23 | class ModemManager; |
| 24 | class ModemManagerProxyInterface; |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 25 | class ModemProxyInterface; |
Darin Petkov | e604f70 | 2011-07-28 15:51:17 -0700 | [diff] [blame] | 26 | class ModemSimpleProxyInterface; |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 27 | class SupplicantInterfaceProxyInterface; |
| 28 | class SupplicantProcessProxyInterface; |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 29 | |
| 30 | // Global DBus proxy factory that can be mocked out in tests. |
| 31 | class ProxyFactory { |
| 32 | public: |
| 33 | ProxyFactory(); |
| 34 | virtual ~ProxyFactory(); |
| 35 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 36 | void Init(); |
| 37 | |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 38 | virtual DBusPropertiesProxyInterface *CreateDBusPropertiesProxy( |
| 39 | Modem *modem, |
| 40 | const std::string &path, |
| 41 | const std::string &service); |
| 42 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 43 | virtual ModemManagerProxyInterface *CreateModemManagerProxy( |
| 44 | ModemManager *manager, |
| 45 | const std::string &path, |
| 46 | const std::string &service); |
| 47 | |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 48 | virtual ModemProxyInterface *CreateModemProxy(const std::string &path, |
| 49 | const std::string &service); |
| 50 | |
Darin Petkov | e604f70 | 2011-07-28 15:51:17 -0700 | [diff] [blame] | 51 | virtual ModemSimpleProxyInterface *CreateModemSimpleProxy( |
| 52 | const std::string &path, |
| 53 | const std::string &service); |
| 54 | |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 55 | virtual ModemCDMAProxyInterface *CreateModemCDMAProxy( |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 56 | ModemCDMAProxyListener *listener, |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 57 | const std::string &path, |
| 58 | const std::string &service); |
| 59 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 60 | virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy( |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 61 | const char *dbus_path, |
| 62 | const char *dbus_addr); |
| 63 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 64 | virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy( |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 65 | const WiFiRefPtr &wifi, |
| 66 | const DBus::Path &object_path, |
| 67 | const char *dbus_addr); |
| 68 | |
Darin Petkov | a7b8949 | 2011-07-27 12:48:17 -0700 | [diff] [blame] | 69 | virtual DHCPProxyInterface *CreateDHCPProxy(const std::string &service); |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 70 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 71 | static ProxyFactory *factory() { return factory_; } |
| 72 | static void set_factory(ProxyFactory *factory) { factory_ = factory; } |
| 73 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 74 | DBus::Connection *connection() { return connection_.get(); } |
| 75 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 76 | private: |
| 77 | static ProxyFactory *factory_; |
| 78 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 79 | scoped_ptr<DBus::Connection> connection_; |
| 80 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 81 | DISALLOW_COPY_AND_ASSIGN(ProxyFactory); |
| 82 | }; |
| 83 | |
| 84 | } // namespace shill |
| 85 | |
| 86 | #endif // SHILL_PROXY_FACTORY_ |