• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 /**
10  * @addtogroup WLAN
11  * @{
12  *
13  * @brief Provides cross-OS migration, component adaptation, and modular assembly and compilation.
14  *
15  * Based on the unified APIs provided by the WLAN module, developers of the Hardware Driver Interface
16  * (HDI) are capable of creating, disabling, scanning for, and connecting to WLAN hotspots, managing WLAN chips,
17  * network devices, and power, and applying for, releasing, and moving network data buffers.
18  *
19  * @since 1.0
20  * @version 1.0
21  */
22 
23 /**
24  * @file wifi_mac80211_ops.h
25  *
26  * @brief Declares Media Access Control (MAC) APIs and functions related to control flows.
27  *
28  * This file declares APIs for scanning, connection, disconnection, and mode conversion, as well as data
29  * structures of the parameters of these APIs.
30  *
31  * @since 1.0
32  * @version 1.0
33  */
34 
35 #ifndef WIFI_MAC80211_OPS_H
36 #define WIFI_MAC80211_OPS_H
37 
38 #include "net_device.h"
39 #include "hdf_wifi_cmd.h"
40 
41 /**
42  * @brief Indicates the length of the MAC address of the device.
43  *
44  * The value is <b>6</b>.
45  *
46  * @since 1.0
47  * @version 1.0
48  */
49 #define IEEE80211_MAC_ADDR_LEN 6
50 /**
51  * @brief Indicates the maximum length of the SSID of the device.
52  *
53  * The value is <b>32</b>.
54  *
55  * @since 1.0
56  * @version 1.0
57  */
58 #define IEEE80211_MAX_SSID_LEN 32
59 /**
60  * @brief Indicates the length of a reserved field for the WLAN connection parameters.
61  *
62  * The value is <b>3</b>.
63  *
64  * @since 1.0
65  * @version 1.0
66  */
67 #define WIFI_CONNECT_PARM_RESV_SIZE 3
68 /**
69  * @brief Indicates that the frequency is not specified.
70  *
71  * The value is <b>0</b>.
72  *
73  * @since 1.0
74  * @version 1.0
75  */
76 #define WLAN_FREQ_NOT_SPECFIED 0
77 /**
78  * @brief Indicates the maximum length of the hotspot SSID array.
79  *
80  * The value is <b>32</b>.
81  *
82  * @since 1.0
83  * @version 1.0
84  */
85 #define OAL_IEEE80211_MAX_SSID_LEN 32
86 /**
87  * @brief Indicates the maximum number of channels to scan for.
88  *
89  * The value is <b>14</b>.
90  *
91  * @since 1.0
92  * @version 1.0
93  */
94 #define MAX_SCAN_CHANNELS 14
95 /**
96  * @brief Indicates a reserved field for a scan request.
97  *
98  * The value is <b>2</b>.
99  *
100  * @since 1.0
101  * @version 1.0
102  */
103 #define SCAN_REQUEST_RESV_SIZE 2
104 /**
105  * @brief Indicates the maximum number of frequency filters.
106  *
107  * The value is <b>200</b>.
108  *
109  * @since 1.0
110  * @version 1.0
111  */
112 #define MAX_FREQ_FTILTER_COUNT 200
113 /**
114  * @brief Indicates the maximum number of cipher suites.
115  *
116  * The value is <b>5</b>.
117  *
118  * @since 1.0
119  * @version 1.0
120  */
121 #define NL80211_MAX_NR_CIPHER_SUITES 5
122 /**
123  * @brief Indicates the maximum number of AKM suites.
124  *
125  * The value is <b>2</b>.
126  *
127  * @since 1.0
128  * @version 1.0
129  */
130 #define NL80211_MAX_NR_AKM_SUITES 2
131 
132 /**
133  * @brief Enumerates frequency bands.
134  *
135  * @since 1.0
136  * @version 1.0
137  */
138 enum Ieee80211Band {
139     IEEE80211_BAND_2GHZ = 0, /**< 2.4 GHz */
140     IEEE80211_BAND_5GHZ,     /**< 5 GHz */
141     IEEE80211_NUM_BANDS      /**< Number of frequency bands */
142 };
143 
144 /**
145  * @brief Enumerates channel widths.
146  *
147  * @since 1.0
148  * @version 1.0
149  */
150 enum Ieee80211ChannelWidth {
151     WLAN_CHANNEL_WIDTH_10   = BIT(0),   /**< 10 MHz */
152     WLAN_CHANNEL_WIDTH_20   = BIT(1),   /**< 20 MHz */
153     WLAN_CHANNEL_WIDTH_40P  = BIT(2),   /**< 40 MHz (two 20 MHz channels, with the primary channel
154                                          * having a higher frequency
155                                          */
156     WLAN_CHANNEL_WIDTH_40M  = BIT(3),   /**< 40 MHz (two 20 MHz channels, with the primary channel
157                                          * having a lower frequency
158                                          */
159     WLAN_CHANNEL_WIDTH_80   = BIT(4),   /**< 80 MHz */
160     WLAN_CHANNEL_WIDTH_160  = BIT(5),   /**< 160 MHz */
161 };
162 
163 /**
164  * @brief Enumerates WLAN modes.
165  *
166  * @since 1.0
167  * @version 1.0
168  */
169 enum WlanWorkMode {
170     WLAN_WORKMODE_STA = 2,  /**< STA mode */
171     WLAN_WORKMODE_AP = 3,    /**< AP mode */
172     WLAN_WORKMODE_AP_VLAN,
173     WLAN_WORKMODE_WDS,
174     WLAN_WORKMODE_MONITOR,
175     WLAN_WORKMODE_MESH_POINT,
176     WLAN_WORKMODE_P2P_CLIENT,
177     WLAN_WORKMODE_P2P_GO,
178     WLAN_WORKMODE_P2P_DEVICE,
179 };
180 
181 /**
182  * @brief Describes a key.
183  *
184  * @since 1.0
185  * @version 1.0
186  */
187 struct KeyParams {
188     uint8_t *key;    /**< Key content */
189     uint8_t *seq;    /**< Content of a Temporal Key Integrity Protocol (TKIP) or Counter Mode Cipher Block Chaining
190                       * Message Authentication Code Protocol (CCMP) key
191                       */
192     int32_t keyLen;  /**< Key length */
193     int32_t seqLen;  /**< Length of a TKIP or CCMP key */
194     uint32_t cipher; /**< Cipher suite */
195 };
196 
197 #define UINT32_BIT(BIT) (((uint32_t)1) << (BIT))
198 
199 #define WLAN_CHANNEL_FLAG_DFS_UNKNOWN 0x00000000
200 #define WLAN_CHANNEL_FLAG_DFS_MASK 0x00000300
201 
202 /**
203  * @brief Enumerates WLAN channel capability flags.
204  *
205  * @since 1.0
206  * @version 1.0
207  */
208 enum WlanChannelCapabilityFlags {
209     WLAN_CHANNEL_FLAG_DISABLED = UINT32_BIT(0), /**< Channel disabled */
210     WLAN_CHANNEL_FLAG_NO_IR = UINT32_BIT(1),    /**< Infrared light (IR) not supported */
211     WLAN_CHANNEL_FLAG_RADAR = UINT32_BIT(3),    /**< Radar supported */
212     WLAN_CHANNEL_FLAG_HT40PLUS = UINT32_BIT(4), /**< A 40 MHz channel that consists of two 20 MHz channels,
213                                                  * with the primary channel having a higher frequency
214                                                  */
215     WLAN_CHANNEL_FLAG_HT40MINUS = UINT32_BIT(5), /**< A 40 MHz channel that consists of two 20 MHz channels,
216                                                   * with the primary channel having a lower frequency
217                                                   */
218     WLAN_CHANNEL_FLAG_HT40 = UINT32_BIT(6),      /**< 40 MHz channel */
219     WLAN_CHANNEL_FLAG_SURVEY_LIST_INITIALIZED = UINT32_BIT(7), /**< Survey list initialized */
220     WLAN_CHANNEL_FLAG_DFS_USABLE = UINT32_BIT(8),       /**< Dynamic frequency selection (DFS) supported */
221     WLAN_CHANNEL_FLAG_DFS_UNAVAILABLE = UINT32_BIT(9),  /**< DFS disabled */
222     WLAN_CHANNEL_FLAG_DFS_AVAILABLE = WLAN_CHANNEL_FLAG_DFS_USABLE | WLAN_CHANNEL_FLAG_DFS_UNAVAILABLE,
223     WLAN_CHANNEL_FLAG_VHT_10_70 =
224         UINT32_BIT(11), /**< A 80 MHz channel: Frequency
225                          * band = Channel's center frequency - 10 MHz to the channel's center frequency + 70 MHz
226                          */
227     WLAN_CHANNEL_FLAG_VHT_30_50 =
228         UINT32_BIT(12), /**< A 80 MHz channel: Frequency
229                          * band = Channel's center frequency - 30 MHz to the channel's center frequency + 50 MHz
230                          */
231     WLAN_CHANNEL_FLAG_VHT_50_30 =
232         UINT32_BIT(13), /**< A 80 MHz channel: Frequency
233                          * band = Channel's center frequency - 50 MHz to the channel's center frequency + 30 MHz
234                          */
235     WLAN_CHANNEL_FLAG_VHT_70_10 =
236         UINT32_BIT(14), /**< A 80 MHz channel: Frequency
237                          * band = Channel's center frequency - 70 MHz to the channel's center frequency + 10 MHz
238                          */
239     WLAN_CHANNEL_FLAG_INDOOR_ONLY = UINT32_BIT(16),   /**< Used only indoors */
240     WLAN_CHANNEL_FLAG_GO_CONCURRENT = UINT32_BIT(17), /**< Go Concurrent supported */
241     WLAN_CHANNEL_FLAG_VHT_10_150 = UINT32_BIT(20),  /**< A 160 MHz channel: Frequency band = Channel's center
242                                                      * frequency - 10 MHz to the channel's center frequency + 150 MHz
243                                                      */
244     WLAN_CHANNEL_FLAG_VHT_30_130 = UINT32_BIT(21),  /**< A 160 MHz channel: Frequency band = Channel's center
245                                                      * frequency - 30 MHz to the channel's center frequency + 130 MHz
246                                                      */
247     WLAN_CHANNEL_FLAG_VHT_50_110 = UINT32_BIT(22),  /**< A 160 MHz channel: Frequency band = Channel's center
248                                                      * frequency - 50 MHz to the channel's center frequency + 110 MHz
249                                                      */
250     WLAN_CHANNEL_FLAG_VHT_70_90 = UINT32_BIT(23),   /**< A 160 MHz channel: Frequency band = Channel's center
251                                                      frequency - 70 MHz to the channel's center frequency + 90 MHz
252                                                      */
253     WLAN_CHANNEL_FLAG_VHT_90_70 = UINT32_BIT(24),   /**< A 160 MHz channel: Frequency band = Channel's center
254                                                      * frequency - 90 MHz to the channel's center frequency + 70 MHz
255                                                      */
256     WLAN_CHANNEL_FLAG_VHT_110_50 = UINT32_BIT(25),  /**< A 160 MHz channel: Frequency band = Channel's center
257                                                      * frequency - 110 MHz to the channel's center frequency + 50 MHz
258                                                      */
259     WLAN_CHANNEL_FLAG_VHT_130_30 = UINT32_BIT(26),  /**< A 160 MHz channel: Frequency band = Channel's center
260                                                      * frequency - 130 MHz to the channel's center frequency + 30 MHz
261                                                      */
262     WLAN_CHANNEL_FLAG_VHT_150_10 = UINT32_BIT(27),  /**< A 160 MHz channel: Frequency band = Channel's center
263                                                      * frequency - 150 MHz to the channel's center frequency + 10 MHz
264                                                      */
265 };
266 
267 /**
268  * @brief Describes a communication channel.
269  *
270  * @since 1.0
271  * @version 1.0
272  */
273 struct WlanChannel {
274     uint8_t channelId;   /**< Channel ID */
275     uint32_t centerFreq; /**< Center frequency */
276     uint32_t flags;      /**< Flags for the channel, as enumerated in <b>WlanChannelCapabilityFlags</b> */
277 };
278 
279 /**
280  * @brief Describes a band.
281  *
282  * @since 1.0
283  * @version 1.0
284  */
285 struct WlanBand {
286     uint16_t channelCount;          /**< Number of channels */
287     struct WlanChannel channels[0]; /**< WLAN channel structures */
288 };
289 
290 /**
291  * @brief Describes an SSID.
292  *
293  * @since 1.0
294  * @version 1.0
295  */
296 struct WlanSSID {
297     uint8_t ssid[IEEE80211_MAX_SSID_LEN];   /**< SSID array */
298     uint8_t ssidLen;                        /**< SSID length */
299 };
300 
301 /**
302  * @brief Describes scan request parameters.
303  *
304  * @since 1.0
305  * @version 1.0
306  */
307 struct WlanScanRequest {
308     uint8_t ssidCount;      /**< Number of SSIDs */
309     uint8_t freqsCount;     /**< Number of frequencies */
310     uint8_t *bssid;         /**< BSSID to scan for */
311     struct WlanSSID *ssids; /**< SSIDs to scan for */
312     uint32_t *freqs;        /**< An array of frequencies */
313     uint32_t extraIEsLen;   /**< Length of an extended information element (IE) */
314     uint8_t *extraIEs;      /**< Extended IEs */
315 };
316 
317 /**
318  * @brief Describes cryptography settings.
319  *
320  * @since 1.0
321  * @version 1.0
322  */
323 struct CryptoSettings {
324     uint32_t wpaVersions;      /**< WPA version */
325     uint32_t cipherGroup;      /**< Cipher group */
326     int32_t n_ciphersPairwise; /**< Number of unicast ciphers supported by the AP */
327     uint32_t ciphersPairwise[NL80211_MAX_NR_CIPHER_SUITES]; /**< Unicast cipher suites. The maximum number of
328                                                              * unicast cipher suites is specified by
329                                                              * {@link NL80211_MAX_NR_CIPHER_SUITES}.
330                                                              */
331     int32_t n_akmSuites;        /**< Number of authentication and key management (AKM) suites */
332     uint32_t akmSuites[NL80211_MAX_NR_AKM_SUITES];  /**< AKM suites. The maximum number of AKM suites is specified
333                                                      * by {@link NL80211_MAX_NR_AKM_SUITES}.
334                                                      */
335     uint16_t controlPortEthertype;  /**< Data can be transmitted over an unauthenticated port. */
336     int8_t controlPort;             /**< Whether the user space control port is authorized. The value <b>true</b>
337                                      * indicates that the user space control port is unauthorized.
338                                      */
339     int8_t controlPortNoEncrypt;   /**< Whether to encrypt frames transmitted over the control port.
340                                     * The value <b>1</b> indicates that the frames are not encrypted.
341                                     */
342 };
343 
344 /**
345  * @brief Describes parameters for a connection request.
346  *
347  * @since 1.0
348  * @version 1.0
349  */
350 typedef struct WlanConnectParams {
351     uint32_t centerFreq;    /**< Connection channel. If this parameter is not specified, the connection channel
352                              * is automatically obtained from the scan result.
353                              */
354     uint8_t *bssid;         /**< AP BSSID. If this parameter is not specified, the AP BSSID is automatically
355                              * obtained from the scan result.
356                              */
357     uint8_t *ssid;          /**< SSID */
358     uint8_t *ie;            /**< IE information required for the connection */
359     uint32_t ssidLen;       /**< SSID length */
360     uint32_t ieLen;         /**< IE length */
361     struct CryptoSettings crypto; /**< Cryptography information */
362     const uint8_t *key;           /**< Wired Equivalent Privacy (WEP) key used for Shared Key
363                                    * Authentication (SKA)
364                                    */
365     uint8_t authType;             /**< Authorization type */
366     uint8_t privacy;              /**< Whether to use a privacy-enabled AP */
367     uint8_t keyLen;               /**< Key length */
368     uint8_t keyIdx;               /**< Index of the WEP key used for SKA */
369     uint8_t mfp;                  /**< Whether to enable Management Frame Protection (MFP) */
370     uint8_t aucResv[WIFI_CONNECT_PARM_RESV_SIZE];  /**< Reserved field */
371 } WlanConnectParams;
372 
373 /**
374  * @brief Describes parameters for canceling a connection.
375  *
376  * @since 1.0
377  * @version 1.0
378  */
379 struct StationDelParameters {
380     const uint8_t *mac;  /**< MAC address of the station with which the connection is to be canceled */
381     uint8_t subtype;     /**< Cancellation type */
382     uint16_t reasonCode; /**< Reason code for the cancellation */
383 };
384 
385 /**
386  * @brief Describes MAC configuration parameters.
387  *
388  * @since 1.0
389  * @version 1.0
390  */
391 typedef struct MacConfigParam {
392     uint8_t mac[IEEE80211_MAC_ADDR_LEN]; /**< MAC address. For details about its length, see {@link
393                                           * IEEE80211_MAC_ADDR_LEN}.
394                                           */
395     uint8_t p2pMode;                     /**< Whether the peer-to-peer (P2P) mode is used. */
396     uint8_t resv;                        /**< Reserved field */
397 } Mac80211SetMacParam;
398 
399 /**
400  * @brief Describes disconnection parameters.
401  *
402  * @since 1.0
403  * @version 1.0
404  */
405 typedef struct {
406     uint8_t macAddr[IEEE80211_MAC_ADDR_LEN]; /**< Device MAC address */
407     uint16_t reasonCode;                     /**< Disconnection reason code */
408 } Mac80211DisconnectParam;
409 
410 /**
411  * @brief Describes the beacon configuration.
412  *
413  * @since 1.0
414  * @version 1.0
415  */
416 struct WlanBeaconConf {
417     uint32_t interval;      /**< Beacon interval */
418     uint32_t DTIMPeriod;    /**< Delivery Traffic Indication Message (DTIM) interval for sending beacons */
419     uint8_t *headIEs;       /**< One or more IEs before the TIM IE */
420     size_t headIEsLength;   /**< Length of the IEs before the TIM IE */
421     uint8_t *tailIEs;       /**< One or more IEs after the TIM IE */
422     size_t tailIEsLength;   /**< Length of the IEs after the TIM IE */
423     bool hiddenSSID;        /**< Whether to hide the SSID */
424 };
425 
426 /**
427  * @brief Describes the AP configuration.
428  *
429  * @since 1.0
430  * @version 1.0
431  */
432 struct WlanAPConf {
433     struct WlanSSID ssidConf;   /**< SSID configuration */
434     uint16_t channel;           /**< Channel */
435     uint16_t centerFreq1;       /**< Center frequency 1 */
436     uint16_t centerFreq2;       /**< Center frequency 2 */
437     uint8_t band;               /**< Band, as enumerated in <b>Ieee80211Band</b> */
438     uint8_t width;              /**< Channel width, as enumerated in <b>Ieee80211ChannelWidth</b> */
439 };
440 
441 /**
442  * @brief Describes the hardware capability.
443  *
444  * @since 1.0
445  * @version 1.0
446  */
447 struct WlanHwCapability {
448     void (*Release)(struct WlanHwCapability *self); /**< Function for releasing the hardware capability */
449     struct WlanBand *bands[IEEE80211_NUM_BANDS];    /**< Frequency bands */
450     uint16_t htCapability;       /**< High-throughput (HT) capability */
451     uint16_t supportedRateCount; /**< Number of supported rates */
452     uint16_t *supportedRates;    /**< An array of supported rates in 100 kbit/s */
453 };
454 
455 /**
456  * @brief Describes the MAC-layer APIs for basic operations that need to be implemented by the driver.
457  *
458  * @since 1.0
459  * @version 1.0
460  */
461 struct HdfMac80211BaseOps {
462     /**
463      * @brief Sets the WLAN mode.
464      *
465      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
466      * @param mode Indicates the WLAN mode to set.
467      *
468      * @return Returns <b>0</b> if the WLAN mode is set; returns a non-zero value otherwise.
469      *
470      * @since 1.0
471      * @version 1.0
472      */
473     int32_t (*SetMode)(NetDevice *netDev, enum WlanWorkMode mode);
474 
475     /**
476      * @brief Adds a key with specified parameters.
477      *
478      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
479      * @param keyIndex Indicates the key index.
480      * @param pairwise Specifies whether the key is a key pair.
481      * @param macAddr Indicates the pointer to the MAC address.
482      * @param params Indicates the pointer to the key parameters.
483      *
484      * @return Returns <b>0</b> if the key is added; returns a non-zero value otherwise.
485      *
486      * @since 1.0
487      * @version 1.0
488      */
489     int32_t (*AddKey)(struct NetDevice *netDev, uint8_t keyIndex, bool pairwise, const uint8_t *macAddr,
490         struct KeyParams *params);
491 
492     /**
493      * @brief Deletes a key with a specified MAC address.
494      *
495      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
496      * @param keyIndex Indicates the key index.
497      * @param pairwise Specifies whether the key is a key pair.
498      * @param macAddr Indicates the pointer to the MAC address.
499      *
500      * @return Returns <b>0</b> if the key is deleted; returns a non-zero value otherwise.
501      *
502      * @since 1.0
503      * @version 1.0
504      */
505     int32_t (*DelKey)(struct NetDevice *netDev, uint8_t keyIndex, bool pairwise, const uint8_t *macAddr);
506 
507     /**
508      * @brief Sets the default key.
509      *
510      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
511      * @param keyIndex Indicates the key index.
512      * @param unicast Indicates the unicast.
513      * @param multicas Indicates the multicast.
514      *
515      * @return Returns <b>0</b> if the default key is set; returns a non-zero value otherwise.
516      *
517      * @since 1.0
518      * @version 1.0
519      */
520     int32_t (*SetDefaultKey)(struct NetDevice *netDev, uint8_t keyIndex, bool unicast, bool multicas);
521 
522     /**
523      * @brief Obtains the device MAC address.
524      *
525      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
526      * @param type Indicates the MAC address type of the device.
527      * @param mac Indicates the pointer to the MAC address.
528      * @param len Indicates the length of the MAC address.
529      *
530      * @return Returns <b>0</b> if the MAC address is obtained; returns a non-zero value otherwise.
531      *
532      * @since 1.0
533      * @version 1.0
534      */
535     int32_t (*GetDeviceMacAddr)(NetDevice *netDev, int32_t type, uint8_t *mac, uint8_t len);
536 
537     /**
538      * @brief Sets the MAC address.
539      *
540      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
541      * @param mac Indicates the pointer to the MAC address.
542      * @param len Indicates the length of the MAC address.
543      *
544      * @return Returns <b>0</b> if the MAC address is set; returns a non-zero value otherwise.
545      *
546      * @since 1.0
547      * @version 1.0
548      */
549     int32_t (*SetMacAddr)(NetDevice *netDev, uint8_t *mac, uint8_t len);
550 
551     /**
552      * @brief Sets the transmit power.
553      *
554      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
555      * @param power Indicates the transmit power to set.
556      *
557      * @return Returns <b>0</b> if the transmit power is set; returns a non-zero value otherwise.
558      *
559      * @since 1.0
560      * @version 1.0
561      */
562     int32_t (*SetTxPower)(NetDevice *netDev, int32_t power);
563 
564     /**
565      * @brief Obtains the frequencies supported by the 2.4 GHz or 5 GHz band.
566      *
567      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
568      * @param band Indicates the frequency band, either 2.4 GHz or 5 GHz.
569      * @param freqs Indicates the pointer to the supported frequencies.
570      * @param num Indicates the pointer to the number of supported frequencies.
571      *
572      * @return Returns <b>0</b> if the supported frequencies are obtained; returns a non-zero value otherwise.
573      *
574      * @since 1.0
575      * @version 1.0
576      */
577     int32_t (*GetValidFreqsWithBand)(NetDevice *netDev, int32_t band, int32_t *freqs, uint32_t *num);
578 
579     /**
580      * @brief Obtains the hardware capability supported by the device.
581      *
582      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
583      * @param capability Indicates the double pointer to the hardware capability.
584      *
585      * @return Returns <b>0</b> if the hardware capability is obtained; returns a non-zero value otherwise.
586      *
587      * @since 1.0
588      * @version 1.0
589      */
590     int32_t (*GetHwCapability)(NetDevice *netDev, struct WlanHwCapability **capability);
591 
592     int32_t (*SendAction)(struct NetDevice *netDev, WifiActionData *actionData);
593 
594     int32_t (*GetIftype)(struct NetDevice *netDev, uint8_t *iftype);
595 };
596 
597 /**
598  * @brief Describes the MAC-layer APIs for station operations that need to be implemented by the driver.
599  *
600  * @since 1.0
601  * @version 1.0
602  */
603 struct HdfMac80211STAOps {
604     /**
605      * @brief Starts a connection based on the specified parameters.
606      *
607      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
608      * @param param Indicates the pointer to the connection parameters.
609      *
610      * @return Returns <b>0</b> if the connection is started; returns a non-zero value otherwise.
611      *
612      * @since 1.0
613      * @version 1.0
614      */
615     int32_t (*Connect)(NetDevice *netDev, WlanConnectParams *param);
616 
617     /**
618      * @brief Cancels a connection.
619      *
620      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
621      * @param reasonCode Indicates the reason code for connection cancellation.
622      *
623      * @return Returns <b>0</b> if the connection is canceled; returns a non-zero value otherwise.
624      *
625      * @since 1.0
626      * @version 1.0
627      */
628     int32_t (*Disconnect)(NetDevice *netDev, uint16_t reasonCode);
629 
630     /**
631      * @brief Starts a scan based on the specified parameters.
632      *
633      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
634      * @param param Indicates the pointer to the scan parameters.
635      *
636      * @return Returns <b>0</b> if the scan is started; returns a non-zero value otherwise.
637      *
638      * @since 1.0
639      * @version 1.0
640      */
641     int32_t (*StartScan)(NetDevice *netDev, struct WlanScanRequest *param);
642 
643     /**
644      * @brief Stops a scan.
645      *
646      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
647      *
648      * @return Returns <b>0</b> if the scan is stopped; returns a non-zero value otherwise.
649      *
650      * @since 1.0
651      * @version 1.0
652      */
653     int32_t (*AbortScan)(NetDevice *netDev);
654 
655     /**
656      * @brief Sets scanning for a single MAC address.
657      *
658      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
659      * @param mac Indicates the pointer to the MAC address.
660      * @param len Indicates the length of the MAC address.
661      *
662      * @return Returns <b>0</b> if the setting is successful; returns a non-zero value otherwise.
663      *
664      * @since 1.0
665      * @version 1.0
666      */
667     int32_t (*SetScanningMacAddress)(NetDevice *netDev, unsigned char *mac, uint32_t len);
668 };
669 
670 /**
671  * @brief Describes the MAC-layer APIs for AP operations that need to be implemented by the driver.
672  *
673  * @since 1.0
674  */
675 struct HdfMac80211APOps {
676     /**
677      * @brief Sets an AP.
678      *
679      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
680      * @param apConf Indicates the pointer to the AP configuration.
681      *
682      * @return Returns <b>0</b> if the AP is set; returns a non-zero value otherwise.
683      *
684      * @since 1.0
685      * @version 1.0
686      */
687     int32_t (*ConfigAp)(NetDevice *netDev, struct WlanAPConf *apConf);
688 
689     /**
690      * @brief Starts an AP.
691      *
692      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
693      *
694      * @return Returns <b>0</b> if the AP is started; returns a non-zero value otherwise.
695      *
696      * @since 1.0
697      * @version 1.0
698      */
699     int32_t (*StartAp)(NetDevice *netDev);
700 
701     /**
702      * @brief Stops an AP.
703      *
704      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
705      *
706      * @return Returns <b>0</b> if the AP is stopped; returns a non-zero value otherwise.
707      *
708      * @since 1.0
709      * @version 1.0
710      */
711     int32_t (*StopAp)(NetDevice *netDev);
712 
713     /**
714      * @brief Sets a beacon.
715      *
716      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
717      * @param beaconConf Indicates the pointer to the beacon configuration.
718      *
719      * @return Returns <b>0</b> if the beacon is set; returns a non-zero value otherwise.
720      *
721      * @since 1.0
722      * @version 1.0
723      */
724     int32_t (*ConfigBeacon)(NetDevice *netDev, struct WlanBeaconConf *beaconConf);
725 
726     /**
727      * @brief Deletes a station with a specified MAC address.
728      *
729      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
730      * @param macAddr Indicates the pointer to the MAC address.
731      *
732      * @return Returns <b>0</b> if the station is deleted; returns a non-zero value otherwise.
733      *
734      * @since 1.0
735      * @version 1.0
736      */
737     int32_t (*DelStation)(NetDevice *netDev, const uint8_t *macAddr);
738 
739     /**
740      * @brief Sets the country/region code.
741      *
742      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
743      * @param code Indicates the pointer to the country/region code.
744      * @param len Indicates the length of the country/region code.
745      *
746      * @return Returns <b>0</b> if the country/region code is set; returns a non-zero value otherwise.
747      *
748      * @since 1.0
749      * @version 1.0
750      */
751     int32_t (*SetCountryCode)(NetDevice *netDev, const char *code, uint32_t len);
752 
753     /**
754      * @brief Obtains the number of associated stations.
755      *
756      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
757      * @param num Indicates the pointer to the number of associated stations.
758      *
759      * @return Returns <b>0</b> if the number of associated stations is obtained; returns a non-zero value otherwise.
760      *
761      * @since 1.0
762      * @version 1.0
763      */
764     int32_t (*GetAssociatedStasCount)(NetDevice *netDev, uint32_t *num);
765 
766     /**
767      * @brief Obtains information about the associated stations.
768      *
769      * @param netDev Indicates the pointer to the network device structure obtained during initialization.
770      * @param staInfo Indicates the pointer to the information about the associated stations.
771      * @param num Indicates the number of associated stations.
772      *
773      * @return Returns <b>0</b> if the information is obtained; returns a non-zero value otherwise.
774      *
775      * @since 1.0
776      * @version 1.0
777      */
778     int32_t (*GetAssociatedStasInfo)(NetDevice *netDev, WifiStaInfo *staInfo, uint32_t num);
779 };
780 
781 struct HdfMac80211P2POps {
782     int32_t (*RemainOnChannel)(NetDevice *netDev, WifiOnChannel *onChannel);
783 
784     int32_t (*CancelRemainOnChannel)(NetDevice *netDev);
785 
786     int32_t (*ProbeReqReport)(NetDevice *netDev, int32_t report);
787 
788     int32_t (*AddIf)(NetDevice *netDev, WifiIfAdd *ifAdd);
789 
790     int32_t (*RemoveIf)(NetDevice *netDev, WifiIfRemove *ifRemove);
791 
792     int32_t (*SetApWpsP2pIe)(NetDevice *netDev, WifiAppIe *appIe);
793 
794     int32_t (*GetDriverFlag)(struct NetDevice *netDev, WifiGetDrvFlags **params);
795 };
796 
797 #endif // WIFI_MAC80211_OPS_H
798 /** @} */
799