1 /*
2  * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 
19 #ifndef __OAL_CFG80211_H__
20 #define __OAL_CFG80211_H__
21 
22 /* ****************************************************************************
23   1 其他头文件包含
24 **************************************************************************** */
25 #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION) && !defined(_PRE_HDF_LINUX)
26 #ifndef HAVE_PCLINT_CHECK
27 #include <net/cfg80211.h>
28 #endif
29 #include <net/genetlink.h>
30 #include <net/cfg80211.h>
31 #include <linux/nl80211.h>
32 #elif (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION)
33 #include "oal_ext_if.h"
34 #include "los_typedef.h"
35 #endif
36 #include "oal_net.h"
37 
38 #ifdef __cplusplus
39 #if __cplusplus
40 extern "C" {
41 #endif
42 #endif
43 
44 /* ****************************************************************************
45   2 结构体定义
46 **************************************************************************** */
47 /* 驱动sta上报内核的关联结果 */
48 typedef struct {
49     hi_u8  auc_bssid[WLAN_MAC_ADDR_LEN]; /* sta关联的ap mac地址 */
50     hi_u16 us_status_code;              /* ieee协议规定的16位状态码 */
51 
52     hi_u8 *puc_rsp_ie; /* asoc_req_ie  */
53     hi_u8 *puc_req_ie;
54 
55     hi_u32 req_ie_len; /* asoc_req_ie len */
56     hi_u32 rsp_ie_len;
57 
58     hi_u16 us_connect_status;
59     hi_u16 us_freq;
60 } oal_connet_result_stru;
61 
62 typedef struct cfg80211_scan_info oal_cfg80211_scan_info_stru;
63 
64 /* ****************************************************************************
65   3 函数声明
66 **************************************************************************** */
67 #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)
68 hi_void oal_cfg80211_ready_on_channel(
69 #if (LINUX_VERSION_CODE >= kernel_version(3, 10, 44)) || (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION)
70     oal_wireless_dev *wdev,
71 #else
72     oal_net_device_stru *net_dev,
73 #endif
74     hi_u64 ull_cookie, oal_ieee80211_channel_stru *chan, hi_u32 duration, oal_gfp_enum_uint8 en_gfp);
75 hi_void oal_cfg80211_mgmt_tx_status(
76 #if (LINUX_VERSION_CODE >= kernel_version(3, 10, 44)) || (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION)
77     oal_wireless_dev *wdev,
78 #else
79     oal_net_device_stru *pst_net_dev,
80 #endif
81     hi_u64 cookie, const hi_u8 *buf, size_t len, hi_u8 ack, oal_gfp_enum_uint8 gfp);
82 hi_void oal_cfg80211_sched_scan_result(oal_wiphy_stru *pst_wiphy);
83 hi_void oal_kobject_uevent_env_sta_join(oal_net_device_stru *net_device, const hi_u8 *mac_addr);
84 hi_void oal_kobject_uevent_env_sta_leave(oal_net_device_stru *net_device, const hi_u8 *mac_addr);
85 hi_void oal_cfg80211_mic_failure(oal_net_device_stru *net_device, const hi_u8 *mac_addr,
86     enum nl80211_key_type key_type, hi_s32 key_id, const hi_u8 *tsc, oal_gfp_enum_uint8 en_gfp);
87 hi_u32 oal_cfg80211_rx_mgmt(oal_net_device_stru *pst_dev, hi_s32 l_freq, const hi_u8 *puc_buf, hi_u32 ul_len,
88     oal_gfp_enum_uint8 en_gfp);
89 oal_cfg80211_bss_stru *oal_cfg80211_inform_bss_frame(oal_wiphy_stru *pst_wiphy,
90     oal_ieee80211_channel_stru *pst_ieee80211_channel, oal_ieee80211_mgmt_stru *pst_mgmt, hi_u32 ul_len,
91     hi_s32 l_signal, oal_gfp_enum_uint8 en_ftp);
92 #endif /* #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION) */
93 
94 #ifndef _PRE_HDF_LINUX
95 hi_void oal_cfg80211_put_bss(oal_wiphy_stru *pst_wiphy, oal_cfg80211_bss_stru *pst_cfg80211_bss);
96 #endif
97 hi_void oal_cfg80211_scan_done(oal_cfg80211_scan_request_stru *pst_cfg80211_scan_request, hi_s8 c_aborted);
98 hi_u32 oal_cfg80211_new_sta(oal_net_device_stru *net_device, const hi_u8 *mac_addr, hi_u8 addr_len,
99     oal_station_info_stru *station_info, oal_gfp_enum_uint8 en_gfp);
100 hi_u32 oal_cfg80211_del_sta(oal_net_device_stru *net_device, const hi_u8 *mac_addr, hi_u8 addr_len,
101     oal_gfp_enum_uint8 en_gfp);
102 hi_u32 oal_cfg80211_connect_result(oal_net_device_stru *net_device, const oal_connet_result_stru *connect_result);
103 hi_u32 oal_cfg80211_disconnected(oal_net_device_stru *pst_net_device, hi_u16 us_reason, const hi_u8 *puc_ie,
104     hi_u32 ul_ie_len, hi_bool locally_generated);
105 
106 #ifdef __cplusplus
107 #if __cplusplus
108 }
109 #endif
110 #endif
111 
112 #endif /* end of oal_main */
113