blob: f3441ab06ef2c2d71900d0b14418788b7df48f76 [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 Petkovd1967262011-07-18 14:55:18 -070023class SupplicantInterfaceProxyInterface;
24class SupplicantProcessProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070025
26// Global DBus proxy factory that can be mocked out in tests.
27class ProxyFactory {
28 public:
29 ProxyFactory();
30 virtual ~ProxyFactory();
31
Darin Petkovaceede32011-07-18 15:32:38 -070032 void Init();
33
Darin Petkov5c97ac52011-07-19 16:30:49 -070034 virtual DBusPropertiesProxyInterface *CreateDBusPropertiesProxy(
35 Modem *modem,
36 const std::string &path,
37 const std::string &service);
38
Darin Petkovc90fe522011-07-15 13:59:47 -070039 virtual ModemManagerProxyInterface *CreateModemManagerProxy(
40 ModemManager *manager,
41 const std::string &path,
42 const std::string &service);
43
Darin Petkovaceede32011-07-18 15:32:38 -070044 virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070045 const char *dbus_path,
46 const char *dbus_addr);
47
Darin Petkovaceede32011-07-18 15:32:38 -070048 virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070049 const WiFiRefPtr &wifi,
50 const DBus::Path &object_path,
51 const char *dbus_addr);
52
Darin Petkova7b89492011-07-27 12:48:17 -070053 virtual DHCPProxyInterface *CreateDHCPProxy(const std::string &service);
Darin Petkovaceede32011-07-18 15:32:38 -070054
Darin Petkovc90fe522011-07-15 13:59:47 -070055 static ProxyFactory *factory() { return factory_; }
56 static void set_factory(ProxyFactory *factory) { factory_ = factory; }
57
Darin Petkovaceede32011-07-18 15:32:38 -070058 DBus::Connection *connection() { return connection_.get(); }
59
Darin Petkovc90fe522011-07-15 13:59:47 -070060 private:
61 static ProxyFactory *factory_;
62
Darin Petkovaceede32011-07-18 15:32:38 -070063 scoped_ptr<DBus::Connection> connection_;
64
Darin Petkovc90fe522011-07-15 13:59:47 -070065 DISALLOW_COPY_AND_ASSIGN(ProxyFactory);
66};
67
68} // namespace shill
69
70#endif // SHILL_PROXY_FACTORY_