blob: 4cb6c19cb37128af30dbf88b3fc0f5ff7075c9d4 [file] [log] [blame]
Ningyuan Wangbf215782015-12-04 09:55:39 -08001//
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 Wang63aa9b52016-01-19 10:24:59 -080026#include "shill/net/byte_string.h"
Ningyuan Wang88c688a2015-12-09 17:59:01 -080027#include "shill/net/rtnl_handler.h"
Ningyuan Wangbf215782015-12-04 09:55:39 -080028#include "shill/net/sockets.h"
29
30namespace dhcp_client {
31
32class DeviceInfo {
33 public:
34 virtual ~DeviceInfo();
35 static DeviceInfo* GetInstance();
36 bool GetDeviceInfo(const std::string& interface_name,
Ningyuan Wang63aa9b52016-01-19 10:24:59 -080037 shill::ByteString* mac_address,
Ningyuan Wangbf215782015-12-04 09:55:39 -080038 unsigned int* interface_index);
39 protected:
40 DeviceInfo();
41
42 private:
Ningyuan Wang88c688a2015-12-09 17:59:01 -080043 friend class DeviceInfoTest;
44
Ningyuan Wangbf215782015-12-04 09:55:39 -080045 std::unique_ptr<shill::Sockets> sockets_;
Ningyuan Wang88c688a2015-12-09 17:59:01 -080046 shill::RTNLHandler* rtnl_handler_;
Ningyuan Wangbf215782015-12-04 09:55:39 -080047 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_