Ningyuan Wang | bf21578 | 2015-12-04 09:55:39 -0800 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2015 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 | // |
| 16 | |
| 17 | #ifndef DHCP_CLIENT_DEVICE_INFO_H_ |
| 18 | #define DHCP_CLIENT_DEVICE_INFO_H_ |
| 19 | |
| 20 | #include <memory> |
| 21 | #include <string> |
| 22 | |
| 23 | #include <base/lazy_instance.h> |
| 24 | #include <base/macros.h> |
| 25 | |
Ningyuan Wang | 63aa9b5 | 2016-01-19 10:24:59 -0800 | [diff] [blame] | 26 | #include "shill/net/byte_string.h" |
Ningyuan Wang | 88c688a | 2015-12-09 17:59:01 -0800 | [diff] [blame] | 27 | #include "shill/net/rtnl_handler.h" |
Ningyuan Wang | bf21578 | 2015-12-04 09:55:39 -0800 | [diff] [blame] | 28 | #include "shill/net/sockets.h" |
| 29 | |
| 30 | namespace dhcp_client { |
| 31 | |
| 32 | class DeviceInfo { |
| 33 | public: |
| 34 | virtual ~DeviceInfo(); |
| 35 | static DeviceInfo* GetInstance(); |
| 36 | bool GetDeviceInfo(const std::string& interface_name, |
Ningyuan Wang | 63aa9b5 | 2016-01-19 10:24:59 -0800 | [diff] [blame] | 37 | shill::ByteString* mac_address, |
Ningyuan Wang | bf21578 | 2015-12-04 09:55:39 -0800 | [diff] [blame] | 38 | unsigned int* interface_index); |
| 39 | protected: |
| 40 | DeviceInfo(); |
| 41 | |
| 42 | private: |
Ningyuan Wang | 88c688a | 2015-12-09 17:59:01 -0800 | [diff] [blame] | 43 | friend class DeviceInfoTest; |
| 44 | |
Ningyuan Wang | bf21578 | 2015-12-04 09:55:39 -0800 | [diff] [blame] | 45 | std::unique_ptr<shill::Sockets> sockets_; |
Ningyuan Wang | 88c688a | 2015-12-09 17:59:01 -0800 | [diff] [blame] | 46 | shill::RTNLHandler* rtnl_handler_; |
Ningyuan Wang | bf21578 | 2015-12-04 09:55:39 -0800 | [diff] [blame] | 47 | friend struct base::DefaultLazyInstanceTraits<DeviceInfo>; |
| 48 | |
| 49 | DISALLOW_COPY_AND_ASSIGN(DeviceInfo); |
| 50 | }; |
| 51 | |
| 52 | } // namespace dhcp_client |
| 53 | |
| 54 | #endif // DHCP_CLIENT_DEVICE_INFO_H_ |