blob: f7435548cb0f92e4980bc5d0ba1cd50e455630da [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 Petkovab565bb2011-10-06 02:55:51 -070011#include <base/lazy_instance.h>
Darin Petkovaceede32011-07-18 15:32:38 -070012#include <base/memory/scoped_ptr.h>
Darin Petkovd1967262011-07-18 14:55:18 -070013#include <dbus-c++/dbus.h>
14
15#include "shill/refptr_types.h"
Darin Petkovc90fe522011-07-15 13:59:47 -070016
17namespace shill {
18
Darin Petkov580c7af2011-10-24 12:32:50 +020019class DBusPropertiesProxyDelegate;
Darin Petkov5c97ac52011-07-19 16:30:49 -070020class DBusPropertiesProxyInterface;
Darin Petkovaceede32011-07-18 15:32:38 -070021class DHCPProxyInterface;
Darin Petkov580c7af2011-10-24 12:32:50 +020022class ModemCDMAProxyDelegate;
Darin Petkovbec79a22011-08-01 14:47:17 -070023class ModemCDMAProxyInterface;
Darin Petkov580c7af2011-10-24 12:32:50 +020024class ModemGSMCardProxyDelegate;
Darin Petkov975b5e72011-08-30 11:48:08 -070025class ModemGSMCardProxyInterface;
Darin Petkov580c7af2011-10-24 12:32:50 +020026class ModemGSMNetworkProxyDelegate;
Darin Petkova1e0a1c2011-08-25 15:08:33 -070027class ModemGSMNetworkProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070028class ModemManager;
29class ModemManagerProxyInterface;
Darin Petkov580c7af2011-10-24 12:32:50 +020030class ModemProxyDelegate;
Darin Petkove9d12e02011-07-27 15:09:37 -070031class ModemProxyInterface;
Darin Petkove604f702011-07-28 15:51:17 -070032class ModemSimpleProxyInterface;
Darin Petkovd1967262011-07-18 14:55:18 -070033class SupplicantInterfaceProxyInterface;
34class SupplicantProcessProxyInterface;
Darin Petkovc90fe522011-07-15 13:59:47 -070035
36// Global DBus proxy factory that can be mocked out in tests.
37class ProxyFactory {
38 public:
Darin Petkovc90fe522011-07-15 13:59:47 -070039 virtual ~ProxyFactory();
40
Darin Petkovab565bb2011-10-06 02:55:51 -070041 // Since this is a singleton, use ProxyFactory::GetInstance()->Foo()
42 static ProxyFactory *GetInstance();
43
Darin Petkovaceede32011-07-18 15:32:38 -070044 void Init();
45
Darin Petkov5c97ac52011-07-19 16:30:49 -070046 virtual DBusPropertiesProxyInterface *CreateDBusPropertiesProxy(
Darin Petkov580c7af2011-10-24 12:32:50 +020047 DBusPropertiesProxyDelegate *delegate,
Darin Petkov5c97ac52011-07-19 16:30:49 -070048 const std::string &path,
49 const std::string &service);
50
Darin Petkovc90fe522011-07-15 13:59:47 -070051 virtual ModemManagerProxyInterface *CreateModemManagerProxy(
52 ModemManager *manager,
53 const std::string &path,
54 const std::string &service);
55
Darin Petkov580c7af2011-10-24 12:32:50 +020056 virtual ModemProxyInterface *CreateModemProxy(ModemProxyDelegate *delegate,
Darin Petkovc5f56562011-08-06 16:40:05 -070057 const std::string &path,
Darin Petkove9d12e02011-07-27 15:09:37 -070058 const std::string &service);
59
Darin Petkove604f702011-07-28 15:51:17 -070060 virtual ModemSimpleProxyInterface *CreateModemSimpleProxy(
61 const std::string &path,
62 const std::string &service);
63
Darin Petkovbec79a22011-08-01 14:47:17 -070064 virtual ModemCDMAProxyInterface *CreateModemCDMAProxy(
Darin Petkov580c7af2011-10-24 12:32:50 +020065 ModemCDMAProxyDelegate *delegate,
Darin Petkovbec79a22011-08-01 14:47:17 -070066 const std::string &path,
67 const std::string &service);
68
Darin Petkov975b5e72011-08-30 11:48:08 -070069 virtual ModemGSMCardProxyInterface *CreateModemGSMCardProxy(
Darin Petkov580c7af2011-10-24 12:32:50 +020070 ModemGSMCardProxyDelegate *delegate,
Darin Petkov975b5e72011-08-30 11:48:08 -070071 const std::string &path,
72 const std::string &service);
73
Darin Petkova1e0a1c2011-08-25 15:08:33 -070074 virtual ModemGSMNetworkProxyInterface *CreateModemGSMNetworkProxy(
Darin Petkov580c7af2011-10-24 12:32:50 +020075 ModemGSMNetworkProxyDelegate *delegate,
Darin Petkova1e0a1c2011-08-25 15:08:33 -070076 const std::string &path,
77 const std::string &service);
78
Darin Petkovaceede32011-07-18 15:32:38 -070079 virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070080 const char *dbus_path,
81 const char *dbus_addr);
82
Darin Petkovaceede32011-07-18 15:32:38 -070083 virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070084 const WiFiRefPtr &wifi,
85 const DBus::Path &object_path,
86 const char *dbus_addr);
87
Darin Petkova7b89492011-07-27 12:48:17 -070088 virtual DHCPProxyInterface *CreateDHCPProxy(const std::string &service);
Darin Petkovaceede32011-07-18 15:32:38 -070089
Darin Petkovab565bb2011-10-06 02:55:51 -070090 DBus::Connection *connection() const { return connection_.get(); }
Darin Petkovc90fe522011-07-15 13:59:47 -070091
Darin Petkovab565bb2011-10-06 02:55:51 -070092 protected:
93 ProxyFactory();
Darin Petkovaceede32011-07-18 15:32:38 -070094
Darin Petkovc90fe522011-07-15 13:59:47 -070095 private:
Darin Petkovab565bb2011-10-06 02:55:51 -070096 friend struct base::DefaultLazyInstanceTraits<ProxyFactory>;
Darin Petkovc90fe522011-07-15 13:59:47 -070097
Darin Petkovaceede32011-07-18 15:32:38 -070098 scoped_ptr<DBus::Connection> connection_;
99
Darin Petkovc90fe522011-07-15 13:59:47 -0700100 DISALLOW_COPY_AND_ASSIGN(ProxyFactory);
101};
102
103} // namespace shill
104
105#endif // SHILL_PROXY_FACTORY_