• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
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  * 文 件 名   : hmac_11v.h
15  * 生成日期   : 2018年4月7日
16  * 功能描述   : 11v 宏、枚举及结构定义
17  */
18 
19 #ifndef __HMAC_11V_H__
20 #define __HMAC_11V_H__
21 
22 /*****************************************************************************
23   1 其他头文件包含
24 *****************************************************************************/
25 #include "mac_vap_ext.h"
26 #include "hmac_vap.h"
27 #include "hmac_roam_alg.h"
28 
29 #ifdef __cplusplus
30 #if __cplusplus
31 extern "C" {
32 #endif
33 #endif
34 
35 #undef  THIS_FILE_ID
36 #define THIS_FILE_ID OAM_FILE_ID_HMAC_11V_H
37 
38 /*****************************************************************************
39   2 宏定义
40 *****************************************************************************/
41 /* 目前管理帧申请内存800字节 帧自带最大长度19(frame boady)+50(url)+ N*(15(neighbor)+3(sub)+12(sub))
42   不存在超出 修改数量限制时须注意 */
43 #define HMAC_MAX_BSS_NEIGHBOR_LIST  20          /* BSS Transition 帧中允许发送的最大候选AP列表集数量 */
44 
45 // 11v等待帧返回的超时时间
46 #define HMAC_11V_WAIT_STATUS_TIMEOUT        5000         // 5000ms
47 #define HMAC_11V_MAX_URL_LENGTH             50          /* 携带URL字符的最大长度限制为50 */
48 #define HMAC_11V_QUERY_FRAME_BODY_FIX       4           /* query帧帧体固定头长度 */
49 #define HMAC_11V_REQUEST_FRAME_BODY_FIX     7           /* query帧帧体固定头长度 */
50 #define HMAC_11V_RESPONSE_FRAME_BODY_FIX    5           /* response帧帧体固定头长度 */
51 #define HMAC_11V_PERFERMANCE_ELEMENT_LEN    1           /* perfermance ie length */
52 #define HMAC_11V_TERMINATION_ELEMENT_LEN    10          /* termination ie length */
53 #define HMAC_11V_TOKEN_MAX_VALUE            255         /* 帧发送信令的最大值 */
54 #define HMAC_11V_SUBELEMENT_ID_RESV         0           /* SUBELEMENT预留 ID */
55 #define MAC_11V_ROAM_SCAN_ONE_CHANNEL_LIMIT 2
56 #define MAC_11V_ROAM_SCAN_FULL_CHANNEL_LIMIT (MAC_11V_ROAM_SCAN_ONE_CHANNEL_LIMIT + 1)
57 #define HMAC_11V_TERMINATION_TSF_LENGTH     8           /* termination_tsf时间域字节长度 */
58 #define WAL_WIFI_FEATURE_SUPPORT_11V        1
59 
60 /*****************************************************************************
61   3 枚举定义
62 *****************************************************************************/
63 /* IEEE Std 802.11-2012 - Table 8-253 */
64 enum bss_trans_mgmt_status_code {
65     WNM_BSS_TM_ACCEPT = 0,
66     WNM_BSS_TM_REJECT_UNSPECIFIED = 1,
67     WNM_BSS_TM_REJECT_INSUFFICIENT_BEACON = 2,
68     WNM_BSS_TM_REJECT_INSUFFICIENT_CAPABITY = 3,
69     WNM_BSS_TM_REJECT_UNDESIRED = 4,
70     WNM_BSS_TM_REJECT_DELAY_REQUEST = 5,
71     WNM_BSS_TM_REJECT_STA_CANDIDATE_LIST_PROVIDED = 6,
72     WNM_BSS_TM_REJECT_NO_SUITABLE_CANDIDATES = 7,
73     WNM_BSS_TM_REJECT_LEAVING_ESS = 8
74 };
75 
76 /*****************************************************************************
77   Neighbor Report Element子信息元素(Subelement)的 ID
78   820.11-2012协议583页,Table 8-115—SubElement IDs
79 *****************************************************************************/
80 typedef enum {
81     HMAC_NEIGH_SUB_ID_RESERVED              = 0,
82     HMAC_NEIGH_SUB_ID_TFS_INFO,
83     HMAC_NEIGH_SUB_ID_COND_COUNTRY,
84     HMAC_NEIGH_SUB_ID_BSS_CANDIDATE_PERF,
85     HMAC_NEIGH_SUB_ID_TERM_DURATION,
86     HMAC_NEIGH_SUB_ID_VENDOR_SPECIFIC = 221,
87 
88     HMAC_NEIGH_SUB_ID_BUTT
89 } hmac_neighbor_sub_eid_enum;
90 typedef osal_u8 hmac_neighbor_sub_eid_enum_uint8;
91 
92 
93 /*****************************************************************************
94   4 STRUCT定义
95 *****************************************************************************/
96 /* 此文件中结构体与协议一致,要求1字节对齐 */
97 #pragma pack(push, 1)
98 struct hmac_bss_term_duration {
99     osal_u8       sub_ie_id;                                        /* subelement ID,将ID置成0 表示不存在该元素 */
100     osal_u8       termination_tsf[HMAC_11V_TERMINATION_TSF_LENGTH];       /* BSS终止时间: TSF */
101     osal_u16      duration_min;                                            /* BSS消失时间 time: 分钟 */
102     osal_u8       resv;                                                    /* 四字节对齐用 */
103 };
104 typedef struct hmac_bss_term_duration hmac_bss_term_duration_stru;
105 
106 /* 候选BSS列表集的Neighbor Report IE结构体 由于只需要用到subelement 3 4 故定义两个subelement */
107 struct hmac_neighbor_bss_info {
108     osal_u8       auc_mac_addr[WLAN_MAC_ADDR_LEN];                      /* BSSID MAC地址 */
109     osal_u8       opt_class;                                         /* Operation Class */
110     osal_u8       chl_num;                                           /* Channel number */
111     osal_u8       phy_type;                                          /* PHY type */
112     osal_u8       candidate_perf;                                    /* perference data BSSID偏好值 */
113     osal_u16      resv;                                              /* 四字节对齐 */
114     oal_bssid_infomation_stru   bssid_info;                       /* BSSID information */
115     hmac_bss_term_duration_stru term_duration;                   /* 子元素Termination duration */
116 };
117 typedef struct hmac_neighbor_bss_info hmac_neighbor_bss_info_stru;
118 
119 /* bss transition query帧体信息结构体 */
120 struct hmac_bsst_query_info {
121     osal_u8 reason;
122     osal_u8 bss_list_num; /* bss list的数量 最大不允许超过50个 */
123     osal_u16 resv;        /* 四字节对齐 */
124     hmac_neighbor_bss_info_stru *neighbor_bss_list;
125 };
126 typedef struct hmac_bsst_query_info hmac_bsst_query_info_stru;
127 
128 struct hmac_bsst_req_mode {
129     osal_u8   candidate_list_include : 1,                  /* 是否包含邻居AP列表 */
130                 abridged : 1,                                /* 1:表示没有包含在邻居列表的AP优先级设置为0 */
131                 bss_disassoc_imminent : 1,                   /* 是否即将断开STA 置0 帧的时间域全为FF FF */
132                 termination_include : 1,               /* BSS终结时间  置0则帧体中不包含BSS Termination Duration字段 */
133                 ess_disassoc_imminent : 1,                   /* EES终止时间 */
134                 rev : 3;
135 };
136 typedef struct hmac_bsst_req_mode hmac_bsst_req_mode_stru;
137 
138 /* bss transition request帧体信息结构体 */
139 struct hmac_bsst_req_info {
140     osal_u8               validity_interval;                              /* 邻居列表有效时间 TBTTs */
141     osal_u16              disassoc_time;                                  /* AP取关联STA时间 TBTTs */
142     osal_u8               *session_url;                                  /* 要求传入字符串 最大限制为100个字符 */
143     hmac_bsst_req_mode_stru request_mode;                                   /* request mode */
144     osal_u8               bss_list_num;
145     osal_u8               resv;                                           /* 4字节对齐 */
146     hmac_neighbor_bss_info_stru *neighbor_bss_list;                        /* bss list的数量 最大不允许超过50个 */
147     hmac_bss_term_duration_stru term_duration;                              /* 子元素Termination duration */
148 };
149 typedef struct hmac_bsst_req_info hmac_bsst_req_info_stru;
150 
151 /* bss transition response帧体信息结构体 */
152 struct hmac_bsst_rsp_info {
153     osal_u8       status_code;                         /* 状态码 接收或者拒绝 */
154     osal_u8       termination_delay;                   /* 要求AP延后终止时间:分钟 */
155     osal_u8       target_bss_addr[WLAN_MAC_ADDR_LEN]; /* 接收切换的目标BSSID */
156     osal_u8       chl_num;                             /* Channel number */
157     osal_u8       bss_list_num;                        /* bss list的数量最大限制为50个 */
158     osal_u16      resv;                                /* 四字节对齐 */
159     hmac_neighbor_bss_info_stru *neighbor_bss_list;
160 };
161 typedef struct hmac_bsst_rsp_info hmac_bsst_rsp_info_stru;
162 
163 /* 通过11v_tx_query命令下发的消息内容 */
164 struct hmac_trigger_11v_msg {
165     osal_u8       mac_addr_list_0[WLAN_MAC_ADDR_LEN];        /* 第1个邻居的BSSID MAC地址 */
166     osal_u8       mac_addr_list_1[WLAN_MAC_ADDR_LEN];        /* 第2个邻居的BSSID MAC地址 */
167     osal_u8       chl_num_list_0;                            /* 第1个邻居的信道 */
168     osal_u8       chl_num_list_1;                            /* 第2个邻居的信道 */
169 };
170 typedef struct hmac_trigger_11v_msg hmac_trigger_11v_msg_stru;
171 #pragma pack(pop)
172 
173 typedef struct {
174     hmac_bsst_rsp_info_stru bsst_rsp_info;
175     osal_u32                roam_11v_scan_fail;
176 } hmac_11v_vap_roam_info_stru;
177 
178 typedef struct {
179     hmac_11v_vap_roam_info_stru *roam_info_11v;
180     osal_u8                 enable_11v;
181 } hmac_11v_vap_info_stru;
182 
183 typedef osal_u32(*mac_user_callback_func_11v)(hmac_vap_stru *hmac_vap, hmac_user_stru *hmac_user,
184     hmac_bsst_rsp_info_stru *bsst_rsp_info);
185 /* 11v 控制信息结构体 */
186 typedef struct {
187     osal_u8                            user_bsst_token;                     /* 用户发送bss transition 帧的信令 */
188     osal_u8                            user_status;                         /* 用户11V状态 */
189     osal_u8                            uc_11v_roam_scan_times;                 /* 单信道11v漫游扫描次数  */
190     osal_u8                            resv;                                /* 4字节对齐用 */
191     frw_timeout_stru                     status_wait_timer;                   /* 等待用户回应帧的计时器 */
192     mac_user_callback_func_11v           mac_11v_callback_fn;                    /* 回调函数指针 */
193 } hmac_user_11v_ctrl_stru;
194 /*****************************************************************************
195   5 全局变量声明
196 *****************************************************************************/
197 
198 
199 /*****************************************************************************
200   6 消息头定义
201 *****************************************************************************/
202 
203 
204 /*****************************************************************************
205   7 消息定义
206 *****************************************************************************/
207 
208 
209 /*****************************************************************************
210   8 UNION定义
211 *****************************************************************************/
212 
213 
214 /*****************************************************************************
215   9 OTHERS定义
216 *****************************************************************************/
217 
218 
219 /*****************************************************************************
220   10 函数声明
221 *****************************************************************************/
222 static osal_u32 hmac_11v_init_weakref(osal_void) __attribute__ ((weakref("hmac_11v_init"), used));
223 static osal_void hmac_11v_deinit_weakref(osal_void) __attribute__ ((weakref("hmac_11v_deinit"), used));
224 
225 typedef osal_void (*hmac_11v_set_bss_transition_cb)(mac_user_cap_info_stru *cap_info, const osal_u8 *cap);
226 typedef osal_void (*hmac_11v_set_ext_cap_bss_transition_cb)(hmac_vap_stru *hmac_vap, mac_ext_cap_ie_stru *ext_cap);
227 typedef osal_void (*hmac_11v_set_scan_params_cb)(mac_scan_req_stru *scan_params, hmac_roam_info_stru *roam_info);
228 typedef osal_bool (*hmac_11v_check_bss_dscr_cb)(hmac_roam_info_stru *roam_info, mac_bss_dscr_stru *bss_dscr);
229 typedef osal_bool (*hmac_11v_check_scan_result_cb)(hmac_roam_info_stru *roam_info,
230     oal_bool_enum_uint8 flag_in_scan_rslts);
231 typedef osal_void (*hmac_11v_trigger_roam_check_cb)(const hmac_roam_info_stru *roam_info, hmac_vap_stru *hmac_vap);
232 typedef osal_void (*hmac_get_11v_cap_cb)(hmac_vap_stru *hmac_vap, osal_s32 *pl_value);
233 
234 #ifdef __cplusplus
235 #if __cplusplus
236 }
237 #endif
238 #endif
239 
240 #endif /* end of hmac_11v.h */
241