blob: 6ddaabef4c007a9c6de02514fc152e76ef8530cc [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
Darin Petkov4a09b6b2011-07-19 12:52:06 -070013#include "shill/dbus_bindings/supplicant-interface.h"
mukesh agrawalaf571952011-07-14 14:31:12 -070014#include "shill/supplicant_interface_proxy_interface.h"
15#include "shill/refptr_types.h"
16
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 Stewart3c508e12012-08-09 11:40:06 -070042 virtual void Reassociate();
mukesh agrawalaf571952011-07-14 14:31:12 -070043 virtual void RemoveAllNetworks();
mukesh agrawal15908392011-11-16 18:29:25 +000044 virtual void RemoveNetwork(const ::DBus::Path &network);
mukesh agrawalaf571952011-07-14 14:31:12 -070045 virtual void Scan(
46 const std::map<std::string, ::DBus::Variant> &args);
47 virtual void SelectNetwork(const ::DBus::Path &network);
Paul Stewart2987dcf2012-01-30 15:47:42 -080048 virtual void SetFastReauth(bool enabled);
mukesh agrawalf2028172012-03-13 14:20:22 -070049 virtual void SetScanInterval(int seconds);
Christopher Wiley5519e9e2013-01-08 16:55:56 -080050 virtual void SetDisableHighBitrates(bool disable_high_bitrates);
mukesh agrawalaf571952011-07-14 14:31:12 -070051
52 private:
53 class Proxy : public fi::w1::wpa_supplicant1::Interface_proxy,
54 public ::DBus::ObjectProxy {
55 public:
Paul Stewart196f50f2013-03-27 18:02:11 -070056 Proxy(SupplicantEventDelegateInterface *delegate,
Darin Petkovaceede32011-07-18 15:32:38 -070057 DBus::Connection *bus,
58 const ::DBus::Path &object_path,
59 const char *dbus_addr);
mukesh agrawalaf571952011-07-14 14:31:12 -070060 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 Stewartbc6e7392012-05-24 07:07:48 -070071 virtual void Certification(const std::map<std::string, ::DBus::Variant>
72 &properties);
Paul Stewartdb0f9172012-11-30 16:48:09 -080073 virtual void EAP(const std::string &status, const std::string &parameter);
mukesh agrawalaf571952011-07-14 14:31:12 -070074 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 Stewart196f50f2013-03-27 18:02:11 -070083 // This pointer is owned by the object that created |this|. That object
84 // MUST destroy |this| before destroying itself.
85 SupplicantEventDelegateInterface *delegate_;
86
mukesh agrawalaf571952011-07-14 14:31:12 -070087 DISALLOW_COPY_AND_ASSIGN(Proxy);
88 };
89
mukesh agrawalaf571952011-07-14 14:31:12 -070090 Proxy proxy_;
91
92 DISALLOW_COPY_AND_ASSIGN(SupplicantInterfaceProxy);
mukesh agrawalaf571952011-07-14 14:31:12 -070093};
94
95} // namespace shill
96
97#endif // SUPPLICANT_INTERFACE_PROXY_H_