1518678f8Sopenharmony_ci/* 2518678f8Sopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd. 3518678f8Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4518678f8Sopenharmony_ci * you may not use this file except in compliance with the License. 5518678f8Sopenharmony_ci * You may obtain a copy of the License at 6518678f8Sopenharmony_ci * 7518678f8Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8518678f8Sopenharmony_ci * 9518678f8Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10518678f8Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11518678f8Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12518678f8Sopenharmony_ci * See the License for the specific language governing permissions and 13518678f8Sopenharmony_ci * limitations under the License. 14518678f8Sopenharmony_ci */ 15518678f8Sopenharmony_ci#include "dhcp_client_impl.h" 16518678f8Sopenharmony_ci#include "dhcp_c_utils.h" 17518678f8Sopenharmony_ci#include "dhcp_logger.h" 18518678f8Sopenharmony_ci#include "inner_api/dhcp_client.h" 19518678f8Sopenharmony_ci 20518678f8Sopenharmony_ciDEFINE_DHCPLOG_DHCP_LABEL("DhcpClient"); 21518678f8Sopenharmony_ci 22518678f8Sopenharmony_cinamespace OHOS { 23518678f8Sopenharmony_cinamespace DHCP { 24518678f8Sopenharmony_ciNO_SANITIZE("cfi") std::shared_ptr<DhcpClient> DhcpClient::GetInstance(int systemAbilityId) 25518678f8Sopenharmony_ci{ 26518678f8Sopenharmony_ci std::shared_ptr<DhcpClientImpl> pImpl = DelayedSingleton<DhcpClientImpl>::GetInstance(); 27518678f8Sopenharmony_ci if (pImpl && pImpl->Init(systemAbilityId)) { 28518678f8Sopenharmony_ci DHCP_LOGI("init successfully!"); 29518678f8Sopenharmony_ci return pImpl; 30518678f8Sopenharmony_ci } 31518678f8Sopenharmony_ci DHCP_LOGI("new dhcp client failed"); 32518678f8Sopenharmony_ci return nullptr; 33518678f8Sopenharmony_ci} 34518678f8Sopenharmony_ci 35518678f8Sopenharmony_ciDhcpClient::~DhcpClient() 36518678f8Sopenharmony_ci{ 37518678f8Sopenharmony_ci DHCP_LOGI("~DhcpClient()"); 38518678f8Sopenharmony_ci} 39518678f8Sopenharmony_ci} // namespace DHCP 40518678f8Sopenharmony_ci} // namespace OHOS