1*8542734aSAndroid Build Coastguard Worker /* 2*8542734aSAndroid Build Coastguard Worker * Copyright (C) 2022 The Android Open Source Project 3*8542734aSAndroid Build Coastguard Worker * 4*8542734aSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*8542734aSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*8542734aSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*8542734aSAndroid Build Coastguard Worker * 8*8542734aSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*8542734aSAndroid Build Coastguard Worker * 10*8542734aSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*8542734aSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*8542734aSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*8542734aSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*8542734aSAndroid Build Coastguard Worker * limitations under the License. 15*8542734aSAndroid Build Coastguard Worker */ 16*8542734aSAndroid Build Coastguard Worker #pragma once 17*8542734aSAndroid Build Coastguard Worker 18*8542734aSAndroid Build Coastguard Worker #include <aidl/android/system/net/netd/BnNetd.h> 19*8542734aSAndroid Build Coastguard Worker 20*8542734aSAndroid Build Coastguard Worker namespace android { 21*8542734aSAndroid Build Coastguard Worker namespace net { 22*8542734aSAndroid Build Coastguard Worker namespace aidl { 23*8542734aSAndroid Build Coastguard Worker using NetdHw = ::aidl::android::system::net::netd::BnNetd; 24*8542734aSAndroid Build Coastguard Worker using OemNetwork = ::aidl::android::system::net::netd::INetd::OemNetwork; 25*8542734aSAndroid Build Coastguard Worker using ScopedAStatus = ::ndk::ScopedAStatus; 26*8542734aSAndroid Build Coastguard Worker 27*8542734aSAndroid Build Coastguard Worker class NetdHwAidlService : public NetdHw { 28*8542734aSAndroid Build Coastguard Worker public: 29*8542734aSAndroid Build Coastguard Worker // Start and run the AIDL service. 30*8542734aSAndroid Build Coastguard Worker // This blocks when joining the threadpool so start this in a separate thread. 31*8542734aSAndroid Build Coastguard Worker static void run(); 32*8542734aSAndroid Build Coastguard Worker ScopedAStatus createOemNetwork(OemNetwork* network) override; 33*8542734aSAndroid Build Coastguard Worker ScopedAStatus destroyOemNetwork(int64_t netHandle) override; 34*8542734aSAndroid Build Coastguard Worker ScopedAStatus addRouteToOemNetwork(int64_t networkHandle, const std::string& ifname, 35*8542734aSAndroid Build Coastguard Worker const std::string& destination, 36*8542734aSAndroid Build Coastguard Worker const std::string& nexthop) override; 37*8542734aSAndroid Build Coastguard Worker ScopedAStatus removeRouteFromOemNetwork(int64_t networkHandle, const std::string& ifname, 38*8542734aSAndroid Build Coastguard Worker const std::string& destination, 39*8542734aSAndroid Build Coastguard Worker const std::string& nexthop) override; 40*8542734aSAndroid Build Coastguard Worker ScopedAStatus addInterfaceToOemNetwork(int64_t networkHandle, 41*8542734aSAndroid Build Coastguard Worker const std::string& ifname) override; 42*8542734aSAndroid Build Coastguard Worker ScopedAStatus removeInterfaceFromOemNetwork(int64_t networkHandle, 43*8542734aSAndroid Build Coastguard Worker const std::string& ifname) override; 44*8542734aSAndroid Build Coastguard Worker ScopedAStatus setIpForwardEnable(bool enable) override; 45*8542734aSAndroid Build Coastguard Worker ScopedAStatus setForwardingBetweenInterfaces(const std::string& inputIfName, 46*8542734aSAndroid Build Coastguard Worker const std::string& outputIfName, 47*8542734aSAndroid Build Coastguard Worker bool enable) override; 48*8542734aSAndroid Build Coastguard Worker }; 49*8542734aSAndroid Build Coastguard Worker 50*8542734aSAndroid Build Coastguard Worker } // namespace aidl 51*8542734aSAndroid Build Coastguard Worker } // namespace net 52*8542734aSAndroid Build Coastguard Worker } // namespace android 53