blob: f7da634b1ed6c7354973387c5f3863e8b24b5f05 [file] [log] [blame]
mukesh agrawalf2028172012-03-13 14:20:22 -07001// 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#ifndef SUPPLICANT_INTERFACE_PROXY_H_
6#define SUPPLICANT_INTERFACE_PROXY_H_
7
8#include <map>
9#include <string>
10
11#include <base/basictypes.h>
12
Liam McLoughlinef342b42013-09-13 21:05:36 +010013#include "shill/dbus_proxies/supplicant-interface.h"
mukesh agrawalaf571952011-07-14 14:31:12 -070014#include "shill/refptr_types.h"
Wade Guthrie227c7742013-10-10 11:06:33 -070015#include "shill/supplicant_interface_proxy_interface.h"
mukesh agrawalaf571952011-07-14 14:31:12 -070016
17namespace shill {
18
Paul Stewart196f50f2013-03-27 18:02:11 -070019class SupplicantEventDelegateInterface;
20
mukesh agrawalaf571952011-07-14 14:31:12 -070021// SupplicantInterfaceProxy. provides access to wpa_supplicant's
Paul Stewart196f50f2013-03-27 18:02:11 -070022// network-interface APIs via D-Bus. This takes a delegate, which
23// is an interface that is used to send notifications of supplicant
24// events. This pointer is not owned by SupplicantInterfaceProxy
25// and must outlive the proxy.
mukesh agrawalaf571952011-07-14 14:31:12 -070026class SupplicantInterfaceProxy
27 : public SupplicantInterfaceProxyInterface {
28 public:
Paul Stewart196f50f2013-03-27 18:02:11 -070029 SupplicantInterfaceProxy(SupplicantEventDelegateInterface *delegate,
Darin Petkovaceede32011-07-18 15:32:38 -070030 DBus::Connection *bus,
mukesh agrawalaf571952011-07-14 14:31:12 -070031 const ::DBus::Path &object_path,
32 const char *dbus_addr);
33 virtual ~SupplicantInterfaceProxy();
34
35 virtual ::DBus::Path AddNetwork(
36 const std::map<std::string, ::DBus::Variant> &args);
Christopher Wiley5519e9e2013-01-08 16:55:56 -080037 virtual void EnableHighBitrates();
Paul Stewartbe9abfd2013-04-22 12:18:48 -070038 virtual void EAPLogon();
39 virtual void EAPLogoff();
mukesh agrawal0ed0f2e2011-12-05 20:36:17 +000040 virtual void Disconnect();
mukesh agrawalaf571952011-07-14 14:31:12 -070041 virtual void FlushBSS(const uint32_t &age);
Paul Stewart11c224b2013-10-22 19:04:40 -070042 virtual void NetworkReply(const ::DBus::Path &network,
43 const std::string &field,
44 const std::string &value);
Paul Stewart3c508e12012-08-09 11:40:06 -070045 virtual void Reassociate();
Peter Qiudaa14ee2014-03-10 14:40:53 -070046 virtual void Reattach();
mukesh agrawalaf571952011-07-14 14:31:12 -070047 virtual void RemoveAllNetworks();
mukesh agrawal15908392011-11-16 18:29:25 +000048 virtual void RemoveNetwork(const ::DBus::Path &network);
mukesh agrawalaf571952011-07-14 14:31:12 -070049 virtual void Scan(
50 const std::map<std::string, ::DBus::Variant> &args);
51 virtual void SelectNetwork(const ::DBus::Path &network);
Paul Stewart2987dcf2012-01-30 15:47:42 -080052 virtual void SetFastReauth(bool enabled);
Wade Guthrie227c7742013-10-10 11:06:33 -070053 virtual void SetRoamThreshold(uint16 threshold);
mukesh agrawalf2028172012-03-13 14:20:22 -070054 virtual void SetScanInterval(int seconds);
Christopher Wiley5519e9e2013-01-08 16:55:56 -080055 virtual void SetDisableHighBitrates(bool disable_high_bitrates);
Paul Stewartdf4c7d62013-11-12 14:05:00 -080056 virtual void TDLSDiscover(const std::string &peer);
57 virtual void TDLSSetup(const std::string &peer);
58 virtual std::string TDLSStatus(const std::string &peer);
59 virtual void TDLSTeardown(const std::string &peer);
mukesh agrawalaf571952011-07-14 14:31:12 -070060
61 private:
62 class Proxy : public fi::w1::wpa_supplicant1::Interface_proxy,
63 public ::DBus::ObjectProxy {
64 public:
Paul Stewart196f50f2013-03-27 18:02:11 -070065 Proxy(SupplicantEventDelegateInterface *delegate,
Darin Petkovaceede32011-07-18 15:32:38 -070066 DBus::Connection *bus,
67 const ::DBus::Path &object_path,
68 const char *dbus_addr);
mukesh agrawalaf571952011-07-14 14:31:12 -070069 virtual ~Proxy();
70
71 private:
72 // signal handlers called by dbus-c++, via
73 // fi::w1::wpa_supplicant1::Interface_proxy interface
74 virtual void BlobAdded(const std::string &blobname);
75 virtual void BlobRemoved(const std::string &blobname);
76 virtual void BSSAdded(const ::DBus::Path &BSS,
77 const std::map<std::string, ::DBus::Variant>
78 &properties);
79 virtual void BSSRemoved(const ::DBus::Path &BSS);
Paul Stewartbc6e7392012-05-24 07:07:48 -070080 virtual void Certification(const std::map<std::string, ::DBus::Variant>
81 &properties);
Paul Stewartdb0f9172012-11-30 16:48:09 -080082 virtual void EAP(const std::string &status, const std::string &parameter);
mukesh agrawalaf571952011-07-14 14:31:12 -070083 virtual void NetworkAdded(const ::DBus::Path &network,
84 const std::map<std::string, ::DBus::Variant>
85 &properties);
86 virtual void NetworkRemoved(const ::DBus::Path &network);
87 virtual void NetworkSelected(const ::DBus::Path &network);
88 virtual void PropertiesChanged(const std::map<std::string, ::DBus::Variant>
89 &properties);
90 virtual void ScanDone(const bool &success);
91
Paul Stewart196f50f2013-03-27 18:02:11 -070092 // This pointer is owned by the object that created |this|. That object
93 // MUST destroy |this| before destroying itself.
94 SupplicantEventDelegateInterface *delegate_;
95
mukesh agrawalaf571952011-07-14 14:31:12 -070096 DISALLOW_COPY_AND_ASSIGN(Proxy);
97 };
98
mukesh agrawalaf571952011-07-14 14:31:12 -070099 Proxy proxy_;
100
101 DISALLOW_COPY_AND_ASSIGN(SupplicantInterfaceProxy);
mukesh agrawalaf571952011-07-14 14:31:12 -0700102};
103
104} // namespace shill
105
106#endif // SUPPLICANT_INTERFACE_PROXY_H_