blob: 82812071d1942738e7a3ef5266ef23b80c30e1b8 [file] [log] [blame]
mukesh agrawal8a3188d2011-12-01 20:56:44 +00001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
mukesh agrawalaf571952011-07-14 14:31:12 -07002// 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
mukesh agrawal06175d72012-04-23 16:46:01 -070013#include "shill/scope_logger.h"
mukesh agrawalaf571952011-07-14 14:31:12 -070014#include "shill/wifi.h"
15
16using std::map;
17using std::string;
18
19namespace shill {
20
21SupplicantInterfaceProxy::SupplicantInterfaceProxy(
22 const WiFiRefPtr &wifi,
Darin Petkovaceede32011-07-18 15:32:38 -070023 DBus::Connection *bus,
mukesh agrawalaf571952011-07-14 14:31:12 -070024 const ::DBus::Path &object_path,
25 const char *dbus_addr)
Darin Petkovaceede32011-07-18 15:32:38 -070026 : proxy_(wifi, bus, object_path, dbus_addr) {}
mukesh agrawalaf571952011-07-14 14:31:12 -070027
28SupplicantInterfaceProxy::~SupplicantInterfaceProxy() {}
29
30::DBus::Path SupplicantInterfaceProxy::AddNetwork(
31 const std::map<std::string, ::DBus::Variant> &args) {
mukesh agrawal06175d72012-04-23 16:46:01 -070032 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -070033 return proxy_.AddNetwork(args);
34}
35
Paul Stewart66c86002012-01-30 18:00:52 -080036void SupplicantInterfaceProxy::ClearCachedCredentials() {
mukesh agrawal06175d72012-04-23 16:46:01 -070037 SLOG(DBus, 2) << __func__;
Paul Stewart66c86002012-01-30 18:00:52 -080038 return proxy_.ClearCachedCredentials();
39}
40
mukesh agrawal0ed0f2e2011-12-05 20:36:17 +000041void SupplicantInterfaceProxy::Disconnect() {
mukesh agrawal06175d72012-04-23 16:46:01 -070042 SLOG(DBus, 2) << __func__;
mukesh agrawal0ed0f2e2011-12-05 20:36:17 +000043 return proxy_.Disconnect();
44}
45
mukesh agrawalaf571952011-07-14 14:31:12 -070046void SupplicantInterfaceProxy::FlushBSS(const uint32_t &age) {
mukesh agrawal06175d72012-04-23 16:46:01 -070047 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -070048 return proxy_.FlushBSS(age);
49}
50
51void SupplicantInterfaceProxy::RemoveAllNetworks() {
mukesh agrawal06175d72012-04-23 16:46:01 -070052 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -070053 return proxy_.RemoveAllNetworks();
54}
55
mukesh agrawal15908392011-11-16 18:29:25 +000056void SupplicantInterfaceProxy::RemoveNetwork(const ::DBus::Path &network) {
mukesh agrawal06175d72012-04-23 16:46:01 -070057 SLOG(DBus, 2) << __func__;
mukesh agrawal15908392011-11-16 18:29:25 +000058 return proxy_.RemoveNetwork(network);
59}
60
mukesh agrawalaf571952011-07-14 14:31:12 -070061void SupplicantInterfaceProxy::Scan(
62 const std::map<std::string, ::DBus::Variant> &args) {
mukesh agrawal06175d72012-04-23 16:46:01 -070063 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -070064 return proxy_.Scan(args);
65}
66
67void SupplicantInterfaceProxy::SelectNetwork(const ::DBus::Path &network) {
mukesh agrawal06175d72012-04-23 16:46:01 -070068 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -070069 return proxy_.SelectNetwork(network);
70}
71
Paul Stewart2987dcf2012-01-30 15:47:42 -080072void SupplicantInterfaceProxy::SetFastReauth(bool enabled) {
mukesh agrawal06175d72012-04-23 16:46:01 -070073 SLOG(DBus, 2) << __func__;
Paul Stewart2987dcf2012-01-30 15:47:42 -080074 return proxy_.FastReauth(enabled);
75}
76
mukesh agrawalf2028172012-03-13 14:20:22 -070077void SupplicantInterfaceProxy::SetScanInterval(int32 scan_interval) {
mukesh agrawal06175d72012-04-23 16:46:01 -070078 SLOG(DBus, 2) << __func__;
mukesh agrawalf2028172012-03-13 14:20:22 -070079 return proxy_.ScanInterval(scan_interval);
80}
81
mukesh agrawalaf571952011-07-14 14:31:12 -070082// definitions for private class SupplicantInterfaceProxy::Proxy
83
84SupplicantInterfaceProxy::Proxy::Proxy(
85 const WiFiRefPtr &wifi, DBus::Connection *bus,
86 const DBus::Path &dbus_path, const char *dbus_addr)
87 : DBus::ObjectProxy(*bus, dbus_path, dbus_addr),
88 wifi_(wifi) {}
89
90SupplicantInterfaceProxy::Proxy::~Proxy() {}
91
mukesh agrawal1830fa12011-09-26 14:31:40 -070092void SupplicantInterfaceProxy::Proxy::BlobAdded(const string &/*blobname*/) {
mukesh agrawal06175d72012-04-23 16:46:01 -070093 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -070094 // XXX
95}
96
mukesh agrawal1830fa12011-09-26 14:31:40 -070097void SupplicantInterfaceProxy::Proxy::BlobRemoved(const string &/*blobname*/) {
mukesh agrawal06175d72012-04-23 16:46:01 -070098 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -070099 // XXX
100}
101
102void SupplicantInterfaceProxy::Proxy::BSSAdded(
103 const ::DBus::Path &BSS,
104 const std::map<string, ::DBus::Variant> &properties) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700105 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -0700106 wifi_->BSSAdded(BSS, properties);
107}
108
mukesh agrawal261daca2011-12-02 18:56:56 +0000109void SupplicantInterfaceProxy::Proxy::BSSRemoved(const ::DBus::Path &BSS) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700110 SLOG(DBus, 2) << __func__;
mukesh agrawal261daca2011-12-02 18:56:56 +0000111 wifi_->BSSRemoved(BSS);
mukesh agrawalaf571952011-07-14 14:31:12 -0700112}
113
114void SupplicantInterfaceProxy::Proxy::NetworkAdded(
mukesh agrawal1830fa12011-09-26 14:31:40 -0700115 const ::DBus::Path &/*network*/,
116 const std::map<string, ::DBus::Variant> &/*properties*/) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700117 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -0700118 // XXX
119}
120
121void SupplicantInterfaceProxy::Proxy::NetworkRemoved(
mukesh agrawal1830fa12011-09-26 14:31:40 -0700122 const ::DBus::Path &/*network*/) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700123 SLOG(DBus, 2) << __func__;
mukesh agrawal8a3188d2011-12-01 20:56:44 +0000124 // TODO(quiche): Pass this up to WiFi, so that it can clean its
125 // rpcid_by_service_ map. crosbug.com/24699
mukesh agrawalaf571952011-07-14 14:31:12 -0700126}
127
128void SupplicantInterfaceProxy::Proxy::NetworkSelected(
mukesh agrawal1830fa12011-09-26 14:31:40 -0700129 const ::DBus::Path &/*network*/) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700130 SLOG(DBus, 2) << __func__;
mukesh agrawalaf571952011-07-14 14:31:12 -0700131 // XXX
132}
133
134void SupplicantInterfaceProxy::Proxy::PropertiesChanged(
mukesh agrawal7ec71312011-11-10 02:08:26 +0000135 const std::map<string, ::DBus::Variant> &properties) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700136 SLOG(DBus, 2) << __func__;
mukesh agrawal7ec71312011-11-10 02:08:26 +0000137 wifi_->PropertiesChanged(properties);
mukesh agrawalaf571952011-07-14 14:31:12 -0700138}
139
140void SupplicantInterfaceProxy::Proxy::ScanDone(const bool& success) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700141 SLOG(DBus, 2) << __func__ << ": " << success;
mukesh agrawalaf571952011-07-14 14:31:12 -0700142 if (success) {
143 wifi_->ScanDone();
144 }
145}
146
147} // namespace shill