blob: d93499c33a87adff45bbaa6349fb7776d371b10f [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
mukesh agrawalaf571952011-07-14 14:31:12 -070010#include <dbus-c++/dbus.h>
11
Gary Morain610977f2012-05-04 16:03:52 -070012#include "shill/dbus_properties.h"
Christopher Wileyb691efd2012-08-09 13:51:51 -070013#include "shill/logging.h"
mukesh agrawal06175d72012-04-23 16:46:01 -070014
mukesh agrawalaf571952011-07-14 14:31:12 -070015using std::map;
16using std::string;
17
18namespace shill {
19
Darin Petkovaceede32011-07-18 15:32:38 -070020SupplicantProcessProxy::SupplicantProcessProxy(DBus::Connection *bus,
21 const char *dbus_path,
22 const char *dbus_addr)
23 : proxy_(bus, dbus_path, dbus_addr) {}
mukesh agrawalaf571952011-07-14 14:31:12 -070024
25SupplicantProcessProxy::~SupplicantProcessProxy() {}
26
27::DBus::Path SupplicantProcessProxy::CreateInterface(
28 const map<string, ::DBus::Variant> &args) {
mukesh agrawal06175d72012-04-23 16:46:01 -070029 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -070030 try {
31 return proxy_.CreateInterface(args);
32 } catch (const DBus::Error &e) {
Gary Morainba919ac2012-05-08 11:30:20 -070033 LOG(ERROR) << "DBus exception: " << e.name() << ": " << e.what()
Gary Morain610977f2012-05-04 16:03:52 -070034 << " args keys are: " << DBusProperties::KeysToString(args);
Gary Morainba919ac2012-05-08 11:30:20 -070035 throw; // Re-throw the exception.
Gary Morain610977f2012-05-04 16:03:52 -070036 }
mukesh agrawalaf571952011-07-14 14:31:12 -070037}
38
39void SupplicantProcessProxy::RemoveInterface(const ::DBus::Path &path) {
mukesh agrawal06175d72012-04-23 16:46:01 -070040 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -070041 try {
42 return proxy_.RemoveInterface(path);
43 } catch (const DBus::Error &e) {
44 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
45 }
mukesh agrawalaf571952011-07-14 14:31:12 -070046}
47
48::DBus::Path SupplicantProcessProxy::GetInterface(const string &ifname) {
mukesh agrawal06175d72012-04-23 16:46:01 -070049 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -070050 try {
51 return proxy_.GetInterface(ifname);
52 } catch (const DBus::Error &e) {
53 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what()
54 << " ifname: " << ifname;
55 return ::DBus::Path(); // Make the compiler happy.
56 }
mukesh agrawalaf571952011-07-14 14:31:12 -070057}
58
59// definitions for private class SupplicantProcessProxy::Proxy
60
61SupplicantProcessProxy::Proxy::Proxy(
62 DBus::Connection *bus, const char *dbus_path, const char *dbus_addr)
63 : DBus::ObjectProxy(*bus, dbus_path, dbus_addr) {}
64
65SupplicantProcessProxy::Proxy::~Proxy() {}
66
67void SupplicantProcessProxy::Proxy::InterfaceAdded(
mukesh agrawal1830fa12011-09-26 14:31:40 -070068 const ::DBus::Path& /*path*/,
69 const map<string, ::DBus::Variant> &/*properties*/) {
mukesh agrawal06175d72012-04-23 16:46:01 -070070 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -070071 // XXX
72}
73
74void SupplicantProcessProxy::Proxy::InterfaceRemoved(
mukesh agrawal1830fa12011-09-26 14:31:40 -070075 const ::DBus::Path& /*path*/) {
mukesh agrawal06175d72012-04-23 16:46:01 -070076 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -070077 // XXX
78}
79
80void SupplicantProcessProxy::Proxy::PropertiesChanged(
mukesh agrawal1830fa12011-09-26 14:31:40 -070081 const map<string, ::DBus::Variant>& /*properties*/) {
mukesh agrawal06175d72012-04-23 16:46:01 -070082 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -070083 // XXX
84}
85
86} // namespace shill