/* Update the buffer alone, not the entire node. * This involves, * 1) Freeing the buffer alone. * 2) Allocating a new buffer * 3) Update the node timestamp with the current time. */ A_STATUS wlan_node_buf_update(struct ieee80211_node_table *nt, bss_t *ni, A_UINT32 len) { IEEE80211_NODE_LOCK(nt); /* Free the ni_buf alone. */ if (ni->ni_buf != NULL) { A_FREE_NOWAIT(ni->ni_buf); ni->ni_buf = NULL; } /* Allocate ni_buf for the new length. */ if (len) { ni->ni_buf = A_MALLOC_NOWAIT(len); if (ni->ni_buf == NULL) { IEEE80211_NODE_UNLOCK(nt); return A_ERROR; } else { A_MEMZERO(ni->ni_buf, len); } } /* Update the Node's timestamp. */ ni->ni_tstamp = A_GET_MS(0); IEEE80211_NODE_UNLOCK(nt); return A_OK; }
void wlan_refresh_inactive_nodes (struct ieee80211_node_table *nt) { bss_t *bss, *nextBss; A_UINT8 myBssid[IEEE80211_ADDR_LEN]; A_UINT32 timeoutValue = 0; A_UINT32 now = A_GET_MS(0); timeoutValue = nt->nt_nodeAge; wmi_get_current_bssid(nt->nt_wmip, myBssid); bss = nt->nt_node_first; while (bss != NULL) { nextBss = bss->ni_list_next; if (A_MEMCMP(myBssid, bss->ni_macaddr, sizeof(myBssid)) != 0) { if (((now - bss->ni_tstamp) > timeoutValue) || --bss->ni_actcnt == 0) { /* * free up all but the current bss - if set */ wlan_node_reclaim(nt, bss); } } bss = nextBss; } }
void wlan_refresh_inactive_nodes (struct ieee80211_node_table *nt) { bss_t *bss, *nextBss; A_UINT8 myBssid[IEEE80211_ADDR_LEN]; A_UINT32 timeoutValue = 0; A_UINT32 now = A_GET_MS(0); timeoutValue = nt->nt_nodeAge; wmi_get_current_bssid(nt->nt_wmip, myBssid); bss = nt->nt_node_first; while (bss != NULL) { nextBss = bss->ni_list_next; if (A_MEMCMP(myBssid, bss->ni_macaddr, sizeof(myBssid)) != 0) { if (((now - bss->ni_tstamp) > timeoutValue) || --bss->ni_actcnt == 0) { PBYTE pIE; char a[128]; A_UINT32 length, ch, freq; //wchar_t b[128] = {0}; pIE = bss->ni_cie.ie_ssid; length = pIE[1]; memcpy( a, &pIE[2], length ); a[length] = '\0'; //MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, a, 32, b, 64 ); freq = bss->ni_cie.ie_chan; if (freq == 2484) ch = 14; else if (freq < 2484) ch = (freq - 2407) / 5; else if (freq < 5000) ch = 15 + ((freq - 2512) / 20); else ch = (freq - 5000) / 5; RETAIL_DEBUG_PRINTF(debugBssInfo, (TEXT("builder:ar6k2: remove bss info, SSID = %S, RSSI = %d, CHANNEL = %d\r\n"), a, bss->ni_rssi, ch)); RETAIL_DEBUG_PRINTF(debugBssInfo, (TEXT("builder:ar6k2: BSSID = %02x:%02x:%02x:%02x:%02x:%02x \r\n") , bss->ni_macaddr[0], bss->ni_macaddr[1], bss->ni_macaddr[2], bss->ni_macaddr[3], bss->ni_macaddr[4], bss->ni_macaddr[5])); logPrintf( (debugFileLog && debugBssInfo), "builder:ar6k2: remove bss info, SSID = %s, RSSI = %d, CHANNEL = %d\r\n", a, bss->ni_rssi, ch); logPrintf( (debugFileLog && debugBssInfo), "builder:ar6k2: BSSID = %02x:%02x:%02x:%02x:%02x:%02x \r\n", bss->ni_macaddr[0], bss->ni_macaddr[1], bss->ni_macaddr[2], bss->ni_macaddr[3], bss->ni_macaddr[4], bss->ni_macaddr[5]); /* * free up all but the current bss - if set */ wlan_node_reclaim(nt, bss); } } bss = nextBss; } }
void wlan_node_update_timestamp(struct ieee80211_node_table *nt, bss_t *ni) { #ifdef ATHR_NWIFI #ifndef WP7_SLDR_IMAGE NdisGetSystemUpTimeEx ((PLARGE_INTEGER) &ni->HostTimestamp); #endif #else ni->ni_tstamp = A_GET_MS(0); ni->ni_actcnt = WLAN_NODE_INACT_CNT; #endif return; }
void wlan_setup_node(struct ieee80211_node_table *nt, bss_t *ni, const A_UINT8 *macaddr) { int hash; A_UINT32 timeoutValue = 0; A_MEMCPY(ni->ni_macaddr, macaddr, IEEE80211_ADDR_LEN); hash = IEEE80211_NODE_HASH (macaddr); ieee80211_node_initref (ni); /* mark referenced */ timeoutValue = nt->nt_nodeAge; //ni->ni_tstamp = A_GET_MS (0); //-builder:nodeage ni->ni_tstamp = A_GET_MS(timeoutValue); //+builder:nodeage ni->ni_actcnt = WLAN_NODE_INACT_CNT; IEEE80211_NODE_LOCK_BH(nt); /* Insert at the end of the node list */ ni->ni_list_next = NULL; ni->ni_list_prev = nt->nt_node_last; if(nt->nt_node_last != NULL) { nt->nt_node_last->ni_list_next = ni; } nt->nt_node_last = ni; if(nt->nt_node_first == NULL) { nt->nt_node_first = ni; } /* Insert into the hash list i.e. the bucket */ if((ni->ni_hash_next = nt->nt_hash[hash]) != NULL) { nt->nt_hash[hash]->ni_hash_prev = ni; } ni->ni_hash_prev = NULL; nt->nt_hash[hash] = ni; if (!nt->isTimerArmed) { A_TIMEOUT_MS(&nt->nt_inact_timer, timeoutValue, 0); nt->isTimerArmed = TRUE; } IEEE80211_NODE_UNLOCK_BH(nt); }
static void wlan_node_timeout (A_ATH_TIMER arg) { struct ieee80211_node_table *nt = (struct ieee80211_node_table *)arg; bss_t *bss, *nextBss; A_UINT8 myBssid[IEEE80211_ADDR_LEN], reArmTimer = FALSE; A_UINT32 timeoutValue = 0; timeoutValue = nt->nt_nodeAge; wmi_get_current_bssid(nt->nt_wmip, myBssid); bss = nt->nt_node_first; while (bss != NULL) { nextBss = bss->ni_list_next; if (A_MEMCMP(myBssid, bss->ni_macaddr, sizeof(myBssid)) != 0) { if (bss->ni_tstamp <= A_GET_MS(0)) { /* * free up all but the current bss - if set */ wlan_node_reclaim(nt, bss); } else { /* * Re-arm timer, only when we have a bss other than * current bss AND it is not aged-out. */ reArmTimer = TRUE; } } bss = nextBss; } if (reArmTimer) A_TIMEOUT_MS (&nt->nt_inact_timer, timeoutValue, 0); nt->isTimerArmed = reArmTimer; }
static void wlan_node_timeout(A_ATH_TIMER arg) { struct ieee80211_node_table *nt = (struct ieee80211_node_table *)arg; bss_t *bss, *nextBss; A_UINT8 myBssid[IEEE80211_ADDR_LEN], reArmTimer = FALSE; A_UINT32 timeoutValue = 0; timeoutValue = nt->nt_nodeAge; wmi_get_current_bssid(nt->nt_wmip, myBssid); bss = nt->nt_node_first; while (bss != NULL) { nextBss = bss->ni_list_next; if (A_MEMCMP(myBssid, bss->ni_macaddr, sizeof(myBssid)) != 0) { if (bss->ni_tstamp <= A_GET_MS(0)) { PBYTE pIE; char a[128]; A_UINT32 length, ch, freq; //wchar_t b[128] = {0}; pIE = bss->ni_cie.ie_ssid; length = pIE[1]; memcpy( a, &pIE[2], length ); a[length] = '\0'; //MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, a, 32, b, 64 ); freq = bss->ni_cie.ie_chan; if (freq == 2484) ch = 14; else if (freq < 2484) ch = (freq - 2407) / 5; else if (freq < 5000) ch = 15 + ((freq - 2512) / 20); else ch = (freq - 5000) / 5; RETAIL_DEBUG_PRINTF(debugBssInfo, (TEXT("builder:ar6k2: remove bss info, SSID = %S, RSSI = %d, CHANNEL = %d\r\n"), a, bss->ni_rssi, ch)); RETAIL_DEBUG_PRINTF(debugBssInfo, (TEXT("builder:ar6k2: BSSID = %02x:%02x:%02x:%02x:%02x:%02x \r\n") , bss->ni_macaddr[0], bss->ni_macaddr[1], bss->ni_macaddr[2], bss->ni_macaddr[3], bss->ni_macaddr[4], bss->ni_macaddr[5])); logPrintf( (debugFileLog && debugBssInfo), "builder:ar6k2: remove bss info, SSID = %s, RSSI = %d, CHANNEL = %d\r\n", a, bss->ni_rssi, ch); logPrintf( (debugFileLog && debugBssInfo), "builder:ar6k2: BSSID = %02x:%02x:%02x:%02x:%02x:%02x \r\n", bss->ni_macaddr[0], bss->ni_macaddr[1], bss->ni_macaddr[2], bss->ni_macaddr[3], bss->ni_macaddr[4], bss->ni_macaddr[5]); /* * free up all but the current bss - if set */ wlan_node_reclaim(nt, bss); } else { /* * Re-arm timer, only when we have a bss other than * current bss AND it is not aged-out. */ reArmTimer = TRUE; } } bss = nextBss; } if(reArmTimer) A_TIMEOUT_MS(&nt->nt_inact_timer, timeoutValue, 0); nt->isTimerArmed = reArmTimer; }
void wlan_node_update_timestamp(struct ieee80211_node_table *nt, bss_t *ni) { ni->ni_tstamp = A_GET_MS(0); return; }