blob: 0fc1cbd0e67ac3d3b5b14533038e65bba24f1e62 [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 Petkovbec79a22011-08-01 14:47:17 -070021class ModemCDMAProxyInterface;
Darin Petkovd9661952011-08-03 16:25:42 -070022class ModemCDMAProxyListener;
Darin Petkovc90fe522011-07-15 13:59:47 -070023class ModemManager;
24class ModemManagerProxyInterface;
Darin Petkove9d12e02011-07-27 15:09:37 -070025class ModemProxyInterface;
Darin Petkove604f702011-07-28 15:51:17 -070026class ModemSimpleProxyInterface;
Darin Petkovd1967262011-07-18 14:55:18 -070027class SupplicantInterfaceProxyInterface;
28class SupplicantProcessProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070029
30// Global DBus proxy factory that can be mocked out in tests.
31class ProxyFactory {
32 public:
33 ProxyFactory();
34 virtual ~ProxyFactory();
35
Darin Petkovaceede32011-07-18 15:32:38 -070036 void Init();
37
Darin Petkov5c97ac52011-07-19 16:30:49 -070038 virtual DBusPropertiesProxyInterface *CreateDBusPropertiesProxy(
39 Modem *modem,
40 const std::string &path,
41 const std::string &service);
42
Darin Petkovc90fe522011-07-15 13:59:47 -070043 virtual ModemManagerProxyInterface *CreateModemManagerProxy(
44 ModemManager *manager,
45 const std::string &path,
46 const std::string &service);
47
Darin Petkove9d12e02011-07-27 15:09:37 -070048 virtual ModemProxyInterface *CreateModemProxy(const std::string &path,
49 const std::string &service);
50
Darin Petkove604f702011-07-28 15:51:17 -070051 virtual ModemSimpleProxyInterface *CreateModemSimpleProxy(
52 const std::string &path,
53 const std::string &service);
54
Darin Petkovbec79a22011-08-01 14:47:17 -070055 virtual ModemCDMAProxyInterface *CreateModemCDMAProxy(
Darin Petkovd9661952011-08-03 16:25:42 -070056 ModemCDMAProxyListener *listener,
Darin Petkovbec79a22011-08-01 14:47:17 -070057 const std::string &path,
58 const std::string &service);
59
Darin Petkovaceede32011-07-18 15:32:38 -070060 virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070061 const char *dbus_path,
62 const char *dbus_addr);
63
Darin Petkovaceede32011-07-18 15:32:38 -070064 virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070065 const WiFiRefPtr &wifi,
66 const DBus::Path &object_path,
67 const char *dbus_addr);
68
Darin Petkova7b89492011-07-27 12:48:17 -070069 virtual DHCPProxyInterface *CreateDHCPProxy(const std::string &service);
Darin Petkovaceede32011-07-18 15:32:38 -070070
Darin Petkovc90fe522011-07-15 13:59:47 -070071 static ProxyFactory *factory() { return factory_; }
72 static void set_factory(ProxyFactory *factory) { factory_ = factory; }
73
Darin Petkovaceede32011-07-18 15:32:38 -070074 DBus::Connection *connection() { return connection_.get(); }
75
Darin Petkovc90fe522011-07-15 13:59:47 -070076 private:
77 static ProxyFactory *factory_;
78
Darin Petkovaceede32011-07-18 15:32:38 -070079 scoped_ptr<DBus::Connection> connection_;
80
Darin Petkovc90fe522011-07-15 13:59:47 -070081 DISALLOW_COPY_AND_ASSIGN(ProxyFactory);
82};
83
84} // namespace shill
85
86#endif // SHILL_PROXY_FACTORY_