• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 
16 #ifndef OHOS_DHCP_CLIENT_SERVICE_INTERFACE_H
17 #define OHOS_DHCP_CLIENT_SERVICE_INTERFACE_H
18 
19 #include "i_dhcp_result_notify.h"
20 #include "dhcp_define.h"
21 
22 namespace OHOS {
23 namespace Wifi {
24 class IDhcpClientService {
25 public:
26     /**
27      * @Description : Construct a new dhcp client base service object.
28      *
29      */
IDhcpClientService()30     IDhcpClientService()
31     {
32     }
33 
34     /**
35      * @Description : Destroy the dhcp client base service object.
36      *
37      */
~IDhcpClientService()38     virtual ~IDhcpClientService()
39     {
40     }
41 
42     /**
43      * @Description : Start dhcp client service of specified interface.
44      *
45      * @param ifname - interface name, eg:wlan0 [in]
46      * @param bIpv6 - can or not get ipv6 [in]
47      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
48      */
49     virtual int StartDhcpClient(const std::string& ifname, bool bIpv6) = 0;
50 
51     /**
52      * @Description : Stop dhcp client service of specified interface.
53      *
54      * @param ifname - interface name, eg:wlan0 [in]
55      * @param bIpv6 - can or not get ipv6 [in]
56      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
57      */
58     virtual int StopDhcpClient(const std::string& ifname, bool bIpv6) = 0;
59 
60     /**
61      * @Description : Get dhcp client service running status of specified interface.
62      *
63      * @param ifname - interface name, eg:wlan0 [in]
64      * @Return : 0 - not start, 1 - normal started, -1 - not normal.
65      */
66     virtual int GetDhcpStatus(const std::string& ifname) = 0;
67 
68     /**
69      * @Description : Obtain the dhcp result of specified interface asynchronously.
70      *
71      * @param ifname - interface name, eg:wlan0 [in]
72      * @param pResultNotify - dhcp result notify [in]
73      * @param timeouts - timeout interval [in]
74      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
75      */
76     virtual int GetDhcpResult(const std::string& ifname, IDhcpResultNotify *pResultNotify, int timeouts) = 0;
77 
78     /**
79      * @Description : remove the dhcp result of specified interface asynchronously.
80      *
81      * @param dhcp - dhcp result notify [in]
82      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
83      */
84     virtual int RemoveDhcpResult(IDhcpResultNotify *pResultNotify) = 0;
85 
86     /**
87      * @Description : Obtain the dhcp info of specified interface synchronously.
88      *
89      * @param ifname - interface name, eg:wlan0 [in]
90      * @param dhcp - dhcp info [out]
91      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
92      */
93     virtual int GetDhcpInfo(const std::string& ifname, DhcpServiceInfo& dhcp) = 0;
94 
95     /**
96      * @Description : Renew dhcp client service of specified interface.
97      *
98      * @param ifname - interface name, eg:wlan0 [in]
99      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
100      */
101     virtual int RenewDhcpClient(const std::string& ifname) = 0;
102 
103     /**
104      * @Description : Release dhcp client service of specified interface.
105      *
106      * @param ifname - interface name, eg:wlan0 [in]
107      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
108      */
109     virtual int ReleaseDhcpClient(const std::string& ifname) = 0;
110 };
111 }  // namespace Wifi
112 }  // namespace OHOS
113 #endif