1518678f8Sopenharmony_ci/* 2518678f8Sopenharmony_ci * Copyright (C) 2020-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#ifndef OHOS_DHCP_C_API_H 16518678f8Sopenharmony_ci#define OHOS_DHCP_C_API_H 17518678f8Sopenharmony_ci 18518678f8Sopenharmony_ci#include "dhcp_error_code.h" 19518678f8Sopenharmony_ci#include "dhcp_result_event.h" 20518678f8Sopenharmony_ci 21518678f8Sopenharmony_ci#ifdef __cplusplus 22518678f8Sopenharmony_ciextern "C" { 23518678f8Sopenharmony_ci#endif 24518678f8Sopenharmony_ci 25518678f8Sopenharmony_ci /** 26518678f8Sopenharmony_ci * @Description : Obtain the dhcp result of specified interface asynchronously. 27518678f8Sopenharmony_ci * 28518678f8Sopenharmony_ci * @param ifname - interface name, eg:wlan0 [in] 29518678f8Sopenharmony_ci * @param pResultNotify - dhcp result notify [in] 30518678f8Sopenharmony_ci * @Return : success - DHCP_SUCCESS, failed - others. 31518678f8Sopenharmony_ci */ 32518678f8Sopenharmony_ci DhcpErrorCode RegisterDhcpClientCallBack(const char *ifname, const ClientCallBack *event); 33518678f8Sopenharmony_ci 34518678f8Sopenharmony_ci /** 35518678f8Sopenharmony_ci * @Description : Obtain the dhcp offer result of specified interface asynchronously. 36518678f8Sopenharmony_ci * 37518678f8Sopenharmony_ci * @param ifname - interface name, eg:wlan0 [in] 38518678f8Sopenharmony_ci * @param event - dhcp offer result notify [out] 39518678f8Sopenharmony_ci * @Return : success - DHCP_SUCCESS, failed - others. 40518678f8Sopenharmony_ci */ 41518678f8Sopenharmony_ci DhcpErrorCode RegisterDhcpClientReportCallBack(const char *ifname, const DhcpClientReport *event); 42518678f8Sopenharmony_ci /** 43518678f8Sopenharmony_ci * @Description : Start dhcp client service of specified interface. 44518678f8Sopenharmony_ci * 45518678f8Sopenharmony_ci * @param ifname - interface name, eg:wlan0 [in] 46518678f8Sopenharmony_ci * @param bIpv6 - can or not get ipv6 [in] 47518678f8Sopenharmony_ci * @Return : success - DHCP_SUCCESS, failed - others. 48518678f8Sopenharmony_ci */ 49518678f8Sopenharmony_ci DhcpErrorCode StartDhcpClient(const char *ifname, bool bIpv6); 50518678f8Sopenharmony_ci /** 51518678f8Sopenharmony_ci * @Description : set bssid of specified interface. 52518678f8Sopenharmony_ci * 53518678f8Sopenharmony_ci * @param ifname - interface name, eg:wlan0 [in] 54518678f8Sopenharmony_ci * @param targetBssid - target Bssid [in] 55518678f8Sopenharmony_ci * @Return : success - DHCP_SUCCESS, failed - others. 56518678f8Sopenharmony_ci */ 57518678f8Sopenharmony_ci DhcpErrorCode SetConfiguration(const char *ifname, const RouterConfig config); 58518678f8Sopenharmony_ci /** 59518678f8Sopenharmony_ci * @Description : Stop dhcp client service of specified interface. 60518678f8Sopenharmony_ci * 61518678f8Sopenharmony_ci * @param ifname - interface name, eg:wlan0 [in] 62518678f8Sopenharmony_ci * @param bIpv6 - can or not get ipv6 [in] 63518678f8Sopenharmony_ci * @Return : success - DHCP_SUCCESS, failed - others. 64518678f8Sopenharmony_ci */ 65518678f8Sopenharmony_ci DhcpErrorCode StopDhcpClient(const char *ifname, bool bIpv6); 66518678f8Sopenharmony_ci 67518678f8Sopenharmony_ci DhcpErrorCode RegisterDhcpServerCallBack(const char *ifname, const ServerCallBack *event); 68518678f8Sopenharmony_ci DhcpErrorCode StartDhcpServer(const char *ifname); 69518678f8Sopenharmony_ci DhcpErrorCode StopDhcpServer(const char *ifname); 70518678f8Sopenharmony_ci DhcpErrorCode SetDhcpRange(const char *ifname, const DhcpRange *range); 71518678f8Sopenharmony_ci DhcpErrorCode SetDhcpName(const char *ifname, const char *tagName); 72518678f8Sopenharmony_ci DhcpErrorCode PutDhcpRange(const char *tagName, const DhcpRange *range); 73518678f8Sopenharmony_ci DhcpErrorCode RemoveAllDhcpRange(const char *tagName); 74518678f8Sopenharmony_ci DhcpErrorCode RemoveDhcpRange(const char *tagName, const void *range); 75518678f8Sopenharmony_ci DhcpErrorCode GetDhcpClientInfos(const char *ifname, int staNumber, DhcpStationInfo *staInfo, int *staSize); 76518678f8Sopenharmony_ci DhcpErrorCode UpdateLeasesTime(const char *leaseTime); 77518678f8Sopenharmony_ci#ifdef __cplusplus 78518678f8Sopenharmony_ci} 79518678f8Sopenharmony_ci#endif 80518678f8Sopenharmony_ci#endif