blob: 5ba9f73eb1f0b571f63a236e551ad72902c2d374 [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 Petkovc5f56562011-08-06 16:40:05 -070019class DBusPropertiesProxyListener;
Darin Petkovaceede32011-07-18 15:32:38 -070020class DHCPProxyInterface;
Darin Petkovbec79a22011-08-01 14:47:17 -070021class ModemCDMAProxyInterface;
Darin Petkovd9661952011-08-03 16:25:42 -070022class ModemCDMAProxyListener;
Darin Petkova1e0a1c2011-08-25 15:08:33 -070023class ModemGSMNetworkProxyInterface;
24class ModemGSMNetworkProxyListener;
Darin Petkovc90fe522011-07-15 13:59:47 -070025class ModemManager;
26class ModemManagerProxyInterface;
Darin Petkove9d12e02011-07-27 15:09:37 -070027class ModemProxyInterface;
Darin Petkovc5f56562011-08-06 16:40:05 -070028class ModemProxyListener;
Darin Petkove604f702011-07-28 15:51:17 -070029class ModemSimpleProxyInterface;
Darin Petkovd1967262011-07-18 14:55:18 -070030class SupplicantInterfaceProxyInterface;
31class SupplicantProcessProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070032
33// Global DBus proxy factory that can be mocked out in tests.
34class ProxyFactory {
35 public:
36 ProxyFactory();
37 virtual ~ProxyFactory();
38
Darin Petkovaceede32011-07-18 15:32:38 -070039 void Init();
40
Darin Petkov5c97ac52011-07-19 16:30:49 -070041 virtual DBusPropertiesProxyInterface *CreateDBusPropertiesProxy(
Darin Petkovc5f56562011-08-06 16:40:05 -070042 DBusPropertiesProxyListener *listener,
Darin Petkov5c97ac52011-07-19 16:30:49 -070043 const std::string &path,
44 const std::string &service);
45
Darin Petkovc90fe522011-07-15 13:59:47 -070046 virtual ModemManagerProxyInterface *CreateModemManagerProxy(
47 ModemManager *manager,
48 const std::string &path,
49 const std::string &service);
50
Darin Petkovc5f56562011-08-06 16:40:05 -070051 virtual ModemProxyInterface *CreateModemProxy(ModemProxyListener *listener,
52 const std::string &path,
Darin Petkove9d12e02011-07-27 15:09:37 -070053 const std::string &service);
54
Darin Petkove604f702011-07-28 15:51:17 -070055 virtual ModemSimpleProxyInterface *CreateModemSimpleProxy(
56 const std::string &path,
57 const std::string &service);
58
Darin Petkovbec79a22011-08-01 14:47:17 -070059 virtual ModemCDMAProxyInterface *CreateModemCDMAProxy(
Darin Petkovd9661952011-08-03 16:25:42 -070060 ModemCDMAProxyListener *listener,
Darin Petkovbec79a22011-08-01 14:47:17 -070061 const std::string &path,
62 const std::string &service);
63
Darin Petkova1e0a1c2011-08-25 15:08:33 -070064 virtual ModemGSMNetworkProxyInterface *CreateModemGSMNetworkProxy(
65 ModemGSMNetworkProxyListener *listener,
66 const std::string &path,
67 const std::string &service);
68
Darin Petkovaceede32011-07-18 15:32:38 -070069 virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070070 const char *dbus_path,
71 const char *dbus_addr);
72
Darin Petkovaceede32011-07-18 15:32:38 -070073 virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070074 const WiFiRefPtr &wifi,
75 const DBus::Path &object_path,
76 const char *dbus_addr);
77
Darin Petkova7b89492011-07-27 12:48:17 -070078 virtual DHCPProxyInterface *CreateDHCPProxy(const std::string &service);
Darin Petkovaceede32011-07-18 15:32:38 -070079
Darin Petkovc90fe522011-07-15 13:59:47 -070080 static ProxyFactory *factory() { return factory_; }
81 static void set_factory(ProxyFactory *factory) { factory_ = factory; }
82
Darin Petkovaceede32011-07-18 15:32:38 -070083 DBus::Connection *connection() { return connection_.get(); }
84
Darin Petkovc90fe522011-07-15 13:59:47 -070085 private:
86 static ProxyFactory *factory_;
87
Darin Petkovaceede32011-07-18 15:32:38 -070088 scoped_ptr<DBus::Connection> connection_;
89
Darin Petkovc90fe522011-07-15 13:59:47 -070090 DISALLOW_COPY_AND_ASSIGN(ProxyFactory);
91};
92
93} // namespace shill
94
95#endif // SHILL_PROXY_FACTORY_