1 /* 2 * Copyright (C) 2023 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 #ifndef OHOS_DHCP_CLIENT_CALLBACK_STUB_H 16 #define OHOS_DHCP_CLIENT_CALLBACK_STUB_H 17 #ifndef OHOS_ARCH_LITE 18 #include "iremote_stub.h" 19 #include "iremote_object.h" 20 #endif 21 #include "../interfaces/i_dhcp_client_callback.h" 22 #include "dhcp_errcode.h" 23 24 namespace OHOS { 25 namespace Wifi { 26 class DhcpClientCallBackStub : public IRemoteStub<IDhcpClientCallBack> { 27 public: 28 DhcpClientCallBackStub(); 29 virtual ~DhcpClientCallBackStub(); 30 31 virtual int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, 32 MessageOption &option) override; 33 void RegisterCallBack(const sptr<IDhcpClientCallBack> &callBack); 34 bool IsRemoteDied() const; 35 void SetRemoteDied(bool val); 36 void OnIpSuccessChanged(int status, const std::string& ifname, DhcpResult& result) override; 37 void OnIpFailChanged(int status, const std::string& ifname, const std::string& reason) override; 38 private: 39 int RemoteOnIpSuccessChanged(uint32_t code, MessageParcel &data, MessageParcel &reply); 40 int RemoteOnIpFailChanged(uint32_t code, MessageParcel &data, MessageParcel &reply); 41 42 sptr<IDhcpClientCallBack> callback_; 43 bool mRemoteDied; 44 }; 45 } // namespace Wifi 46 } // namespace OHOS 47 #endif