Peter Qiu | c0beca5 | 2015-09-03 11:25:46 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2013 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
Paul Stewart | 35eff13 | 2013-04-12 12:08:40 -0700 | [diff] [blame] | 16 | |
Ben Chan | 8760251 | 2014-11-07 20:50:05 -0800 | [diff] [blame] | 17 | #include "shill/ethernet/ethernet_eap_service.h" |
Paul Stewart | 35eff13 | 2013-04-12 12:08:40 -0700 | [diff] [blame] | 18 | |
| 19 | #include <string> |
| 20 | |
Ben Chan | a0ddf46 | 2014-02-06 11:32:42 -0800 | [diff] [blame] | 21 | #include <base/strings/stringprintf.h> |
Paul Stewart | 35eff13 | 2013-04-12 12:08:40 -0700 | [diff] [blame] | 22 | |
| 23 | #include "shill/eap_credentials.h" |
Ben Chan | 8760251 | 2014-11-07 20:50:05 -0800 | [diff] [blame] | 24 | #include "shill/ethernet/ethernet_eap_provider.h" |
Paul Stewart | 35eff13 | 2013-04-12 12:08:40 -0700 | [diff] [blame] | 25 | #include "shill/manager.h" |
| 26 | #include "shill/technology.h" |
| 27 | |
| 28 | using std::string; |
| 29 | |
| 30 | namespace shill { |
| 31 | |
Paul Stewart | 7e779d8 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 32 | EthernetEapService::EthernetEapService(ControlInterface* control_interface, |
| 33 | EventDispatcher* dispatcher, |
| 34 | Metrics* metrics, |
| 35 | Manager* manager) |
Paul Stewart | 35eff13 | 2013-04-12 12:08:40 -0700 | [diff] [blame] | 36 | : Service(control_interface, dispatcher, metrics, manager, |
| 37 | Technology::kEthernetEap) { |
| 38 | SetEapCredentials(new EapCredentials()); |
| 39 | set_friendly_name("Ethernet EAP Parameters"); |
| 40 | } |
| 41 | |
| 42 | EthernetEapService::~EthernetEapService() {} |
| 43 | |
| 44 | string EthernetEapService::GetStorageIdentifier() const { |
Ben Chan | a0ddf46 | 2014-02-06 11:32:42 -0800 | [diff] [blame] | 45 | return base::StringPrintf( |
| 46 | "%s_all", Technology::NameFromIdentifier(technology()).c_str()); |
Paul Stewart | 35eff13 | 2013-04-12 12:08:40 -0700 | [diff] [blame] | 47 | } |
| 48 | |
Paul Stewart | 7e779d8 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 49 | string EthernetEapService::GetDeviceRpcId(Error* /*error*/) const { |
Paul Stewart | 35eff13 | 2013-04-12 12:08:40 -0700 | [diff] [blame] | 50 | return "/"; |
| 51 | } |
| 52 | |
Rebecca Silberstein | 5777690 | 2014-09-15 21:43:02 -0700 | [diff] [blame] | 53 | void EthernetEapService::OnEapCredentialsChanged( |
| 54 | Service::UpdateCredentialsReason reason) { |
| 55 | if (reason == Service::kReasonPropertyUpdate) { |
| 56 | // Although the has_ever_connected_ field is not used in the |
| 57 | // same manner as the other services, we still make this call |
| 58 | // to maintain consistent behavior by the EAP Credential Change |
| 59 | // call. |
| 60 | SetHasEverConnected(false); |
| 61 | } |
Paul Stewart | 35eff13 | 2013-04-12 12:08:40 -0700 | [diff] [blame] | 62 | manager()->ethernet_eap_provider()->OnCredentialsChanged(); |
| 63 | } |
| 64 | |
Paul Stewart | be9abfd | 2013-04-22 12:18:48 -0700 | [diff] [blame] | 65 | bool EthernetEapService::Unload() { |
| 66 | Service::Unload(); |
| 67 | manager()->ethernet_eap_provider()->OnCredentialsChanged(); |
| 68 | return false; |
| 69 | } |
| 70 | |
Paul Stewart | 35eff13 | 2013-04-12 12:08:40 -0700 | [diff] [blame] | 71 | } // namespace shill |