void wlan_iterate_nodes(struct ieee80211_node_table *nt, wlan_node_iter_func *f, void *arg) { bss_t *ni; A_UINT32 gen; A_UINT32 numNodes = 0; gen = ++nt->nt_scangen; IEEE80211_NODE_LOCK (nt); for (ni = nt->nt_node_first; ni; ni = ni->ni_list_next) { /*if (ni->ni_scangen != gen) { */ { numNodes++; ni->ni_scangen = gen; (void) ieee80211_node_incref(ni); (*f)(arg, ni); wlan_node_dec_free(ni); } } IEEE80211_NODE_UNLOCK (nt); /*RETAILMSG (1, (L"numNodes available ==> %d\n", numNodes)); */ }
bss_t * wlan_find_Ssidnode (struct ieee80211_node_table *nt, A_UCHAR *pSsid, A_UINT32 ssidLength, A_BOOL bIsWPA2, A_BOOL bMatchSSID) { bss_t *ni = NULL; A_UCHAR *pIESsid = NULL; IEEE80211_NODE_LOCK (nt); for (ni = nt->nt_node_first; ni; ni = ni->ni_list_next) { pIESsid = ni->ni_cie.ie_ssid; if (pIESsid[1] <= 32) { // Step 1 : Check SSID if (0x00 == memcmp (pSsid, &pIESsid[2], ssidLength)) { // ni->ni_macaddr //builder: check BSSID match // // Step 2.1 : Check MatchSSID is TRUE, if so, return Matched SSID // Profile, otherwise check whether WPA2 or WPA // if (TRUE == bMatchSSID) { ieee80211_node_incref (ni); /* mark referenced */ IEEE80211_NODE_UNLOCK (nt); return ni; } // Step 2 : if SSID matches, check WPA or WPA2 if (TRUE == bIsWPA2 && NULL != ni->ni_cie.ie_rsn) { ieee80211_node_incref (ni); /* mark referenced */ IEEE80211_NODE_UNLOCK (nt); return ni; } if (FALSE == bIsWPA2 && NULL != ni->ni_cie.ie_wpa) { ieee80211_node_incref(ni); /* mark referenced */ IEEE80211_NODE_UNLOCK (nt); return ni; } } } } IEEE80211_NODE_UNLOCK (nt); return NULL; }
static bss_t * _ieee80211_find_node(struct ieee80211_node_table *nt, const A_UINT8 *macaddr) { bss_t *ni = NULL; int hash = 0; IEEE80211_NODE_LOCK_ASSERT(nt); hash = IEEE80211_NODE_HASH(macaddr); if (hash >= IEEE80211_NODE_HASHSIZE) { // overflow???? return NULL; } if (hash < 0) { // underflow???? return NULL; } if (NULL == nt) { return NULL; } if (NULL == nt->nt_hash) { return NULL; } if (NULL == nt->nt_hash[hash]) { return NULL; } for(ni = nt->nt_hash[hash]; ni; ni = ni->ni_hash_next) { if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) { ieee80211_node_incref(ni); /* mark referenced */ return ni; } } return NULL; }
static bss_t * _ieee80211_find_node(struct ieee80211_node_table *nt, const A_UINT8 *macaddr) { bss_t *ni; int hash; IEEE80211_NODE_LOCK_ASSERT(nt); hash = IEEE80211_NODE_HASH(macaddr); for(ni = nt->nt_hash[hash]; ni; ni = ni->ni_hash_next) { if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) { ieee80211_node_incref(ni); /* mark referenced */ return ni; } } return NULL; }
void wlan_iterate_nodes(struct ieee80211_node_table *nt, wlan_node_iter_func *f, void *arg) { bss_t *ni; A_UINT32 gen; gen = ++nt->nt_scangen; IEEE80211_NODE_LOCK(nt); for (ni = nt->nt_node_first; ni; ni = ni->ni_list_next) { if (ni->ni_scangen != gen) { ni->ni_scangen = gen; (void) ieee80211_node_incref(ni); (*f)(arg, ni); wlan_node_dec_free(ni); } } IEEE80211_NODE_UNLOCK(nt); }