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_SERVER_H 16 #define OHOS_DHCP_SERVER_H 17 18 #include "i_dhcp_server_callback.h" 19 #include "dhcp_errcode.h" 20 21 namespace OHOS { 22 namespace DHCP { 23 class DhcpServer { 24 public: 25 static std::shared_ptr<DhcpServer> GetInstance(int systemAbilityId); 26 virtual ~DhcpServer(); 27 #ifdef OHOS_ARCH_LITE 28 virtual ErrCode RegisterDhcpServerCallBack(const std::string& ifname, 29 const std::shared_ptr<IDhcpServerCallBack> &callback) = 0; 30 #else 31 virtual ErrCode RegisterDhcpServerCallBack(const std::string& ifname, 32 const sptr<IDhcpServerCallBack> &callback) = 0; 33 #endif 34 virtual ErrCode StartDhcpServer(const std::string& ifname) = 0; 35 virtual ErrCode StopDhcpServer(const std::string& ifname) = 0; 36 virtual ErrCode PutDhcpRange(const std::string& tagName, const DhcpRange& range) = 0; 37 virtual ErrCode RemoveDhcpRange(const std::string& tagName, const DhcpRange& range) = 0; 38 virtual ErrCode RemoveAllDhcpRange(const std::string& tagName) = 0; 39 virtual ErrCode SetDhcpRange(const std::string& ifname, const DhcpRange& range) = 0; 40 virtual ErrCode SetDhcpName(const std::string& ifname, const std::string& tagName) = 0; 41 virtual ErrCode GetDhcpClientInfos(const std::string& ifname, std::vector<std::string>& dhcpClientInfo) = 0; 42 virtual ErrCode UpdateLeasesTime(const std::string& leaseTime) = 0; 43 }; 44 } // namespace DHCP 45 } // namespace OHOS 46 #endif 47