blob: 6205c7703848b7c76b1d992b3763dfa63fd4901d [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 Petkov975b5e72011-08-30 11:48:08 -070023class ModemGSMCardProxyInterface;
24class ModemGSMCardProxyListener;
Darin Petkova1e0a1c2011-08-25 15:08:33 -070025class ModemGSMNetworkProxyInterface;
26class ModemGSMNetworkProxyListener;
Darin Petkovc90fe522011-07-15 13:59:47 -070027class ModemManager;
28class ModemManagerProxyInterface;
Darin Petkove9d12e02011-07-27 15:09:37 -070029class ModemProxyInterface;
Darin Petkovc5f56562011-08-06 16:40:05 -070030class ModemProxyListener;
Darin Petkove604f702011-07-28 15:51:17 -070031class ModemSimpleProxyInterface;
Darin Petkovd1967262011-07-18 14:55:18 -070032class SupplicantInterfaceProxyInterface;
33class SupplicantProcessProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070034
35// Global DBus proxy factory that can be mocked out in tests.
36class ProxyFactory {
37 public:
38 ProxyFactory();
39 virtual ~ProxyFactory();
40
Darin Petkovaceede32011-07-18 15:32:38 -070041 void Init();
42
Darin Petkov5c97ac52011-07-19 16:30:49 -070043 virtual DBusPropertiesProxyInterface *CreateDBusPropertiesProxy(
Darin Petkovc5f56562011-08-06 16:40:05 -070044 DBusPropertiesProxyListener *listener,
Darin Petkov5c97ac52011-07-19 16:30:49 -070045 const std::string &path,
46 const std::string &service);
47
Darin Petkovc90fe522011-07-15 13:59:47 -070048 virtual ModemManagerProxyInterface *CreateModemManagerProxy(
49 ModemManager *manager,
50 const std::string &path,
51 const std::string &service);
52
Darin Petkovc5f56562011-08-06 16:40:05 -070053 virtual ModemProxyInterface *CreateModemProxy(ModemProxyListener *listener,
54 const std::string &path,
Darin Petkove9d12e02011-07-27 15:09:37 -070055 const std::string &service);
56
Darin Petkove604f702011-07-28 15:51:17 -070057 virtual ModemSimpleProxyInterface *CreateModemSimpleProxy(
58 const std::string &path,
59 const std::string &service);
60
Darin Petkovbec79a22011-08-01 14:47:17 -070061 virtual ModemCDMAProxyInterface *CreateModemCDMAProxy(
Darin Petkovd9661952011-08-03 16:25:42 -070062 ModemCDMAProxyListener *listener,
Darin Petkovbec79a22011-08-01 14:47:17 -070063 const std::string &path,
64 const std::string &service);
65
Darin Petkov975b5e72011-08-30 11:48:08 -070066 virtual ModemGSMCardProxyInterface *CreateModemGSMCardProxy(
67 ModemGSMCardProxyListener *listener,
68 const std::string &path,
69 const std::string &service);
70
Darin Petkova1e0a1c2011-08-25 15:08:33 -070071 virtual ModemGSMNetworkProxyInterface *CreateModemGSMNetworkProxy(
72 ModemGSMNetworkProxyListener *listener,
73 const std::string &path,
74 const std::string &service);
75
Darin Petkovaceede32011-07-18 15:32:38 -070076 virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070077 const char *dbus_path,
78 const char *dbus_addr);
79
Darin Petkovaceede32011-07-18 15:32:38 -070080 virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070081 const WiFiRefPtr &wifi,
82 const DBus::Path &object_path,
83 const char *dbus_addr);
84
Darin Petkova7b89492011-07-27 12:48:17 -070085 virtual DHCPProxyInterface *CreateDHCPProxy(const std::string &service);
Darin Petkovaceede32011-07-18 15:32:38 -070086
Darin Petkovc90fe522011-07-15 13:59:47 -070087 static ProxyFactory *factory() { return factory_; }
88 static void set_factory(ProxyFactory *factory) { factory_ = factory; }
89
Darin Petkovaceede32011-07-18 15:32:38 -070090 DBus::Connection *connection() { return connection_.get(); }
91
Darin Petkovc90fe522011-07-15 13:59:47 -070092 private:
93 static ProxyFactory *factory_;
94
Darin Petkovaceede32011-07-18 15:32:38 -070095 scoped_ptr<DBus::Connection> connection_;
96
Darin Petkovc90fe522011-07-15 13:59:47 -070097 DISALLOW_COPY_AND_ASSIGN(ProxyFactory);
98};
99
100} // namespace shill
101
102#endif // SHILL_PROXY_FACTORY_