mukesh agrawal | 8a3188d | 2011-12-01 20:56:44 +0000 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 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/supplicant_interface_proxy.h" |
| 6 | |
| 7 | #include <map> |
| 8 | #include <string> |
| 9 | |
| 10 | #include <base/logging.h> |
| 11 | #include <dbus-c++/dbus.h> |
| 12 | |
| 13 | #include "shill/wifi.h" |
| 14 | |
| 15 | using std::map; |
| 16 | using std::string; |
| 17 | |
| 18 | namespace shill { |
| 19 | |
| 20 | SupplicantInterfaceProxy::SupplicantInterfaceProxy( |
| 21 | const WiFiRefPtr &wifi, |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 22 | DBus::Connection *bus, |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 23 | const ::DBus::Path &object_path, |
| 24 | const char *dbus_addr) |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 25 | : proxy_(wifi, bus, object_path, dbus_addr) {} |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 26 | |
| 27 | SupplicantInterfaceProxy::~SupplicantInterfaceProxy() {} |
| 28 | |
| 29 | ::DBus::Path SupplicantInterfaceProxy::AddNetwork( |
| 30 | const std::map<std::string, ::DBus::Variant> &args) { |
| 31 | return proxy_.AddNetwork(args); |
| 32 | } |
| 33 | |
Paul Stewart | 66c8600 | 2012-01-30 18:00:52 -0800 | [diff] [blame] | 34 | void SupplicantInterfaceProxy::ClearCachedCredentials() { |
| 35 | return proxy_.ClearCachedCredentials(); |
| 36 | } |
| 37 | |
mukesh agrawal | 0ed0f2e | 2011-12-05 20:36:17 +0000 | [diff] [blame] | 38 | void SupplicantInterfaceProxy::Disconnect() { |
| 39 | return proxy_.Disconnect(); |
| 40 | } |
| 41 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 42 | void SupplicantInterfaceProxy::FlushBSS(const uint32_t &age) { |
| 43 | return proxy_.FlushBSS(age); |
| 44 | } |
| 45 | |
| 46 | void SupplicantInterfaceProxy::RemoveAllNetworks() { |
| 47 | return proxy_.RemoveAllNetworks(); |
| 48 | } |
| 49 | |
mukesh agrawal | 1590839 | 2011-11-16 18:29:25 +0000 | [diff] [blame] | 50 | void SupplicantInterfaceProxy::RemoveNetwork(const ::DBus::Path &network) { |
| 51 | return proxy_.RemoveNetwork(network); |
| 52 | } |
| 53 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 54 | void SupplicantInterfaceProxy::Scan( |
| 55 | const std::map<std::string, ::DBus::Variant> &args) { |
| 56 | return proxy_.Scan(args); |
| 57 | } |
| 58 | |
| 59 | void SupplicantInterfaceProxy::SelectNetwork(const ::DBus::Path &network) { |
| 60 | return proxy_.SelectNetwork(network); |
| 61 | } |
| 62 | |
Paul Stewart | 2987dcf | 2012-01-30 15:47:42 -0800 | [diff] [blame] | 63 | void SupplicantInterfaceProxy::SetFastReauth(bool enabled) { |
| 64 | return proxy_.FastReauth(enabled); |
| 65 | } |
| 66 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 67 | // definitions for private class SupplicantInterfaceProxy::Proxy |
| 68 | |
| 69 | SupplicantInterfaceProxy::Proxy::Proxy( |
| 70 | const WiFiRefPtr &wifi, DBus::Connection *bus, |
| 71 | const DBus::Path &dbus_path, const char *dbus_addr) |
| 72 | : DBus::ObjectProxy(*bus, dbus_path, dbus_addr), |
| 73 | wifi_(wifi) {} |
| 74 | |
| 75 | SupplicantInterfaceProxy::Proxy::~Proxy() {} |
| 76 | |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 77 | void SupplicantInterfaceProxy::Proxy::BlobAdded(const string &/*blobname*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 78 | LOG(INFO) << __func__; |
| 79 | // XXX |
| 80 | } |
| 81 | |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 82 | void SupplicantInterfaceProxy::Proxy::BlobRemoved(const string &/*blobname*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 83 | LOG(INFO) << __func__; |
| 84 | // XXX |
| 85 | } |
| 86 | |
| 87 | void SupplicantInterfaceProxy::Proxy::BSSAdded( |
| 88 | const ::DBus::Path &BSS, |
| 89 | const std::map<string, ::DBus::Variant> &properties) { |
| 90 | LOG(INFO) << __func__; |
| 91 | wifi_->BSSAdded(BSS, properties); |
| 92 | } |
| 93 | |
mukesh agrawal | 261daca | 2011-12-02 18:56:56 +0000 | [diff] [blame] | 94 | void SupplicantInterfaceProxy::Proxy::BSSRemoved(const ::DBus::Path &BSS) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 95 | LOG(INFO) << __func__; |
mukesh agrawal | 261daca | 2011-12-02 18:56:56 +0000 | [diff] [blame] | 96 | wifi_->BSSRemoved(BSS); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | void SupplicantInterfaceProxy::Proxy::NetworkAdded( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 100 | const ::DBus::Path &/*network*/, |
| 101 | const std::map<string, ::DBus::Variant> &/*properties*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 102 | LOG(INFO) << __func__; |
| 103 | // XXX |
| 104 | } |
| 105 | |
| 106 | void SupplicantInterfaceProxy::Proxy::NetworkRemoved( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 107 | const ::DBus::Path &/*network*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 108 | LOG(INFO) << __func__; |
mukesh agrawal | 8a3188d | 2011-12-01 20:56:44 +0000 | [diff] [blame] | 109 | // TODO(quiche): Pass this up to WiFi, so that it can clean its |
| 110 | // rpcid_by_service_ map. crosbug.com/24699 |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | void SupplicantInterfaceProxy::Proxy::NetworkSelected( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 114 | const ::DBus::Path &/*network*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 115 | LOG(INFO) << __func__; |
| 116 | // XXX |
| 117 | } |
| 118 | |
| 119 | void SupplicantInterfaceProxy::Proxy::PropertiesChanged( |
mukesh agrawal | 7ec7131 | 2011-11-10 02:08:26 +0000 | [diff] [blame] | 120 | const std::map<string, ::DBus::Variant> &properties) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 121 | LOG(INFO) << __func__; |
mukesh agrawal | 7ec7131 | 2011-11-10 02:08:26 +0000 | [diff] [blame] | 122 | wifi_->PropertiesChanged(properties); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | void SupplicantInterfaceProxy::Proxy::ScanDone(const bool& success) { |
| 126 | LOG(INFO) << __func__ << " " << success; |
| 127 | if (success) { |
| 128 | wifi_->ScanDone(); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | } // namespace shill |