blob: eadf46c7f68e2be4e63843f30746781a2c4d86d8 [file] [log] [blame]
Thieu Le3426c8f2012-01-11 17:35:11 -08001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Paul Stewartf1ce5d22011-05-19 13:10:20 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Darin Petkovafa6fc42011-06-21 16:21:08 -07005#include "shill/ethernet_service.h"
6
Paul Stewartf1ce5d22011-05-19 13:10:20 -07007#include <time.h>
8#include <stdio.h>
9#include <netinet/ether.h>
10#include <linux/if.h>
11
12#include <string>
13
14#include <base/logging.h>
Chris Masone34af2182011-08-22 11:59:36 -070015#include <base/stringprintf.h>
Chris Masone3bd3c8c2011-06-13 08:20:26 -070016#include <chromeos/dbus/service_constants.h>
Paul Stewartf1ce5d22011-05-19 13:10:20 -070017
18#include "shill/control_interface.h"
19#include "shill/device.h"
20#include "shill/device_info.h"
Darin Petkovafa6fc42011-06-21 16:21:08 -070021#include "shill/ethernet.h"
Paul Stewart26b327e2011-10-19 11:38:09 -070022#include "shill/event_dispatcher.h"
Paul Stewartf1ce5d22011-05-19 13:10:20 -070023#include "shill/manager.h"
Chris Masone7aa5f902011-07-11 11:13:35 -070024#include "shill/profile.h"
Paul Stewartf1ce5d22011-05-19 13:10:20 -070025
Paul Stewartf1ce5d22011-05-19 13:10:20 -070026using std::string;
27
28namespace shill {
Darin Petkovafa6fc42011-06-21 16:21:08 -070029
Chris Masone34af2182011-08-22 11:59:36 -070030// static
31const char EthernetService::kServiceType[] = "ethernet";
32
Paul Stewartf1ce5d22011-05-19 13:10:20 -070033EthernetService::EthernetService(ControlInterface *control_interface,
34 EventDispatcher *dispatcher,
Thieu Le3426c8f2012-01-11 17:35:11 -080035 Metrics *metrics,
Chris Masone6791a432011-07-12 13:23:19 -070036 Manager *manager,
mukesh agrawal51a7e932011-07-27 16:18:26 -070037 const EthernetRefPtr &device)
Thieu Le3426c8f2012-01-11 17:35:11 -080038 : Service(control_interface, dispatcher, metrics, manager,
39 Technology::kEthernet),
mukesh agrawal7a4e4002011-09-06 11:26:05 -070040 ethernet_(device) {
Gaurav Shah435de2c2011-11-17 19:01:07 -080041 set_connectable(true);
Darin Petkovafa6fc42011-06-21 16:21:08 -070042 set_auto_connect(true);
Paul Stewartf1ce5d22011-05-19 13:10:20 -070043}
44
45EthernetService::~EthernetService() { }
46
mukesh agrawal1830fa12011-09-26 14:31:40 -070047void EthernetService::Connect(Error */*error*/) { }
Paul Stewartf1ce5d22011-05-19 13:10:20 -070048
mukesh agrawal0ed0f2e2011-12-05 20:36:17 +000049void EthernetService::Disconnect(Error */*error*/) { }
Paul Stewartf1ce5d22011-05-19 13:10:20 -070050
Paul Stewart22aa71b2011-09-16 12:15:11 -070051bool EthernetService::TechnologyIs(const Technology::Identifier type) const {
52 return ethernet_->TechnologyIs(type);
53}
54
Gaurav Shah1b7a6162011-11-09 11:41:01 -080055std::string EthernetService::GetDeviceRpcId(Error */*error*/) {
Chris Masone95207da2011-06-29 16:50:49 -070056 return ethernet_->GetRpcIdentifier();
57}
58
Chris Masone6515aab2011-10-12 16:19:09 -070059string EthernetService::GetStorageIdentifier() const {
Chris Masone9d779932011-08-25 16:33:41 -070060 return base::StringPrintf("%s_%s",
61 kServiceType, ethernet_->address().c_str());
Chris Masone34af2182011-08-22 11:59:36 -070062}
63
Paul Stewartf1ce5d22011-05-19 13:10:20 -070064} // namespace shill