blob: 804dc77fae082a0cab7863a0ca3829d4dbc4626e [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 Petkovc90fe522011-07-15 13:59:47 -070021class ModemManager;
22class ModemManagerProxyInterface;
Darin Petkove9d12e02011-07-27 15:09:37 -070023class ModemProxyInterface;
Darin Petkovd1967262011-07-18 14:55:18 -070024class SupplicantInterfaceProxyInterface;
25class SupplicantProcessProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070026
27// Global DBus proxy factory that can be mocked out in tests.
28class ProxyFactory {
29 public:
30 ProxyFactory();
31 virtual ~ProxyFactory();
32
Darin Petkovaceede32011-07-18 15:32:38 -070033 void Init();
34
Darin Petkov5c97ac52011-07-19 16:30:49 -070035 virtual DBusPropertiesProxyInterface *CreateDBusPropertiesProxy(
36 Modem *modem,
37 const std::string &path,
38 const std::string &service);
39
Darin Petkovc90fe522011-07-15 13:59:47 -070040 virtual ModemManagerProxyInterface *CreateModemManagerProxy(
41 ModemManager *manager,
42 const std::string &path,
43 const std::string &service);
44
Darin Petkove9d12e02011-07-27 15:09:37 -070045 virtual ModemProxyInterface *CreateModemProxy(const std::string &path,
46 const std::string &service);
47
Darin Petkovaceede32011-07-18 15:32:38 -070048 virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070049 const char *dbus_path,
50 const char *dbus_addr);
51
Darin Petkovaceede32011-07-18 15:32:38 -070052 virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070053 const WiFiRefPtr &wifi,
54 const DBus::Path &object_path,
55 const char *dbus_addr);
56
Darin Petkova7b89492011-07-27 12:48:17 -070057 virtual DHCPProxyInterface *CreateDHCPProxy(const std::string &service);
Darin Petkovaceede32011-07-18 15:32:38 -070058
Darin Petkovc90fe522011-07-15 13:59:47 -070059 static ProxyFactory *factory() { return factory_; }
60 static void set_factory(ProxyFactory *factory) { factory_ = factory; }
61
Darin Petkovaceede32011-07-18 15:32:38 -070062 DBus::Connection *connection() { return connection_.get(); }
63
Darin Petkovc90fe522011-07-15 13:59:47 -070064 private:
65 static ProxyFactory *factory_;
66
Darin Petkovaceede32011-07-18 15:32:38 -070067 scoped_ptr<DBus::Connection> connection_;
68
Darin Petkovc90fe522011-07-15 13:59:47 -070069 DISALLOW_COPY_AND_ASSIGN(ProxyFactory);
70};
71
72} // namespace shill
73
74#endif // SHILL_PROXY_FACTORY_