blob: 3799cc85f0a8f8c52df4e6c440fd24d42a0f0f45 [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 Petkovaceede32011-07-18 15:32:38 -070018class DHCPProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070019class ModemManager;
20class ModemManagerProxyInterface;
Darin Petkovd1967262011-07-18 14:55:18 -070021class SupplicantInterfaceProxyInterface;
22class SupplicantProcessProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070023
24// Global DBus proxy factory that can be mocked out in tests.
25class ProxyFactory {
26 public:
27 ProxyFactory();
28 virtual ~ProxyFactory();
29
Darin Petkovaceede32011-07-18 15:32:38 -070030 void Init();
31
Darin Petkovc90fe522011-07-15 13:59:47 -070032 virtual ModemManagerProxyInterface *CreateModemManagerProxy(
33 ModemManager *manager,
34 const std::string &path,
35 const std::string &service);
36
Darin Petkovaceede32011-07-18 15:32:38 -070037 virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070038 const char *dbus_path,
39 const char *dbus_addr);
40
Darin Petkovaceede32011-07-18 15:32:38 -070041 virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070042 const WiFiRefPtr &wifi,
43 const DBus::Path &object_path,
44 const char *dbus_addr);
45
Darin Petkovaceede32011-07-18 15:32:38 -070046 virtual DHCPProxyInterface *CreateDHCPProxy(const char *service);
47
Darin Petkovc90fe522011-07-15 13:59:47 -070048 static ProxyFactory *factory() { return factory_; }
49 static void set_factory(ProxyFactory *factory) { factory_ = factory; }
50
Darin Petkovaceede32011-07-18 15:32:38 -070051 DBus::Connection *connection() { return connection_.get(); }
52
Darin Petkovc90fe522011-07-15 13:59:47 -070053 private:
54 static ProxyFactory *factory_;
55
Darin Petkovaceede32011-07-18 15:32:38 -070056 scoped_ptr<DBus::Connection> connection_;
57
Darin Petkovc90fe522011-07-15 13:59:47 -070058 DISALLOW_COPY_AND_ASSIGN(ProxyFactory);
59};
60
61} // namespace shill
62
63#endif // SHILL_PROXY_FACTORY_