1 /* 2 * Copyright (C) 2021-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_SA_EVENT_H 16 #define OHOS_DHCP_SA_EVENT_H 17 18 #include "dhcp_logger.h" 19 #ifndef OHOS_ARCH_LITE 20 #include "iremote_broker.h" 21 #include "iremote_object.h" 22 #include "iservice_registry.h" 23 #endif 24 #include "securec.h" 25 #include "dhcp_errcode.h" 26 #include "../../../interfaces/kits/c/dhcp_result_event.h" 27 #include "../interfaces/i_dhcp_client_callback.h" 28 #include "../interfaces/i_dhcp_server_callback.h" 29 #include "../../../interfaces/inner_api/include/dhcp_define.h" 30 31 class DhcpClientCallBack : public OHOS::Wifi::IDhcpClientCallBack { 32 public: 33 DhcpClientCallBack(); 34 virtual ~DhcpClientCallBack(); 35 public: 36 void OnIpSuccessChanged(int status, const std::string& ifname, OHOS::Wifi::DhcpResult& result) override; 37 void OnIpFailChanged(int status, const std::string& ifname, const std::string& reason) override; 38 #ifndef OHOS_ARCH_LITE 39 OHOS::sptr<OHOS::IRemoteObject> AsObject() override; 40 #endif 41 void RegisterCallBack(const std::string& ifname, const ClientCallBack *event); 42 const ClientCallBack *callbackEvent; 43 }; 44 45 class DhcpServerCallBack : public OHOS::Wifi::IDhcpServerCallBack { 46 public: 47 DhcpServerCallBack(); 48 virtual ~DhcpServerCallBack(); 49 public: 50 void OnServerStatusChanged(int status) override; 51 void OnServerLeasesChanged(const std::string& ifname, std::vector<std::string>& leases) override; 52 void OnServerSerExitChanged(const std::string& ifname) override; 53 #ifndef OHOS_ARCH_LITE 54 OHOS::sptr<OHOS::IRemoteObject> AsObject() override; 55 #endif 56 void RegisterCallBack(const std::string& ifname, const ServerCallBack *event); 57 const ServerCallBack *callbackEvent; 58 }; 59 #endif