xref: /aosp_15_r20/bootable/recovery/recovery_ui/include/recovery_ui/ethernet_device.h (revision e7c364b630b241adcb6c7726a21055250b91fdac)
1 /*
2  * Copyright (C) 2020 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 _ETHERNET_RECOVERY_DEVICE_H
18 #define _ETHERNET_RECOVERY_DEVICE_H
19 
20 #include "device.h"
21 
22 #include <android-base/unique_fd.h>
23 
24 // Forward declaration to avoid including "ethernet_ui.h".
25 class EthernetRecoveryUI;
26 
27 class EthernetDevice : public Device {
28  public:
29   explicit EthernetDevice(EthernetRecoveryUI* ui);
30   explicit EthernetDevice(EthernetRecoveryUI* ui, std::string interface);
31 
32   void PreRecovery() override;
33   void PreFastboot() override;
34 
35  private:
36   int SetInterfaceFlags(const unsigned set, const unsigned clr);
37   void SetTitleIPv6LinkLocalAddress(const bool interface_up);
38 
39   android::base::unique_fd ctl_sock_;
40   std::string interface_;
41 };
42 
43 #endif  // _ETHERNET_RECOVERY_DEVICE_H
44