mukesh agrawal | b54601c | 2011-06-07 17:39:22 -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_SERVICE_ |
| 6 | #define SHILL_WIFI_SERVICE_ |
| 7 | |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
Darin Petkov | 4a09b6b | 2011-07-19 12:52:06 -0700 | [diff] [blame] | 11 | #include "shill/dbus_bindings/supplicant-interface.h" |
Chris Masone | 2b10554 | 2011-06-22 10:58:09 -0700 | [diff] [blame] | 12 | #include "shill/refptr_types.h" |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 13 | #include "shill/service.h" |
Chris Masone | 2b10554 | 2011-06-22 10:58:09 -0700 | [diff] [blame] | 14 | #include "shill/shill_event.h" |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 15 | |
| 16 | namespace shill { |
| 17 | |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 18 | class ControlInterface; |
| 19 | class EventDispatcher; |
| 20 | class Manager; |
| 21 | |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 22 | class WiFiService : public Service { |
| 23 | public: |
| 24 | WiFiService(ControlInterface *control_interface, |
| 25 | EventDispatcher *dispatcher, |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 26 | Manager *manager, |
Chris Masone | 2b10554 | 2011-06-22 10:58:09 -0700 | [diff] [blame] | 27 | const WiFiRefPtr &device, |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 28 | const std::vector<uint8_t> ssid, |
Chris Masone | 092df3e | 2011-08-22 09:41:39 -0700 | [diff] [blame] | 29 | const std::string &mode, |
mukesh agrawal | 51a7e93 | 2011-07-27 16:18:26 -0700 | [diff] [blame] | 30 | const std::string &key_management); |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 31 | ~WiFiService(); |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 32 | |
| 33 | // Inherited from Service. |
| 34 | virtual void Connect(Error *error); |
| 35 | virtual void Disconnect(); |
Chris Masone | 34af218 | 2011-08-22 11:59:36 -0700 | [diff] [blame] | 36 | |
| 37 | // wifi_<MAC>_<BSSID>_<mode_string>_<security_string> |
| 38 | std::string GetStorageIdentifier(const std::string &mac); |
| 39 | |
Chris Masone | 092df3e | 2011-08-22 09:41:39 -0700 | [diff] [blame] | 40 | const std::string &mode() const; |
mukesh agrawal | 445e72c | 2011-06-22 11:13:50 -0700 | [diff] [blame] | 41 | const std::string &key_management() const; |
| 42 | const std::vector<uint8_t> &ssid() const; |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 43 | |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 44 | protected: |
| 45 | virtual std::string CalculateState() { return "idle"; } |
| 46 | |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 47 | private: |
Chris Masone | 34af218 | 2011-08-22 11:59:36 -0700 | [diff] [blame] | 48 | static const char kServiceType[]; |
| 49 | |
mukesh agrawal | dc42bb3 | 2011-07-28 10:40:26 -0700 | [diff] [blame] | 50 | void ConnectTask(); |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 51 | |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 52 | std::string GetDeviceRpcId(); |
| 53 | |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 54 | // Properties |
| 55 | std::string passphrase_; |
| 56 | bool need_passphrase_; |
| 57 | std::string security_; |
| 58 | uint8 strength_; |
| 59 | const std::string type_; |
| 60 | // TODO(cmasone): see if the below can be pulled from the endpoint associated |
| 61 | // with this service instead. |
Chris Masone | 092df3e | 2011-08-22 09:41:39 -0700 | [diff] [blame] | 62 | const std::string mode_; |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 63 | std::string auth_mode_; |
| 64 | bool hidden_ssid_; |
| 65 | uint16 frequency_; |
| 66 | uint16 physical_mode_; |
| 67 | uint16 hex_ssid_; |
| 68 | |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 69 | ScopedRunnableMethodFactory<WiFiService> task_factory_; |
Chris Masone | 2b10554 | 2011-06-22 10:58:09 -0700 | [diff] [blame] | 70 | WiFiRefPtr wifi_; |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 71 | const std::vector<uint8_t> ssid_; |
mukesh agrawal | b54601c | 2011-06-07 17:39:22 -0700 | [diff] [blame] | 72 | DISALLOW_COPY_AND_ASSIGN(WiFiService); |
| 73 | }; |
| 74 | |
| 75 | } // namespace shill |
| 76 | |
| 77 | #endif // SHILL_WIFI_SERVICE_ |