blob: 908b6999c8ca47a48c4f4376709be6e59a44cd22 [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 Petkove604f702011-07-28 15:51:17 -070024class ModemSimpleProxyInterface;
Darin Petkovd1967262011-07-18 14:55:18 -070025class SupplicantInterfaceProxyInterface;
26class SupplicantProcessProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070027
28// Global DBus proxy factory that can be mocked out in tests.
29class ProxyFactory {
30 public:
31 ProxyFactory();
32 virtual ~ProxyFactory();
33
Darin Petkovaceede32011-07-18 15:32:38 -070034 void Init();
35
Darin Petkov5c97ac52011-07-19 16:30:49 -070036 virtual DBusPropertiesProxyInterface *CreateDBusPropertiesProxy(
37 Modem *modem,
38 const std::string &path,
39 const std::string &service);
40
Darin Petkovc90fe522011-07-15 13:59:47 -070041 virtual ModemManagerProxyInterface *CreateModemManagerProxy(
42 ModemManager *manager,
43 const std::string &path,
44 const std::string &service);
45
Darin Petkove9d12e02011-07-27 15:09:37 -070046 virtual ModemProxyInterface *CreateModemProxy(const std::string &path,
47 const std::string &service);
48
Darin Petkove604f702011-07-28 15:51:17 -070049 virtual ModemSimpleProxyInterface *CreateModemSimpleProxy(
50 const std::string &path,
51 const std::string &service);
52
Darin Petkovaceede32011-07-18 15:32:38 -070053 virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070054 const char *dbus_path,
55 const char *dbus_addr);
56
Darin Petkovaceede32011-07-18 15:32:38 -070057 virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070058 const WiFiRefPtr &wifi,
59 const DBus::Path &object_path,
60 const char *dbus_addr);
61
Darin Petkova7b89492011-07-27 12:48:17 -070062 virtual DHCPProxyInterface *CreateDHCPProxy(const std::string &service);
Darin Petkovaceede32011-07-18 15:32:38 -070063
Darin Petkovc90fe522011-07-15 13:59:47 -070064 static ProxyFactory *factory() { return factory_; }
65 static void set_factory(ProxyFactory *factory) { factory_ = factory; }
66
Darin Petkovaceede32011-07-18 15:32:38 -070067 DBus::Connection *connection() { return connection_.get(); }
68
Darin Petkovc90fe522011-07-15 13:59:47 -070069 private:
70 static ProxyFactory *factory_;
71
Darin Petkovaceede32011-07-18 15:32:38 -070072 scoped_ptr<DBus::Connection> connection_;
73
Darin Petkovc90fe522011-07-15 13:59:47 -070074 DISALLOW_COPY_AND_ASSIGN(ProxyFactory);
75};
76
77} // namespace shill
78
79#endif // SHILL_PROXY_FACTORY_