blob: 9af519194dc83a73621c7af3e2e2c934cf3502d8 [file] [log] [blame]
Peter Qiuc0beca52015-09-03 11:25:46 -07001//
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 Stewart35eff132013-04-12 12:08:40 -070016
Ben Chan87602512014-11-07 20:50:05 -080017#include "shill/ethernet/ethernet_eap_service.h"
Paul Stewart35eff132013-04-12 12:08:40 -070018
19#include <string>
20
Ben Chana0ddf462014-02-06 11:32:42 -080021#include <base/strings/stringprintf.h>
Paul Stewart35eff132013-04-12 12:08:40 -070022
23#include "shill/eap_credentials.h"
Ben Chan87602512014-11-07 20:50:05 -080024#include "shill/ethernet/ethernet_eap_provider.h"
Paul Stewart35eff132013-04-12 12:08:40 -070025#include "shill/manager.h"
26#include "shill/technology.h"
27
28using std::string;
29
30namespace shill {
31
Paul Stewart7e779d82015-06-16 13:13:10 -070032EthernetEapService::EthernetEapService(ControlInterface* control_interface,
33 EventDispatcher* dispatcher,
34 Metrics* metrics,
35 Manager* manager)
Paul Stewart35eff132013-04-12 12:08:40 -070036 : Service(control_interface, dispatcher, metrics, manager,
37 Technology::kEthernetEap) {
38 SetEapCredentials(new EapCredentials());
39 set_friendly_name("Ethernet EAP Parameters");
40}
41
42EthernetEapService::~EthernetEapService() {}
43
44string EthernetEapService::GetStorageIdentifier() const {
Ben Chana0ddf462014-02-06 11:32:42 -080045 return base::StringPrintf(
46 "%s_all", Technology::NameFromIdentifier(technology()).c_str());
Paul Stewart35eff132013-04-12 12:08:40 -070047}
48
Paul Stewart7e779d82015-06-16 13:13:10 -070049string EthernetEapService::GetDeviceRpcId(Error* /*error*/) const {
Paul Stewart35eff132013-04-12 12:08:40 -070050 return "/";
51}
52
Rebecca Silberstein57776902014-09-15 21:43:02 -070053void 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 Stewart35eff132013-04-12 12:08:40 -070062 manager()->ethernet_eap_provider()->OnCredentialsChanged();
63}
64
Paul Stewartbe9abfd2013-04-22 12:18:48 -070065bool EthernetEapService::Unload() {
66 Service::Unload();
67 manager()->ethernet_eap_provider()->OnCredentialsChanged();
68 return false;
69}
70
Paul Stewart35eff132013-04-12 12:08:40 -070071} // namespace shill