1/*
2 * Copyright (c) 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
16/**
17 * @addtogroup Hostapd
18 * @{
19 *
20 * @brief Provides APIs for the upper-layer WLAN service.
21 *
22 * You can use the APIs to enable or disable a WLAN hotspot, scan for hotspots, connect to a WLAN hotspot,
23 * manage WLAN chips, network devices, and power, and apply for, release, and move network data buffers.
24 *
25 * @since 4.1
26 * @version 1.0
27 */
28
29/**
30 * @file IHostapdInterface.idl
31 *
32 * @brief Provides APIs to enable or disable a WLAN hotspot, scan for hotspots, connect to or disconnect from a WLAN hotspot,
33 * set the country code, and manage network devices.
34 *
35 * @since 4.1
36 * @version 1.0
37 */
38
39/**
40 * @brief Defines the package path of the Hostapd module interface.
41 *
42 * @since 4.1
43 * @version 1.0
44 */
45
46package ohos.hdi.wlan.hostapd.v1_0;
47
48import ohos.hdi.wlan.hostapd.v1_0.HostapdTypes;
49import ohos.hdi.wlan.hostapd.v1_0.IHostapdCallback;
50
51/**
52 * @brief Defines an interface for the upper-layer WLAN service.
53 *
54 * @since 4.1
55 * @version 1.0
56 */
57
58interface IHostapdInterface {
59    /**
60     * @brief Start AP.
61     *
62     * @param ifName Indicates the NIC name.
63     * @param id - ap id.
64     *
65     * @return Returns <b>0</b> if the operation is successful.
66     * @return Returns a negative value if the operation fails.
67     *
68     * @since 4.1
69     * @version 1.0
70     */
71    StartAp();
72
73    /**
74     * @brief Start AP for different ifName.
75     *
76     * @param ifName Indicates the NIC name.
77     * @param id - ap id.
78     *
79     * @return Returns <b>0</b> if the operation is successful.
80     * @return Returns a negative value if the operation fails.
81     *
82     * @since 4.1
83     * @version 1.0
84     */
85    StartApWithCmd([in] String ifName, [in] int id);
86
87    /**
88     * @brief Stop AP.
89     *
90     * @param ifName Indicates the NIC name.
91     * @param id - ap id.
92     *
93     * @return Returns <b>0</b> if the operation is successful.
94     * @return Returns a negative value if the operation fails.
95     *
96     * @since 4.1
97     * @version 1.0
98     */
99    StopAp();
100
101    /**
102     * @brief Enable AP.
103     *
104     * @param ifName Indicates the NIC name.
105     * @param id - ap id.
106     *
107     * @return Returns <b>0</b> if the operation is successful.
108     * @return Returns a negative value if the operation fails.
109     *
110     * @since 4.1
111     * @version 1.0
112     */
113    EnableAp([in] String ifName, [in] int id);
114
115    /**
116     * @brief Disable AP.
117     *
118     * @param ifName Indicates the NIC name.
119     * @param id - ap id.
120     *
121     * @return Returns <b>0</b> if the operation is successful.
122     * @return Returns a negative value if the operation fails.
123     *
124     * @since 4.1
125     * @version 1.0
126     */
127    DisableAp([in] String ifName, [in] int id);
128
129    /**
130     * @brief Set the AP password.
131     *
132     * @param pass - Password.
133     *
134     * @return Returns <b>0</b> if the operation is successful.
135     * @return Returns a negative value if the operation fails.
136     *
137     * @since 4.1
138     * @version 1.0
139     */
140    SetApPasswd([in] String ifName, [in] String pass, [in]int id);
141
142    /**
143     * @brief Set the AP Name.
144     *
145     * @param name - The SAP SSID.
146     *
147     * @return Returns <b>0</b> if the operation is successful.
148     * @return Returns a negative value if the operation fails.
149     *
150     * @since 4.1
151     * @version 1.0
152     */
153    SetApName([in] String ifName, [in] String name, [in] int id);
154
155    /**
156     * @brief Set the AP securityType.
157     *
158     * @param securityType - The SAP security type, eg:wpa/wpa_psk etc.
159     *
160     * @return Returns <b>0</b> if the operation is successful.
161     * @return Returns a negative value if the operation fails.
162     *
163     * @since 4.1
164     * @version 1.0
165     */
166    SetApWpaValue([in] String ifName, [in] int securityType, [in] int id);
167
168    /**
169     * @brief Set the AP bandwith.
170     *
171     * @param band - The SAP bandwith.
172     *
173     * @return Returns <b>0</b> if the operation is successful.
174     * @return Returns a negative value if the operation fails.
175     *
176     * @since 4.1
177     * @version 1.0
178     */
179    SetApBand([in] String ifName, [in] int band, [in] int id);
180
181    /**
182     * @brief Set the AP need support protocol type.
183     *
184     * @param value - Hostapd config value.
185     *
186     * @return Returns <b>0</b> if the operation is successful.
187     * @return Returns a negative value if the operation fails.
188     *
189     * @since 4.1
190     * @version 1.0
191     */
192    SetAp80211n([in] String ifName, [in] int value, [in] int id);
193
194    /**
195     * @brief Set AP Wmm mode.
196     *
197     * @param value - Enable or Disable Wmm.
198     *
199     * @return Returns <b>0</b> if the operation is successful.
200     * @return Returns a negative value if the operation fails.
201     *
202     * @since 4.1
203     * @version 1.0
204     */
205    SetApWmm([in] String ifName, [in] int value, [in] int id);
206
207    /**
208     * @brief Set AP channel.
209     *
210     * @param channel - SAP channel.
211     *
212     * @return Returns <b>0</b> if the operation is successful.
213     * @return Returns a negative value if the operation fails.
214     *
215     * @since 4.1
216     * @version 1.0
217     */
218    SetApChannel([in] String ifName, [in] int channel, [in] int id);
219
220    /**
221     * @brief Set AP max connection.
222     *
223     * @param maxConn - Set the maximum number of connected devices.
224     *
225     * @return Returns <b>0</b> if the operation is successful.
226     * @return Returns a negative value if the operation fails.
227     *
228     * @since 4.1
229     * @version 1.0
230     */
231    SetApMaxConn([in] String ifName, [in] int maxConn, [in] int id);
232
233    /**
234     * @brief To check the configuration information, deliver security parameters to
235     * the driver, and clear old AP information after set ap configuration information.
236     *
237     * @param ifName Indicates the NIC name.
238     * @param id - ap id.
239     *
240     * @return Returns <b>0</b> if the operation is successful.
241     * @return Returns a negative value if the operation fails.
242     *
243     * @since 4.1
244     * @version 1.0
245     */
246    ReloadApConfigInfo([in] String ifName, [in] int id);
247
248    /**
249     * @brief To set the blocklish filtering in AP mode to prohibit
250     * the MAC address connection.
251     *
252     * @param mac - Blocklisted MAC address.
253     *
254     * @return Returns <b>0</b> if the operation is successful.
255     * @return Returns a negative value if the operation fails.
256     *
257     * @since 4.1
258     * @version 1.0
259     */
260    SetMacFilter([in] String ifName, [in] String mac, [in] int id);
261
262    /**
263     * @brief To set blocklist filtering in AP mode and delete a specified MAC
264     * address from the blocklist.
265     *
266     * @param mac - Blocklisted MAC address.
267     *
268     * @return Returns <b>0</b> if the operation is successful.
269     * @return Returns a negative value if the operation fails.
270     *
271     * @since 4.1
272     * @version 1.0
273     */
274    DelMacFilter([in] String ifName, [in] String mac, [in] int id);
275
276    /**
277     * @brief Obtains information about all connected STAs.
278     *
279     * @param infos - Connected STA information array.
280     * @param size - Obtains the size of all sta information arrays and Size of the
281     *               obtained sta information array.
282     *
283     * @return Returns <b>0</b> if the operation is successful.
284     * @return Returns a negative value if the operation fails.
285     *
286     * @since 4.1
287     * @version 1.0
288     */
289    GetStaInfos([in] String ifName, [out] String buf, [in] int size, [in] int id);
290
291    /**
292     * @brief To disconnect the specified STA connection.
293     *
294     * @param mac - Disconnect the specified mac.
295     *
296     * @return Returns <b>0</b> if the operation is successful.
297     * @return Returns a negative value if the operation fails.
298     *
299     * @since 4.1
300     * @version 1.0
301     */
302    DisassociateSta([in] String ifName, [in] String mac, [in] int id);
303
304    /**
305     * @brief Registers a callback to listen for asynchronous events.
306     *
307     * @param cbFunc Indicates the callback to register.
308     * @param ifName Indicates the NIC name.
309     *
310     * @return Returns <b>0</b> if the operation is successful.
311     * @return Returns a negative value if the operation fails.
312     *
313     * @since 4.1
314     * @version 1.0
315     */
316    RegisterEventCallback([in] IHostapdCallback cbFunc, [in] String ifName);
317
318    /**
319     * @brief Unregisters a callback.
320     *
321     * @param cbFunc Indicates the callback to unregister.
322     * @param ifName Indicates the NIC name.
323     *
324     * @return Returns <b>0</b> if the operation is successful.
325     * @return Returns a negative value if the operation fails.
326     *
327     * @since 4.1
328     * @version 1.0
329     */
330    UnregisterEventCallback([in] IHostapdCallback cbFunc, [in] String ifName);
331
332     /**
333     * @brief Used to process cmd of Hostapd
334     *
335     * @param ifName Indicates the NIC name.
336     * @param cmd Indicates command of HostApd from WifiHal
337     *
338     * @return Returns <b>0</b> if the operation is successful.
339     * @return Returns a negative value if the operation fails.
340     *
341     * @since 4.1
342     * @version 1.0
343     */
344     HostApdShellCmd([in] String ifName, [in] String cmd);
345 }
346