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_CLIENT_H 16 #define OHOS_DHCP_CLIENT_H 17 18 #include "i_dhcp_client_callback.h" 19 #include "dhcp_errcode.h" 20 21 namespace OHOS { 22 namespace DHCP { 23 class DhcpClient { 24 public: 25 static std::shared_ptr<DhcpClient> GetInstance(int systemAbilityId); 26 virtual ~DhcpClient(); 27 #ifdef OHOS_ARCH_LITE 28 virtual ErrCode RegisterDhcpClientCallBack(const std::string& ifname, 29 const std::shared_ptr<IDhcpClientCallBack> &callback) = 0; 30 #else 31 virtual ErrCode RegisterDhcpClientCallBack(const std::string& ifname, 32 const sptr<IDhcpClientCallBack> &callback) = 0; 33 #endif 34 virtual ErrCode StartDhcpClient(const std::string& ifname, bool bIpv6) = 0; 35 virtual ErrCode SetConfiguration(const std::string& ifname, const RouterConfig& config) = 0; 36 virtual ErrCode StopDhcpClient(const std::string& ifname, bool bIpv6) = 0; 37 }; 38 } // namespace DHCP 39 } // namespace OHOS 40 #endif 41