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 * Description: hook function for wifi promiscuous. 15 * Create: 2021-8-14 16 */ 17 18 #ifndef __HMAC_PROMISC_H__ 19 #define __HMAC_PROMISC_H__ 20 21 #include "osal_adapt.h" 22 #include "mac_frame.h" 23 #include "mac_vap_ext.h" 24 #ifdef __cplusplus 25 #if __cplusplus 26 extern "C" { 27 #endif 28 #endif 29 30 /***************************************************************************** 31 1 其他头文件包含 32 *****************************************************************************/ 33 34 #undef THIS_FILE_ID 35 #define THIS_FILE_ID OAM_FILE_ID_OAM_PROMISC_H 36 37 #define IEEE80211_MAC_HDR_LEN 26 38 #define TRIM_DATA_PAYLOAD_LEN 2000 39 #define IEEE80211_FRAME_TYPE_DATA 0x02 40 #define IEEE80211_FRAME_TYPE_MGMT 0x00 41 #define IEEE80211_FRAME_SUBTYPE_QOS 0x08 42 #define IEEE80211_FRAME_SUBTYPE_DISASSOC 0x0a 43 44 #define MAC_ADDR_LEN 6 45 46 #define DIRECTION_TX 0 47 #define DIRECTION_RX 1 48 49 /* WLAN 混杂模式状态结构体 */ 50 typedef struct { 51 osal_u32 promis_count[3][16][2]; /* 3 for frame type, 15 for frame subtype, 2 for frame mode */ 52 } wlan_promisc_mode_stru; /* splited from proc_file_config_struct */ 53 54 typedef struct { 55 osal_u8 bit_num; 56 osal_u8 frame_type; 57 osal_u8 subtype_num; 58 osal_u8 frame_mode; 59 } wlan_promisc_query_stru; 60 61 #if defined(_PRE_OS_VERSION_LITEOS) && defined(_PRE_OS_VERSION) && (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION) 62 typedef osal_void (*hmac_promis_send_custom_frame_cb)(hmac_vap_stru *hmac_vap, const oal_netbuf_stru *netbuf); 63 #endif 64 typedef osal_void (*hmac_rx_frame_promis_proc_cb)(hmac_vap_stru *hmac_vap, const oal_netbuf_stru *netbuf); 65 typedef osal_u32 (*hmac_sta_rx_deauth_req_proc_for_promisc_cb)(hmac_vap_stru *hmac_vap, const osal_u8 *mac_hdr); 66 typedef osal_u8 (*hmac_promisc_get_switch_cb)(void); 67 68 static osal_u32 hmac_promis_init_weakref(osal_void) __attribute__ ((weakref("hmac_promis_init"), used)); 69 static osal_void hmac_promis_deinit_weakref(osal_void) __attribute__ ((weakref("hmac_promis_deinit"), used)); 70 71 #ifdef __cplusplus 72 #if __cplusplus 73 } 74 #endif 75 #endif 76 77 #endif 78