blob: 90721a299561c6413163e7332eb8a857dae2652f [file] [log] [blame]
mukesh agrawalaf571952011-07-14 14:31:12 -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
Darin Petkovef34f182011-08-26 14:14:40 -07005#include "shill/supplicant_process_proxy.h"
mukesh agrawalaf571952011-07-14 14:31:12 -07006
7#include <map>
8#include <string>
9
10#include <base/logging.h>
11#include <dbus-c++/dbus.h>
12
Gary Morain610977f2012-05-04 16:03:52 -070013#include "shill/dbus_properties.h"
mukesh agrawal06175d72012-04-23 16:46:01 -070014#include "shill/scope_logger.h"
15
mukesh agrawalaf571952011-07-14 14:31:12 -070016using std::map;
17using std::string;
18
19namespace shill {
20
Darin Petkovaceede32011-07-18 15:32:38 -070021SupplicantProcessProxy::SupplicantProcessProxy(DBus::Connection *bus,
22 const char *dbus_path,
23 const char *dbus_addr)
24 : proxy_(bus, dbus_path, dbus_addr) {}
mukesh agrawalaf571952011-07-14 14:31:12 -070025
26SupplicantProcessProxy::~SupplicantProcessProxy() {}
27
28::DBus::Path SupplicantProcessProxy::CreateInterface(
29 const map<string, ::DBus::Variant> &args) {
mukesh agrawal06175d72012-04-23 16:46:01 -070030 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -070031 try {
32 return proxy_.CreateInterface(args);
33 } catch (const DBus::Error &e) {
Gary Morainba919ac2012-05-08 11:30:20 -070034 LOG(ERROR) << "DBus exception: " << e.name() << ": " << e.what()
Gary Morain610977f2012-05-04 16:03:52 -070035 << " args keys are: " << DBusProperties::KeysToString(args);
Gary Morainba919ac2012-05-08 11:30:20 -070036 throw; // Re-throw the exception.
Gary Morain610977f2012-05-04 16:03:52 -070037 }
mukesh agrawalaf571952011-07-14 14:31:12 -070038}
39
40void SupplicantProcessProxy::RemoveInterface(const ::DBus::Path &path) {
mukesh agrawal06175d72012-04-23 16:46:01 -070041 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -070042 try {
43 return proxy_.RemoveInterface(path);
44 } catch (const DBus::Error &e) {
45 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
46 }
mukesh agrawalaf571952011-07-14 14:31:12 -070047}
48
49::DBus::Path SupplicantProcessProxy::GetInterface(const string &ifname) {
mukesh agrawal06175d72012-04-23 16:46:01 -070050 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -070051 try {
52 return proxy_.GetInterface(ifname);
53 } catch (const DBus::Error &e) {
54 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what()
55 << " ifname: " << ifname;
56 return ::DBus::Path(); // Make the compiler happy.
57 }
mukesh agrawalaf571952011-07-14 14:31:12 -070058}
59
60// definitions for private class SupplicantProcessProxy::Proxy
61
62SupplicantProcessProxy::Proxy::Proxy(
63 DBus::Connection *bus, const char *dbus_path, const char *dbus_addr)
64 : DBus::ObjectProxy(*bus, dbus_path, dbus_addr) {}
65
66SupplicantProcessProxy::Proxy::~Proxy() {}
67
68void SupplicantProcessProxy::Proxy::InterfaceAdded(
mukesh agrawal1830fa12011-09-26 14:31:40 -070069 const ::DBus::Path& /*path*/,
70 const map<string, ::DBus::Variant> &/*properties*/) {
mukesh agrawal06175d72012-04-23 16:46:01 -070071 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -070072 // XXX
73}
74
75void SupplicantProcessProxy::Proxy::InterfaceRemoved(
mukesh agrawal1830fa12011-09-26 14:31:40 -070076 const ::DBus::Path& /*path*/) {
mukesh agrawal06175d72012-04-23 16:46:01 -070077 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -070078 // XXX
79}
80
81void SupplicantProcessProxy::Proxy::PropertiesChanged(
mukesh agrawal1830fa12011-09-26 14:31:40 -070082 const map<string, ::DBus::Variant>& /*properties*/) {
mukesh agrawal06175d72012-04-23 16:46:01 -070083 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -070084 // XXX
85}
86
87} // namespace shill