blob: 6c1b0f48deec3079b617a8c7804b74797befadb3 [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 Petkovaceede32011-07-18 15:32:38 -070011#include <base/memory/scoped_ptr.h>
Darin Petkovd1967262011-07-18 14:55:18 -070012#include <dbus-c++/dbus.h>
13
14#include "shill/refptr_types.h"
Darin Petkovc90fe522011-07-15 13:59:47 -070015
16namespace shill {
17
Darin Petkov5c97ac52011-07-19 16:30:49 -070018class DBusPropertiesProxyInterface;
Darin Petkovaceede32011-07-18 15:32:38 -070019class DHCPProxyInterface;
Darin Petkov5c97ac52011-07-19 16:30:49 -070020class Modem;
Darin Petkovbec79a22011-08-01 14:47:17 -070021class ModemCDMAProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070022class ModemManager;
23class ModemManagerProxyInterface;
Darin Petkove9d12e02011-07-27 15:09:37 -070024class ModemProxyInterface;
Darin Petkove604f702011-07-28 15:51:17 -070025class ModemSimpleProxyInterface;
Darin Petkovd1967262011-07-18 14:55:18 -070026class SupplicantInterfaceProxyInterface;
27class SupplicantProcessProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070028
29// Global DBus proxy factory that can be mocked out in tests.
30class ProxyFactory {
31 public:
32 ProxyFactory();
33 virtual ~ProxyFactory();
34
Darin Petkovaceede32011-07-18 15:32:38 -070035 void Init();
36
Darin Petkov5c97ac52011-07-19 16:30:49 -070037 virtual DBusPropertiesProxyInterface *CreateDBusPropertiesProxy(
38 Modem *modem,
39 const std::string &path,
40 const std::string &service);
41
Darin Petkovc90fe522011-07-15 13:59:47 -070042 virtual ModemManagerProxyInterface *CreateModemManagerProxy(
43 ModemManager *manager,
44 const std::string &path,
45 const std::string &service);
46
Darin Petkove9d12e02011-07-27 15:09:37 -070047 virtual ModemProxyInterface *CreateModemProxy(const std::string &path,
48 const std::string &service);
49
Darin Petkove604f702011-07-28 15:51:17 -070050 virtual ModemSimpleProxyInterface *CreateModemSimpleProxy(
51 const std::string &path,
52 const std::string &service);
53
Darin Petkovbec79a22011-08-01 14:47:17 -070054 virtual ModemCDMAProxyInterface *CreateModemCDMAProxy(
55 const std::string &path,
56 const std::string &service);
57
Darin Petkovaceede32011-07-18 15:32:38 -070058 virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070059 const char *dbus_path,
60 const char *dbus_addr);
61
Darin Petkovaceede32011-07-18 15:32:38 -070062 virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070063 const WiFiRefPtr &wifi,
64 const DBus::Path &object_path,
65 const char *dbus_addr);
66
Darin Petkova7b89492011-07-27 12:48:17 -070067 virtual DHCPProxyInterface *CreateDHCPProxy(const std::string &service);
Darin Petkovaceede32011-07-18 15:32:38 -070068
Darin Petkovc90fe522011-07-15 13:59:47 -070069 static ProxyFactory *factory() { return factory_; }
70 static void set_factory(ProxyFactory *factory) { factory_ = factory; }
71
Darin Petkovaceede32011-07-18 15:32:38 -070072 DBus::Connection *connection() { return connection_.get(); }
73
Darin Petkovc90fe522011-07-15 13:59:47 -070074 private:
75 static ProxyFactory *factory_;
76
Darin Petkovaceede32011-07-18 15:32:38 -070077 scoped_ptr<DBus::Connection> connection_;
78
Darin Petkovc90fe522011-07-15 13:59:47 -070079 DISALLOW_COPY_AND_ASSIGN(ProxyFactory);
80};
81
82} // namespace shill
83
84#endif // SHILL_PROXY_FACTORY_