• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
26 #include "shill/net/byte_string.h"
27 #include "shill/net/rtnl_handler.h"
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,
37                      shill::ByteString* mac_address,
38                      unsigned int* interface_index);
39  protected:
40   DeviceInfo();
41 
42  private:
43   friend class DeviceInfoTest;
44 
45   std::unique_ptr<shill::Sockets> sockets_;
46   shill::RTNLHandler* rtnl_handler_;
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_
55