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 | |
| 13 | #include "shill/supplicant-interface.h" |
| 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, |
| 25 | const ::DBus::Path &object_path, |
| 26 | const char *dbus_addr); |
| 27 | virtual ~SupplicantInterfaceProxy(); |
| 28 | |
| 29 | virtual ::DBus::Path AddNetwork( |
| 30 | const std::map<std::string, ::DBus::Variant> &args); |
| 31 | virtual void FlushBSS(const uint32_t &age); |
| 32 | virtual void RemoveAllNetworks(); |
| 33 | virtual void Scan( |
| 34 | const std::map<std::string, ::DBus::Variant> &args); |
| 35 | virtual void SelectNetwork(const ::DBus::Path &network); |
| 36 | |
| 37 | private: |
| 38 | class Proxy : public fi::w1::wpa_supplicant1::Interface_proxy, |
| 39 | public ::DBus::ObjectProxy { |
| 40 | public: |
| 41 | Proxy(const WiFiRefPtr &wifi, DBus::Connection *bus, |
| 42 | const ::DBus::Path &object_path, const char *dbus_addr); |
| 43 | virtual ~Proxy(); |
| 44 | |
| 45 | private: |
| 46 | // signal handlers called by dbus-c++, via |
| 47 | // fi::w1::wpa_supplicant1::Interface_proxy interface |
| 48 | virtual void BlobAdded(const std::string &blobname); |
| 49 | virtual void BlobRemoved(const std::string &blobname); |
| 50 | virtual void BSSAdded(const ::DBus::Path &BSS, |
| 51 | const std::map<std::string, ::DBus::Variant> |
| 52 | &properties); |
| 53 | virtual void BSSRemoved(const ::DBus::Path &BSS); |
| 54 | virtual void NetworkAdded(const ::DBus::Path &network, |
| 55 | const std::map<std::string, ::DBus::Variant> |
| 56 | &properties); |
| 57 | virtual void NetworkRemoved(const ::DBus::Path &network); |
| 58 | virtual void NetworkSelected(const ::DBus::Path &network); |
| 59 | virtual void PropertiesChanged(const std::map<std::string, ::DBus::Variant> |
| 60 | &properties); |
| 61 | virtual void ScanDone(const bool &success); |
| 62 | |
| 63 | WiFiRefPtr wifi_; |
| 64 | DISALLOW_COPY_AND_ASSIGN(Proxy); |
| 65 | }; |
| 66 | |
| 67 | DBus::Connection connection_; |
| 68 | Proxy proxy_; |
| 69 | |
| 70 | DISALLOW_COPY_AND_ASSIGN(SupplicantInterfaceProxy); |
| 71 | |
| 72 | }; |
| 73 | |
| 74 | } // namespace shill |
| 75 | |
| 76 | #endif // SUPPLICANT_INTERFACE_PROXY_H_ |