Paul Stewart | f1ce5d2 | 2011-05-19 13:10:20 -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 | |
Darin Petkov | afa6fc4 | 2011-06-21 16:21:08 -0700 | [diff] [blame] | 5 | #include "shill/ethernet_service.h" |
| 6 | |
Paul Stewart | f1ce5d2 | 2011-05-19 13:10:20 -0700 | [diff] [blame] | 7 | #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 Masone | 34af218 | 2011-08-22 11:59:36 -0700 | [diff] [blame] | 15 | #include <base/stringprintf.h> |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 16 | #include <chromeos/dbus/service_constants.h> |
Paul Stewart | f1ce5d2 | 2011-05-19 13:10:20 -0700 | [diff] [blame] | 17 | |
| 18 | #include "shill/control_interface.h" |
| 19 | #include "shill/device.h" |
| 20 | #include "shill/device_info.h" |
Darin Petkov | afa6fc4 | 2011-06-21 16:21:08 -0700 | [diff] [blame] | 21 | #include "shill/ethernet.h" |
Paul Stewart | f1ce5d2 | 2011-05-19 13:10:20 -0700 | [diff] [blame] | 22 | #include "shill/manager.h" |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 23 | #include "shill/profile.h" |
Paul Stewart | f1ce5d2 | 2011-05-19 13:10:20 -0700 | [diff] [blame] | 24 | #include "shill/shill_event.h" |
| 25 | |
Paul Stewart | f1ce5d2 | 2011-05-19 13:10:20 -0700 | [diff] [blame] | 26 | using std::string; |
| 27 | |
| 28 | namespace shill { |
Darin Petkov | afa6fc4 | 2011-06-21 16:21:08 -0700 | [diff] [blame] | 29 | |
Chris Masone | 34af218 | 2011-08-22 11:59:36 -0700 | [diff] [blame] | 30 | // static |
| 31 | const char EthernetService::kServiceType[] = "ethernet"; |
| 32 | |
Paul Stewart | f1ce5d2 | 2011-05-19 13:10:20 -0700 | [diff] [blame] | 33 | EthernetService::EthernetService(ControlInterface *control_interface, |
| 34 | EventDispatcher *dispatcher, |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 35 | Manager *manager, |
mukesh agrawal | 51a7e93 | 2011-07-27 16:18:26 -0700 | [diff] [blame] | 36 | const EthernetRefPtr &device) |
mukesh agrawal | 7a4e400 | 2011-09-06 11:26:05 -0700 | [diff] [blame] | 37 | : Service(control_interface, dispatcher, manager, flimflam::kTypeEthernet), |
| 38 | ethernet_(device) { |
Darin Petkov | afa6fc4 | 2011-06-21 16:21:08 -0700 | [diff] [blame] | 39 | set_auto_connect(true); |
Paul Stewart | f1ce5d2 | 2011-05-19 13:10:20 -0700 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | EthernetService::~EthernetService() { } |
| 43 | |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 44 | void EthernetService::Connect(Error *error) { } |
Paul Stewart | f1ce5d2 | 2011-05-19 13:10:20 -0700 | [diff] [blame] | 45 | |
| 46 | void EthernetService::Disconnect() { } |
| 47 | |
Paul Stewart | 22aa71b | 2011-09-16 12:15:11 -0700 | [diff] [blame^] | 48 | bool EthernetService::TechnologyIs(const Technology::Identifier type) const { |
| 49 | return ethernet_->TechnologyIs(type); |
| 50 | } |
| 51 | |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 52 | std::string EthernetService::GetDeviceRpcId() { |
| 53 | return ethernet_->GetRpcIdentifier(); |
| 54 | } |
| 55 | |
Chris Masone | 9d77993 | 2011-08-25 16:33:41 -0700 | [diff] [blame] | 56 | string EthernetService::GetStorageIdentifier() { |
| 57 | return base::StringPrintf("%s_%s", |
| 58 | kServiceType, ethernet_->address().c_str()); |
Chris Masone | 34af218 | 2011-08-22 11:59:36 -0700 | [diff] [blame] | 59 | } |
| 60 | |
Paul Stewart | f1ce5d2 | 2011-05-19 13:10:20 -0700 | [diff] [blame] | 61 | } // namespace shill |