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 | |
Darin Petkov | 4a09b6b | 2011-07-19 12:52:06 -0700 | [diff] [blame] | 13 | #include "shill/dbus_bindings/supplicant-interface.h" |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 14 | #include "shill/supplicant_interface_proxy_interface.h" |
| 15 | #include "shill/refptr_types.h" |
| 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 | 3c508e1 | 2012-08-09 11:40:06 -0700 | [diff] [blame] | 42 | virtual void Reassociate(); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 43 | virtual void RemoveAllNetworks(); |
mukesh agrawal | 1590839 | 2011-11-16 18:29:25 +0000 | [diff] [blame] | 44 | virtual void RemoveNetwork(const ::DBus::Path &network); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 45 | virtual void Scan( |
| 46 | const std::map<std::string, ::DBus::Variant> &args); |
| 47 | virtual void SelectNetwork(const ::DBus::Path &network); |
Paul Stewart | 2987dcf | 2012-01-30 15:47:42 -0800 | [diff] [blame] | 48 | virtual void SetFastReauth(bool enabled); |
mukesh agrawal | f202817 | 2012-03-13 14:20:22 -0700 | [diff] [blame] | 49 | virtual void SetScanInterval(int seconds); |
Christopher Wiley | 5519e9e | 2013-01-08 16:55:56 -0800 | [diff] [blame] | 50 | virtual void SetDisableHighBitrates(bool disable_high_bitrates); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 51 | |
| 52 | private: |
| 53 | class Proxy : public fi::w1::wpa_supplicant1::Interface_proxy, |
| 54 | public ::DBus::ObjectProxy { |
| 55 | public: |
Paul Stewart | 196f50f | 2013-03-27 18:02:11 -0700 | [diff] [blame] | 56 | Proxy(SupplicantEventDelegateInterface *delegate, |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 57 | DBus::Connection *bus, |
| 58 | const ::DBus::Path &object_path, |
| 59 | const char *dbus_addr); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 60 | virtual ~Proxy(); |
| 61 | |
| 62 | private: |
| 63 | // signal handlers called by dbus-c++, via |
| 64 | // fi::w1::wpa_supplicant1::Interface_proxy interface |
| 65 | virtual void BlobAdded(const std::string &blobname); |
| 66 | virtual void BlobRemoved(const std::string &blobname); |
| 67 | virtual void BSSAdded(const ::DBus::Path &BSS, |
| 68 | const std::map<std::string, ::DBus::Variant> |
| 69 | &properties); |
| 70 | virtual void BSSRemoved(const ::DBus::Path &BSS); |
Paul Stewart | bc6e739 | 2012-05-24 07:07:48 -0700 | [diff] [blame] | 71 | virtual void Certification(const std::map<std::string, ::DBus::Variant> |
| 72 | &properties); |
Paul Stewart | db0f917 | 2012-11-30 16:48:09 -0800 | [diff] [blame] | 73 | virtual void EAP(const std::string &status, const std::string ¶meter); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 74 | virtual void NetworkAdded(const ::DBus::Path &network, |
| 75 | const std::map<std::string, ::DBus::Variant> |
| 76 | &properties); |
| 77 | virtual void NetworkRemoved(const ::DBus::Path &network); |
| 78 | virtual void NetworkSelected(const ::DBus::Path &network); |
| 79 | virtual void PropertiesChanged(const std::map<std::string, ::DBus::Variant> |
| 80 | &properties); |
| 81 | virtual void ScanDone(const bool &success); |
| 82 | |
Paul Stewart | 196f50f | 2013-03-27 18:02:11 -0700 | [diff] [blame] | 83 | // This pointer is owned by the object that created |this|. That object |
| 84 | // MUST destroy |this| before destroying itself. |
| 85 | SupplicantEventDelegateInterface *delegate_; |
| 86 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 87 | DISALLOW_COPY_AND_ASSIGN(Proxy); |
| 88 | }; |
| 89 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 90 | Proxy proxy_; |
| 91 | |
| 92 | DISALLOW_COPY_AND_ASSIGN(SupplicantInterfaceProxy); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 93 | }; |
| 94 | |
| 95 | } // namespace shill |
| 96 | |
| 97 | #endif // SUPPLICANT_INTERFACE_PROXY_H_ |