1 //------------------------------------------------------------------------------ 2 // Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. 3 // 4 // 5 // Permission to use, copy, modify, and/or distribute this software for any 6 // purpose with or without fee is hereby granted, provided that the above 7 // copyright notice and this permission notice appear in all copies. 8 // 9 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 // 17 // 18 //------------------------------------------------------------------------------ 19 //============================================================================== 20 // This file contains the API for the host wlan module 21 // 22 // Author(s): ="Atheros" 23 //============================================================================== 24 #ifndef _HOST_WLAN_API_H_ 25 #define _HOST_WLAN_API_H_ 26 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif 31 32 #include <a_osapi.h> 33 34 struct ieee80211_node_table; 35 struct ieee80211_frame; 36 37 struct ieee80211_common_ie { 38 u16 ie_chan; 39 u8 *ie_tstamp; 40 u8 *ie_ssid; 41 u8 *ie_rates; 42 u8 *ie_xrates; 43 u8 *ie_country; 44 u8 *ie_wpa; 45 u8 *ie_rsn; 46 u8 *ie_wmm; 47 u8 *ie_ath; 48 u16 ie_capInfo; 49 u16 ie_beaconInt; 50 u8 *ie_tim; 51 u8 *ie_chswitch; 52 u8 ie_erp; 53 u8 *ie_wsc; 54 u8 *ie_htcap; 55 u8 *ie_htop; 56 #ifdef WAPI_ENABLE 57 u8 *ie_wapi; 58 #endif 59 }; 60 61 typedef struct bss { 62 u8 ni_macaddr[6]; 63 u8 ni_snr; 64 s16 ni_rssi; 65 struct bss *ni_list_next; 66 struct bss *ni_list_prev; 67 struct bss *ni_hash_next; 68 struct bss *ni_hash_prev; 69 struct ieee80211_common_ie ni_cie; 70 u8 *ni_buf; 71 u16 ni_framelen; 72 struct ieee80211_node_table *ni_table; 73 u32 ni_refcnt; 74 int ni_scangen; 75 76 u32 ni_tstamp; 77 u32 ni_actcnt; 78 #ifdef OS_ROAM_MANAGEMENT 79 u32 ni_si_gen; 80 #endif 81 } bss_t; 82 83 typedef void wlan_node_iter_func(void *arg, bss_t *); 84 85 bss_t *wlan_node_alloc(struct ieee80211_node_table *nt, int wh_size); 86 void wlan_node_free(bss_t *ni); 87 void wlan_setup_node(struct ieee80211_node_table *nt, bss_t *ni, 88 const u8 *macaddr); 89 bss_t *wlan_find_node(struct ieee80211_node_table *nt, const u8 *macaddr); 90 void wlan_node_reclaim(struct ieee80211_node_table *nt, bss_t *ni); 91 void wlan_free_allnodes(struct ieee80211_node_table *nt); 92 void wlan_iterate_nodes(struct ieee80211_node_table *nt, wlan_node_iter_func *f, 93 void *arg); 94 95 void wlan_node_table_init(void *wmip, struct ieee80211_node_table *nt); 96 void wlan_node_table_reset(struct ieee80211_node_table *nt); 97 void wlan_node_table_cleanup(struct ieee80211_node_table *nt); 98 99 int wlan_parse_beacon(u8 *buf, int framelen, 100 struct ieee80211_common_ie *cie); 101 102 u16 wlan_ieee2freq(int chan); 103 u32 wlan_freq2ieee(u16 freq); 104 105 void wlan_set_nodeage(struct ieee80211_node_table *nt, u32 nodeAge); 106 107 void 108 wlan_refresh_inactive_nodes (struct ieee80211_node_table *nt); 109 110 bss_t * 111 wlan_find_Ssidnode (struct ieee80211_node_table *nt, u8 *pSsid, 112 u32 ssidLength, bool bIsWPA2, bool bMatchSSID); 113 114 void 115 wlan_node_return (struct ieee80211_node_table *nt, bss_t *ni); 116 117 bss_t *wlan_node_remove(struct ieee80211_node_table *nt, u8 *bssid); 118 119 bss_t * 120 wlan_find_matching_Ssidnode (struct ieee80211_node_table *nt, u8 *pSsid, 121 u32 ssidLength, u32 dot11AuthMode, u32 authMode, 122 u32 pairwiseCryptoType, u32 grpwiseCryptoTyp); 123 124 #ifdef __cplusplus 125 } 126 #endif 127 128 #endif /* _HOST_WLAN_API_H_ */ 129