blob: a5633f94fb0fd16f91700ad91b82508fe29b8504 [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#include "shill/proxy_factory.h"
6
Darin Petkovaceede32011-07-18 15:32:38 -07007#include <base/logging.h>
8
Darin Petkov5c97ac52011-07-19 16:30:49 -07009#include "shill/dbus_properties_proxy.h"
Darin Petkovaceede32011-07-18 15:32:38 -070010#include "shill/dhcpcd_proxy.h"
Darin Petkovc90fe522011-07-15 13:59:47 -070011#include "shill/modem_manager_proxy.h"
Darin Petkovd1967262011-07-18 14:55:18 -070012#include "shill/supplicant_interface_proxy.h"
13#include "shill/supplicant_process_proxy.h"
Darin Petkovc90fe522011-07-15 13:59:47 -070014
Darin Petkov5c97ac52011-07-19 16:30:49 -070015using std::string;
16
Darin Petkovc90fe522011-07-15 13:59:47 -070017namespace shill {
18
19ProxyFactory *ProxyFactory::factory_ = NULL;
20
21ProxyFactory::ProxyFactory() {}
22
23ProxyFactory::~ProxyFactory() {}
24
Darin Petkovaceede32011-07-18 15:32:38 -070025void ProxyFactory::Init() {
26 CHECK(DBus::default_dispatcher); // Initialized in DBusControl::Init.
27 CHECK(!connection_.get());
28 connection_.reset(new DBus::Connection(DBus::Connection::SystemBus()));
29}
30
Darin Petkov5c97ac52011-07-19 16:30:49 -070031DBusPropertiesProxyInterface *ProxyFactory::CreateDBusPropertiesProxy(
32 Modem *modem,
33 const string &path,
34 const string &service) {
35 return new DBusPropertiesProxy(connection(), modem, path, service);
36}
37
Darin Petkovc90fe522011-07-15 13:59:47 -070038ModemManagerProxyInterface *ProxyFactory::CreateModemManagerProxy(
39 ModemManager *manager,
Darin Petkov5c97ac52011-07-19 16:30:49 -070040 const string &path,
41 const string &service) {
Darin Petkovaceede32011-07-18 15:32:38 -070042 return new ModemManagerProxy(connection(), manager, path, service);
Darin Petkovc90fe522011-07-15 13:59:47 -070043}
44
Darin Petkovaceede32011-07-18 15:32:38 -070045SupplicantProcessProxyInterface *ProxyFactory::CreateSupplicantProcessProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070046 const char *dbus_path,
47 const char *dbus_addr) {
Darin Petkovaceede32011-07-18 15:32:38 -070048 return new SupplicantProcessProxy(connection(), dbus_path, dbus_addr);
Darin Petkovd1967262011-07-18 14:55:18 -070049}
50
Darin Petkovaceede32011-07-18 15:32:38 -070051SupplicantInterfaceProxyInterface *ProxyFactory::CreateSupplicantInterfaceProxy(
Darin Petkovd1967262011-07-18 14:55:18 -070052 const WiFiRefPtr &wifi,
53 const DBus::Path &object_path,
54 const char *dbus_addr) {
Darin Petkovaceede32011-07-18 15:32:38 -070055 return new SupplicantInterfaceProxy(wifi,
56 connection(),
57 object_path,
58 dbus_addr);
59}
60
61DHCPProxyInterface *ProxyFactory::CreateDHCPProxy(const char *service) {
62 return new DHCPCDProxy(connection(), service);
Darin Petkovd1967262011-07-18 14:55:18 -070063}
64
Darin Petkovc90fe522011-07-15 13:59:47 -070065} // namespace shill