1 /* 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ETHERNET_SERVICE_PROXY_H 17 #define ETHERNET_SERVICE_PROXY_H 18 19 #include <string> 20 21 #include "i_ethernet_service.h" 22 #include "iremote_proxy.h" 23 24 namespace OHOS { 25 namespace NetManagerStandard { 26 class EthernetServiceProxy : public IRemoteProxy<IEthernetService> { 27 public: EthernetServiceProxy(const sptr<IRemoteObject> & impl)28 explicit EthernetServiceProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IEthernetService>(impl) {} 29 virtual ~EthernetServiceProxy() = default; 30 bool WriteInterfaceToken(MessageParcel &data); 31 32 int32_t GetMacAddress(std::vector<MacAddressInfo> &macAddrList) override; 33 int32_t SetIfaceConfig(const std::string &iface, sptr<InterfaceConfiguration> &ic) override; 34 int32_t GetIfaceConfig(const std::string &iface, sptr<InterfaceConfiguration> &ifaceConfig) override; 35 int32_t IsIfaceActive(const std::string &iface, int32_t &activeStatus) override; 36 int32_t GetAllActiveIfaces(std::vector<std::string> &activeIfaces) override; 37 int32_t ResetFactory() override; 38 int32_t RegisterIfacesStateChanged(const sptr<InterfaceStateCallback> &callback) override; 39 int32_t UnregisterIfacesStateChanged(const sptr<InterfaceStateCallback> &callback) override; 40 int32_t SetInterfaceUp(const std::string &iface) override; 41 int32_t SetInterfaceDown(const std::string &iface) override; 42 int32_t GetInterfaceConfig(const std::string &iface, OHOS::nmd::InterfaceConfigurationParcel &cfg) override; 43 int32_t SetInterfaceConfig(const std::string &iface, OHOS::nmd::InterfaceConfigurationParcel &cfg) override; 44 45 private: 46 47 int32_t SendRequest(MessageParcel &data, const std::string &iface, MessageParcel &reply, uint32_t code); 48 static inline BrokerDelegator<EthernetServiceProxy> delegator_; 49 }; 50 } // namespace NetManagerStandard 51 } // namespace OHOS 52 #endif // ETHERNET_SERVICE_PROXY_H 53