blob: 4d866b311d2a78c25c44cadc7ed5de85612cacfa [file] [log] [blame]
mukesh agrawalaf571952011-07-14 14:31:12 -07001// 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 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
19// SupplicantInterfaceProxy. provides access to wpa_supplicant's
20// network-interface APIs via D-Bus.
21class SupplicantInterfaceProxy
22 : public SupplicantInterfaceProxyInterface {
23 public:
24 SupplicantInterfaceProxy(const WiFiRefPtr &wifi,
Darin Petkovaceede32011-07-18 15:32:38 -070025 DBus::Connection *bus,
mukesh agrawalaf571952011-07-14 14:31:12 -070026 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 Petkovaceede32011-07-18 15:32:38 -070042 Proxy(const WiFiRefPtr &wifi,
43 DBus::Connection *bus,
44 const ::DBus::Path &object_path,
45 const char *dbus_addr);
mukesh agrawalaf571952011-07-14 14:31:12 -070046 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 agrawalaf571952011-07-14 14:31:12 -070070 Proxy proxy_;
71
72 DISALLOW_COPY_AND_ASSIGN(SupplicantInterfaceProxy);
73
74};
75
76} // namespace shill
77
78#endif // SUPPLICANT_INTERFACE_PROXY_H_