blob: 07459b72efc92bdf82d29c5e299c77b2756a6e18 [file] [log] [blame]
Paul Stewartf1ce5d22011-05-19 13:10:20 -07001// 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
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,
Chris Masone6791a432011-07-12 13:23:19 -070035 Manager *manager,
mukesh agrawal51a7e932011-07-27 16:18:26 -070036 const EthernetRefPtr &device)
Gaurav Shah435de2c2011-11-17 19:01:07 -080037 : Service(control_interface, dispatcher, manager, Technology::kEthernet),
mukesh agrawal7a4e4002011-09-06 11:26:05 -070038 ethernet_(device) {
Gaurav Shah435de2c2011-11-17 19:01:07 -080039 set_connectable(true);
Darin Petkovafa6fc42011-06-21 16:21:08 -070040 set_auto_connect(true);
Paul Stewartf1ce5d22011-05-19 13:10:20 -070041}
42
43EthernetService::~EthernetService() { }
44
mukesh agrawal1830fa12011-09-26 14:31:40 -070045void EthernetService::Connect(Error */*error*/) { }
Paul Stewartf1ce5d22011-05-19 13:10:20 -070046
47void EthernetService::Disconnect() { }
48
Paul Stewart22aa71b2011-09-16 12:15:11 -070049bool EthernetService::TechnologyIs(const Technology::Identifier type) const {
50 return ethernet_->TechnologyIs(type);
51}
52
Gaurav Shah1b7a6162011-11-09 11:41:01 -080053std::string EthernetService::GetDeviceRpcId(Error */*error*/) {
Chris Masone95207da2011-06-29 16:50:49 -070054 return ethernet_->GetRpcIdentifier();
55}
56
Chris Masone6515aab2011-10-12 16:19:09 -070057string EthernetService::GetStorageIdentifier() const {
Chris Masone9d779932011-08-25 16:33:41 -070058 return base::StringPrintf("%s_%s",
59 kServiceType, ethernet_->address().c_str());
Chris Masone34af2182011-08-22 11:59:36 -070060}
61
Paul Stewartf1ce5d22011-05-19 13:10:20 -070062} // namespace shill