mukesh agrawal | f202817 | 2012-03-13 14:20:22 -0700 | [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 | #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 McLoughlin | ef342b4 | 2013-09-13 21:05:36 +0100 | [diff] [blame] | 13 | #include "shill/dbus_proxies/supplicant-interface.h" |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 14 | #include "shill/refptr_types.h" |
Wade Guthrie | 227c774 | 2013-10-10 11:06:33 -0700 | [diff] [blame] | 15 | #include "shill/supplicant_interface_proxy_interface.h" |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 16 | |
| 17 | namespace shill { |
| 18 | |
Paul Stewart | 196f50f | 2013-03-27 18:02:11 -0700 | [diff] [blame] | 19 | class SupplicantEventDelegateInterface; |
| 20 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 21 | // SupplicantInterfaceProxy. provides access to wpa_supplicant's |
Paul Stewart | 196f50f | 2013-03-27 18:02:11 -0700 | [diff] [blame] | 22 | // 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 agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 26 | class SupplicantInterfaceProxy |
| 27 | : public SupplicantInterfaceProxyInterface { |
| 28 | public: |
Paul Stewart | 196f50f | 2013-03-27 18:02:11 -0700 | [diff] [blame] | 29 | SupplicantInterfaceProxy(SupplicantEventDelegateInterface *delegate, |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 30 | DBus::Connection *bus, |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 31 | 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 Wiley | 5519e9e | 2013-01-08 16:55:56 -0800 | [diff] [blame] | 37 | virtual void EnableHighBitrates(); |
Paul Stewart | be9abfd | 2013-04-22 12:18:48 -0700 | [diff] [blame] | 38 | virtual void EAPLogon(); |
| 39 | virtual void EAPLogoff(); |
mukesh agrawal | 0ed0f2e | 2011-12-05 20:36:17 +0000 | [diff] [blame] | 40 | virtual void Disconnect(); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 41 | virtual void FlushBSS(const uint32_t &age); |
Paul Stewart | 11c224b | 2013-10-22 19:04:40 -0700 | [diff] [blame] | 42 | virtual void NetworkReply(const ::DBus::Path &network, |
| 43 | const std::string &field, |
| 44 | const std::string &value); |
Paul Stewart | 3c508e1 | 2012-08-09 11:40:06 -0700 | [diff] [blame] | 45 | virtual void Reassociate(); |
Peter Qiu | daa14ee | 2014-03-10 14:40:53 -0700 | [diff] [blame] | 46 | virtual void Reattach(); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 47 | virtual void RemoveAllNetworks(); |
mukesh agrawal | 1590839 | 2011-11-16 18:29:25 +0000 | [diff] [blame] | 48 | virtual void RemoveNetwork(const ::DBus::Path &network); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 49 | virtual void Scan( |
| 50 | const std::map<std::string, ::DBus::Variant> &args); |
| 51 | virtual void SelectNetwork(const ::DBus::Path &network); |
Paul Stewart | 2987dcf | 2012-01-30 15:47:42 -0800 | [diff] [blame] | 52 | virtual void SetFastReauth(bool enabled); |
Wade Guthrie | 227c774 | 2013-10-10 11:06:33 -0700 | [diff] [blame] | 53 | virtual void SetRoamThreshold(uint16 threshold); |
mukesh agrawal | f202817 | 2012-03-13 14:20:22 -0700 | [diff] [blame] | 54 | virtual void SetScanInterval(int seconds); |
Christopher Wiley | 5519e9e | 2013-01-08 16:55:56 -0800 | [diff] [blame] | 55 | virtual void SetDisableHighBitrates(bool disable_high_bitrates); |
Paul Stewart | df4c7d6 | 2013-11-12 14:05:00 -0800 | [diff] [blame] | 56 | 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 agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 60 | |
| 61 | private: |
| 62 | class Proxy : public fi::w1::wpa_supplicant1::Interface_proxy, |
| 63 | public ::DBus::ObjectProxy { |
| 64 | public: |
Paul Stewart | 196f50f | 2013-03-27 18:02:11 -0700 | [diff] [blame] | 65 | Proxy(SupplicantEventDelegateInterface *delegate, |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 66 | DBus::Connection *bus, |
| 67 | const ::DBus::Path &object_path, |
| 68 | const char *dbus_addr); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 69 | 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 Stewart | bc6e739 | 2012-05-24 07:07:48 -0700 | [diff] [blame] | 80 | virtual void Certification(const std::map<std::string, ::DBus::Variant> |
| 81 | &properties); |
Paul Stewart | db0f917 | 2012-11-30 16:48:09 -0800 | [diff] [blame] | 82 | virtual void EAP(const std::string &status, const std::string ¶meter); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 83 | 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 Stewart | 196f50f | 2013-03-27 18:02:11 -0700 | [diff] [blame] | 92 | // This pointer is owned by the object that created |this|. That object |
| 93 | // MUST destroy |this| before destroying itself. |
| 94 | SupplicantEventDelegateInterface *delegate_; |
| 95 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 96 | DISALLOW_COPY_AND_ASSIGN(Proxy); |
| 97 | }; |
| 98 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 99 | Proxy proxy_; |
| 100 | |
| 101 | DISALLOW_COPY_AND_ASSIGN(SupplicantInterfaceProxy); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 102 | }; |
| 103 | |
| 104 | } // namespace shill |
| 105 | |
| 106 | #endif // SUPPLICANT_INTERFACE_PROXY_H_ |