• 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_SERVER_SERVICE_INTERFACE_H
17 #define OHOS_DHCP_SERVER_SERVICE_INTERFACE_H
18 
19 #include "i_dhcp_result_notify.h"
20 #include "dhcp_define.h"
21 
22 
23 namespace OHOS {
24 namespace Wifi {
25 class IDhcpServerService {
26 public:
27     /**
28      * @Description : Construct a new dhcp server base service object.
29      *
30      */
IDhcpServerService()31     IDhcpServerService()
32     {
33     }
34 
35     /**
36      * @Description : Destroy the dhcp server base service object.
37      *
38      */
~IDhcpServerService()39     virtual ~IDhcpServerService()
40     {
41     }
42 
43     /**
44      * @Description : Start dhcp server service of specified interface.
45      *
46      * @param ifname - interface name, eg:wlan0 [in]
47      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
48      */
49     virtual int StartDhcpServer(const std::string& ifname) = 0;
50 
51     /**
52      * @Description : Stop dhcp server service of specified interface.
53      *
54      * @param ifname - interface name, eg:wlan0 [in]
55      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
56      */
57     virtual int StopDhcpServer(const std::string& ifname) = 0;
58 
59     /**
60      * @Description : Get dhcp server service running status.
61      *
62      * @Return : 0 - not start, 1 - normal started.
63      */
64     virtual int GetServerStatus(void) = 0;
65 
66     /**
67      * @Description : Add or update dhcp ip address pool.
68      *
69      * @param tagName - ip address pool tag name [in]
70      * @param range - ip address range [in]
71      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
72      */
73     virtual int PutDhcpRange(const std::string& tagName, const DhcpRange& range) = 0;
74 
75     /**
76      * @Description : Remove dhcp ip address pool.
77      *
78      * @param tagName - ip address pool tag name [in]
79      * @param range - ip address range [in]
80      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
81      */
82     virtual int RemoveDhcpRange(const std::string& tagName, const DhcpRange& range) = 0;
83 
84     /**
85      * @Description : Remove all dhcp ip address pool.
86      *
87      * @param tagName - ip address pool tag name [in]
88      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
89      */
90     virtual int RemoveAllDhcpRange(const std::string& tagName) = 0;
91 
92     /**
93      * @Description : Set dhcp ip address range of specified interface.
94      *
95      * @param ifname - interface name, eg:wlan0 [in]
96      * @param range - ip address range [in]
97      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
98      */
99     virtual int SetDhcpRange(const std::string& ifname, const DhcpRange& range) = 0;
100 
101     /**
102      * @Description : Set dhcp ip address pool of specified interface.
103      *
104      * @param ifname - interface name, eg:wlan0 [in]
105      * @param tagName - ip address pool tag name [in]
106      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
107      */
108     virtual int SetDhcpRange(const std::string& ifname, const std::string& tagName) = 0;
109 
110     /**
111      * @Description : Get dhcp server lease info.
112      *
113      * @param ifname - interface name, eg:wlan0 [in]
114      * @param leases - lease info [out]
115      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
116      */
117     virtual int GetLeases(const std::string& ifname, std::vector<std::string>& leases) = 0;
118 
119     /**
120      * @Description : Obtain the abnormal exit status of dhcp server process.
121      *
122      * @param ifname - interface name, eg:wlan0 [in]
123      * @param pResultNotify - pointer to dhcp result notify [in]
124      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
125      */
126     virtual int GetDhcpSerProExit(const std::string& ifname, IDhcpResultNotify *pResultNotify) = 0;
127 
128     /**
129      * @Description : Reload dhcp server config.
130      *
131      * @param ifname - interface name, eg:wlan0 [in]
132      * @Return : success - DHCP_OPT_SUCCESS, failed - others.
133      */
134     virtual int ReloadConfig(const std::string& ifname) = 0;
135 };
136 }  // namespace Wifi
137 }  // namespace OHOS
138 #endif