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 __HMAC_ENCAP_FRAME_AP_H__ 20 #define __HMAC_ENCAP_FRAME_AP_H__ 21 22 /* **************************************************************************** 23 1 其他头文件包含 24 **************************************************************************** */ 25 #include "oal_ext_if.h" 26 #include "mac_vap.h" 27 #include "hmac_user.h" 28 #include "hmac_vap.h" 29 30 #ifdef __cplusplus 31 #if __cplusplus 32 extern "C" { 33 #endif 34 #endif 35 36 /* **************************************************************************** 37 2 宏定义 38 **************************************************************************** */ 39 typedef enum { 40 /* 加密方式为open */ 41 HMAC_AP_AUTH_SEQ1_OPEN_ANY = 0, 42 /* 加密方式为wep,处理重传帧 */ 43 HMAC_AP_AUTH_SEQ1_WEP_NOT_RESEND, 44 /* 加密方式为wep,处理非重传帧 */ 45 HMAC_AP_AUTH_SEQ1_WEP_RESEND, 46 /* 加密方式为open */ 47 HMAC_AP_AUTH_SEQ3_OPEN_ANY, 48 /* 加密方式为WEP,assoc状态为auth comlete */ 49 HMAC_AP_AUTH_SEQ3_WEP_COMPLETE, 50 /* 加密方式为WEP,assoc状态为assoc */ 51 HMAC_AP_AUTH_SEQ3_WEP_ASSOC, 52 /* 什么也不做 */ 53 HMAC_AP_AUTH_DUMMY, 54 55 HMAC_AP_AUTH_BUTT 56 } hmac_ap_auth_process_code_enum; 57 typedef hi_u8 hmac_ap_auth_process_code_enum_uint8; 58 59 /* **************************************************************************** 60 3 STRUCT定义 61 **************************************************************************** */ 62 typedef struct tag_hmac_auth_rsp_param_stru { 63 /* 收到auth request是否为重传帧 */ 64 hi_u8 auth_resend; 65 /* 记录是否为wep */ 66 hi_u8 is_wep_allowed; 67 /* 记录认证的类型 */ 68 hi_u16 us_auth_type; 69 /* 记录函数处理前,user的关联状态 */ 70 mac_user_asoc_state_enum_uint8 user_asoc_state; 71 hi_u8 resv[3]; /* 3 保留字节 */ 72 } hmac_auth_rsp_param_stru; 73 74 typedef hmac_ap_auth_process_code_enum_uint8 (*hmac_auth_rsp_fun)(const hmac_auth_rsp_param_stru *pst_auth_rsp_param, 75 hi_u8 *puc_code, mac_user_asoc_state_enum_uint8 *pst_usr_ass_stat); 76 77 typedef struct tag_hmac_auth_rsp_handle_stru { 78 hmac_auth_rsp_param_stru auth_rsp_param; 79 hmac_auth_rsp_fun auth_rsp_fun; 80 } hmac_auth_rsp_handle_stru; 81 82 typedef struct hmac_asoc_rsp_ap_info_stru { 83 hi_u8 *puc_sta_addr; 84 hi_u8 *puc_asoc_rsp; 85 86 hi_u16 status_code; 87 hi_u8 assoc_id; 88 hi_u8 rsv0; 89 90 hi_u16 us_type; 91 hi_u16 us_resv1; 92 } hmac_asoc_rsp_ap_info_stru; 93 94 typedef struct { 95 hi_u8 *mac_addr; 96 hi_u8 addr_len; 97 hi_u8 resv[3]; /* 3 byte保留字段 */ 98 } hmac_mac_addr_stru; 99 100 /* **************************************************************************** 101 4 函数声明 102 **************************************************************************** */ 103 hi_u16 hmac_encap_auth_rsp(mac_vap_stru *mac_vap, oal_netbuf_stru *auth_rsp, const oal_netbuf_stru *auth_req, 104 hi_u8 *puc_chtxt, hi_u16 chtxt_len); 105 106 hi_u32 hmac_mgmt_encap_asoc_rsp_ap(mac_vap_stru *mac_ap, hmac_asoc_rsp_ap_info_stru *asoc_rsp_ap_info); 107 #ifdef _PRE_WLAN_FEATURE_MESH 108 hi_u32 hmac_encap_mesh_peering_open_frame(mac_vap_stru *mac_vap, hi_u8 *puc_data, 109 const mac_action_data_stru *action_data); 110 hi_u32 hmac_encap_mesh_peering_confirm_frame(mac_vap_stru *mac_vap, hi_u8 *puc_data, 111 const mac_action_data_stru *action_data); 112 hi_u32 hmac_encap_mesh_peering_close_frame(const mac_vap_stru *mac_vap, hi_u8 *puc_data, 113 const mac_action_data_stru *action_data); 114 hi_u32 hmac_encap_mesh_group_key_inform_frame(const mac_vap_stru *mac_vap, hi_u8 *puc_data, 115 const mac_action_data_stru *action_data); 116 hi_u32 hmac_encap_mesh_group_key_ack_frame(const mac_vap_stru *mac_vap, hi_u8 *puc_data, 117 const mac_action_data_stru *action_data); 118 119 #endif 120 #ifdef __cplusplus 121 #if __cplusplus 122 } 123 #endif 124 #endif 125 126 #endif /* __HMAC_ENCAP_FRAME_AP_H__ */ 127