• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020-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_C_API_H
16 #define OHOS_DHCP_C_API_H
17 
18 #include "dhcp_error_code.h"
19 #include "dhcp_result_event.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25     /**
26      * @Description : Obtain the dhcp result of specified interface asynchronously.
27      *
28      * @param ifname - interface name, eg:wlan0 [in]
29      * @param pResultNotify - dhcp result notify [in]
30      * @Return : success - DHCP_SUCCESS, failed - others.
31      */
32     DhcpErrorCode RegisterDhcpClientCallBack(const char *ifname, const ClientCallBack *event);
33     /**
34      * @Description : Start dhcp client service of specified interface.
35      *
36      * @param ifname - interface name, eg:wlan0 [in]
37      * @param bIpv6 - can or not get ipv6 [in]
38      * @Return : success - DHCP_SUCCESS, failed - others.
39      */
40     DhcpErrorCode StartDhcpClient(const char *ifname, bool bIpv6);
41     /**
42      * @Description : Stop dhcp client service of specified interface.
43      *
44      * @param ifname - interface name, eg:wlan0 [in]
45      * @param bIpv6 - can or not get ipv6 [in]
46      * @Return : success - DHCP_SUCCESS, failed - others.
47      */
48     DhcpErrorCode StopDhcpClient(const char *ifname, bool bIpv6);
49     /**
50      * @Description : Renew dhcp client service of specified interface.
51      *
52      * @param ifname - interface name, eg:wlan0 [in]
53      * @Return : success - DHCP_SUCCESS, failed - others.
54      */
55     DhcpErrorCode RenewDhcpClient(const char *ifname);
56 
57     DhcpErrorCode RegisterDhcpServerCallBack(const char *ifname, const ServerCallBack *event);
58     DhcpErrorCode StartDhcpServer(const char *ifname);
59     DhcpErrorCode StopDhcpServer(const char *ifname);
60     DhcpErrorCode SetDhcpRange(const char *ifname, const DhcpRange *range);
61     DhcpErrorCode SetDhcpName(const char *ifname, const char *tagName);
62     DhcpErrorCode PutDhcpRange(const char *tagName, const DhcpRange *range);
63     DhcpErrorCode RemoveAllDhcpRange(const char *tagName);
64     DhcpErrorCode RemoveDhcpRange(const char *tagName, const void *range);
65     DhcpErrorCode GetDhcpClientInfos(const char *ifname, int staNumber, DhcpStationInfo *staInfo, int *staSize);
66     DhcpErrorCode UpdateLeasesTime(const char *leaseTime);
67 #ifdef __cplusplus
68 }
69 #endif
70 #endif