Paul Stewart | b50f0b9 | 2011-05-16 16:31:42 -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 SHILL_WIFI_ |
| 6 | #define SHILL_WIFI_ |
| 7 | |
mukesh agrawal | ab87ea4 | 2011-05-18 11:44:49 -0700 | [diff] [blame] | 8 | #include <map> |
Chris Masone | 46eaaf5 | 2011-05-24 13:08:30 -0700 | [diff] [blame] | 9 | #include <string> |
mukesh agrawal | ab87ea4 | 2011-05-18 11:44:49 -0700 | [diff] [blame] | 10 | #include <vector> |
Chris Masone | 46eaaf5 | 2011-05-24 13:08:30 -0700 | [diff] [blame] | 11 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame^] | 12 | #include <dbus-c++/dbus.h> |
| 13 | |
Paul Stewart | b50f0b9 | 2011-05-16 16:31:42 -0700 | [diff] [blame] | 14 | #include "shill/device.h" |
Chris Masone | 2b10554 | 2011-06-22 10:58:09 -0700 | [diff] [blame] | 15 | #include "shill/refptr_types.h" |
Paul Stewart | b50f0b9 | 2011-05-16 16:31:42 -0700 | [diff] [blame] | 16 | #include "shill/shill_event.h" |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame^] | 17 | #include "shill/supplicant_proxy_factory.h" |
Paul Stewart | b50f0b9 | 2011-05-16 16:31:42 -0700 | [diff] [blame] | 18 | |
| 19 | namespace shill { |
| 20 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame^] | 21 | class SupplicantInterfaceProxyInterface; |
| 22 | class SupplicantProcessProxyInterface; |
mukesh agrawal | 445e72c | 2011-06-22 11:13:50 -0700 | [diff] [blame] | 23 | class WiFiService; |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 24 | |
mukesh agrawal | ab87ea4 | 2011-05-18 11:44:49 -0700 | [diff] [blame] | 25 | // WiFi class. Specialization of Device for WiFi. |
Paul Stewart | b50f0b9 | 2011-05-16 16:31:42 -0700 | [diff] [blame] | 26 | class WiFi : public Device { |
| 27 | public: |
Paul Stewart | f1ce5d2 | 2011-05-19 13:10:20 -0700 | [diff] [blame] | 28 | WiFi(ControlInterface *control_interface, |
| 29 | EventDispatcher *dispatcher, |
| 30 | Manager *manager, |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 31 | const std::string& link, |
Paul Stewart | f1ce5d2 | 2011-05-19 13:10:20 -0700 | [diff] [blame] | 32 | int interface_index); |
mukesh agrawal | ab87ea4 | 2011-05-18 11:44:49 -0700 | [diff] [blame] | 33 | virtual ~WiFi(); |
| 34 | virtual void Start(); |
| 35 | virtual void Stop(); |
| 36 | virtual bool TechnologyIs(const Technology type); |
| 37 | |
| 38 | // called by SupplicantInterfaceProxy, in response to events from |
| 39 | // wpa_supplicant. |
| 40 | void BSSAdded(const ::DBus::Path &BSS, |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 41 | const std::map<std::string, ::DBus::Variant> &properties); |
mukesh agrawal | ab87ea4 | 2011-05-18 11:44:49 -0700 | [diff] [blame] | 42 | void ScanDone(); |
| 43 | |
mukesh agrawal | 445e72c | 2011-06-22 11:13:50 -0700 | [diff] [blame] | 44 | // called by WiFiService |
| 45 | void ConnectTo(const WiFiService &service); |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 46 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame^] | 47 | static void set_proxy_factory(SupplicantProxyFactory *factory); |
| 48 | |
Paul Stewart | b50f0b9 | 2011-05-16 16:31:42 -0700 | [diff] [blame] | 49 | private: |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 50 | typedef std::map<const std::string, WiFiEndpointRefPtr> EndpointMap; |
| 51 | typedef std::map<const std::string, ServiceRefPtr> ServiceMap; |
| 52 | |
mukesh agrawal | ab87ea4 | 2011-05-18 11:44:49 -0700 | [diff] [blame] | 53 | static const char kSupplicantPath[]; |
| 54 | static const char kSupplicantDBusAddr[]; |
| 55 | static const char kSupplicantWiFiDriver[]; |
mukesh agrawal | c7426a4 | 2011-06-03 13:04:28 -0700 | [diff] [blame] | 56 | static const char kSupplicantErrorInterfaceExists[]; |
mukesh agrawal | 445e72c | 2011-06-22 11:13:50 -0700 | [diff] [blame] | 57 | static const char kSupplicantPropertySSID[]; |
| 58 | static const char kSupplicantPropertyNetworkMode[]; |
| 59 | static const char kSupplicantPropertyKeyMode[]; |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 60 | static const char kSupplicantKeyModeNone[]; |
mukesh agrawal | ab87ea4 | 2011-05-18 11:44:49 -0700 | [diff] [blame] | 61 | |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 62 | void RealScanDone(); |
| 63 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame^] | 64 | static SupplicantProxyFactory *proxy_factory; |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 65 | static unsigned int service_id_serial_; |
| 66 | ScopedRunnableMethodFactory<WiFi> task_factory_; |
| 67 | ControlInterface *control_interface_; |
| 68 | EventDispatcher *dispatcher_; |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame^] | 69 | scoped_ptr<SupplicantProcessProxyInterface> supplicant_process_proxy_; |
| 70 | scoped_ptr<SupplicantInterfaceProxyInterface> supplicant_interface_proxy_; |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 71 | EndpointMap endpoint_by_bssid_; |
| 72 | ServiceMap service_by_private_id_; |
mukesh agrawal | ab87ea4 | 2011-05-18 11:44:49 -0700 | [diff] [blame] | 73 | |
Chris Masone | 853b81b | 2011-06-24 14:11:41 -0700 | [diff] [blame] | 74 | // Properties |
| 75 | std::string bgscan_method_; |
| 76 | uint16 bgscan_short_interval_; |
| 77 | int32 bgscan_signal_threshold_; |
| 78 | bool scan_pending_; |
| 79 | uint16 scan_interval_; |
| 80 | |
Paul Stewart | b50f0b9 | 2011-05-16 16:31:42 -0700 | [diff] [blame] | 81 | DISALLOW_COPY_AND_ASSIGN(WiFi); |
| 82 | }; |
| 83 | |
| 84 | } // namespace shill |
| 85 | |
| 86 | #endif // SHILL_WIFI_ |