mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 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 | |
| 19 | // SupplicantInterfaceProxy. provides access to wpa_supplicant's |
| 20 | // network-interface APIs via D-Bus. |
| 21 | class SupplicantInterfaceProxy |
| 22 | : public SupplicantInterfaceProxyInterface { |
| 23 | public: |
| 24 | SupplicantInterfaceProxy(const WiFiRefPtr &wifi, |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 25 | DBus::Connection *bus, |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 26 | const ::DBus::Path &object_path, |
| 27 | const char *dbus_addr); |
| 28 | virtual ~SupplicantInterfaceProxy(); |
| 29 | |
| 30 | virtual ::DBus::Path AddNetwork( |
| 31 | const std::map<std::string, ::DBus::Variant> &args); |
| 32 | virtual void FlushBSS(const uint32_t &age); |
| 33 | virtual void RemoveAllNetworks(); |
| 34 | virtual void Scan( |
| 35 | const std::map<std::string, ::DBus::Variant> &args); |
| 36 | virtual void SelectNetwork(const ::DBus::Path &network); |
| 37 | |
| 38 | private: |
| 39 | class Proxy : public fi::w1::wpa_supplicant1::Interface_proxy, |
| 40 | public ::DBus::ObjectProxy { |
| 41 | public: |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 42 | Proxy(const WiFiRefPtr &wifi, |
| 43 | DBus::Connection *bus, |
| 44 | const ::DBus::Path &object_path, |
| 45 | const char *dbus_addr); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 46 | virtual ~Proxy(); |
| 47 | |
| 48 | private: |
| 49 | // signal handlers called by dbus-c++, via |
| 50 | // fi::w1::wpa_supplicant1::Interface_proxy interface |
| 51 | virtual void BlobAdded(const std::string &blobname); |
| 52 | virtual void BlobRemoved(const std::string &blobname); |
| 53 | virtual void BSSAdded(const ::DBus::Path &BSS, |
| 54 | const std::map<std::string, ::DBus::Variant> |
| 55 | &properties); |
| 56 | virtual void BSSRemoved(const ::DBus::Path &BSS); |
| 57 | virtual void NetworkAdded(const ::DBus::Path &network, |
| 58 | const std::map<std::string, ::DBus::Variant> |
| 59 | &properties); |
| 60 | virtual void NetworkRemoved(const ::DBus::Path &network); |
| 61 | virtual void NetworkSelected(const ::DBus::Path &network); |
| 62 | virtual void PropertiesChanged(const std::map<std::string, ::DBus::Variant> |
| 63 | &properties); |
| 64 | virtual void ScanDone(const bool &success); |
| 65 | |
| 66 | WiFiRefPtr wifi_; |
| 67 | DISALLOW_COPY_AND_ASSIGN(Proxy); |
| 68 | }; |
| 69 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 70 | Proxy proxy_; |
| 71 | |
| 72 | DISALLOW_COPY_AND_ASSIGN(SupplicantInterfaceProxy); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | } // namespace shill |
| 76 | |
| 77 | #endif // SUPPLICANT_INTERFACE_PROXY_H_ |