/***************************************************************************** 函 数 名 : hmac_roam_alg_bss_in_ess 功能描述 : 输入参数 : 输出参数 : 无 返 回 值 : OAL_SUCC 或 失败错误码 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2015年11月25日 作 者 : g00260350 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 hmac_roam_alg_bss_in_ess(hmac_roam_info_stru *pst_roam_info, mac_bss_dscr_stru *pst_bss_dscr) { hmac_vap_stru *pst_hmac_vap; mac_vap_stru *pst_mac_vap; hmac_roam_alg_stru *pst_roam_alg; mac_cfg_ssid_param_stru st_cfg_ssid; oal_uint8 uc_stru_len; if ((OAL_PTR_NULL == pst_roam_info) || (OAL_PTR_NULL == pst_bss_dscr)) { OAM_ERROR_LOG0(0, OAM_SF_ROAM, "{hmac_roam_alg_bss_in_ess::param null.}"); return OAL_ERR_CODE_PTR_NULL; } pst_hmac_vap = pst_roam_info->pst_hmac_vap; if (OAL_PTR_NULL == pst_hmac_vap) { return OAL_ERR_CODE_ROAM_INVALID_VAP; } pst_mac_vap = &(pst_hmac_vap->st_vap_base_info); mac_mib_get_ssid(pst_mac_vap, &uc_stru_len, (oal_uint8 *)(&st_cfg_ssid)); if ((OAL_STRLEN(pst_bss_dscr->ac_ssid) != st_cfg_ssid.uc_ssid_len) || (0 != oal_memcmp(st_cfg_ssid.ac_ssid, pst_bss_dscr->ac_ssid, st_cfg_ssid.uc_ssid_len))) { return OAL_SUCC; } pst_roam_alg = &(pst_roam_info->st_alg); /* 是否扫描到了当前关联的 bss, 仅置位,不过滤 */ if (0 != oal_compare_mac_addr(pst_mac_vap->auc_bssid, pst_bss_dscr->auc_bssid)) { pst_roam_alg->uc_another_bss_scaned = 1; hmac_roam_ignore_rssi_trigger(pst_hmac_vap, OAL_FALSE); } return OAL_SUCC; }
/***************************************************************************** 函 数 名 : hmac_roam_alg_bss_check 功能描述 : 输入参数 : 输出参数 : 无 返 回 值 : OAL_SUCC 或 失败错误码 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2015年3月18日 作 者 : g00260350 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 hmac_roam_alg_bss_check(hmac_roam_info_stru *pst_roam_info, mac_bss_dscr_stru *pst_bss_dscr) { hmac_vap_stru *pst_hmac_vap; mac_vap_stru *pst_mac_vap; hmac_roam_alg_stru *pst_roam_alg; mac_cap_info_stru *pst_cap_info; oal_uint8 *puc_pmkid; mac_cfg_ssid_param_stru st_cfg_ssid; oal_uint32 ul_ret; oal_uint32 ul_avail_channel_capacity; oal_uint8 uc_stru_len; oal_int8 c_delta_rssi; oal_int8 c_tmp_rssi; if ((OAL_PTR_NULL == pst_roam_info) || (OAL_PTR_NULL == pst_bss_dscr)) { OAM_ERROR_LOG0(0, OAM_SF_ROAM, "{hmac_roam_alg_bss_check::param null.}"); return OAL_ERR_CODE_PTR_NULL; } pst_hmac_vap = pst_roam_info->pst_hmac_vap; if (OAL_PTR_NULL == pst_hmac_vap) { return OAL_ERR_CODE_ROAM_INVALID_VAP; } pst_mac_vap = &(pst_hmac_vap->st_vap_base_info); mac_mib_get_ssid(pst_mac_vap, &uc_stru_len, (oal_uint8 *)(&st_cfg_ssid)); if ((OAL_STRLEN(pst_bss_dscr->ac_ssid) != st_cfg_ssid.uc_ssid_len) || (0 != oal_memcmp(st_cfg_ssid.ac_ssid, pst_bss_dscr->ac_ssid, st_cfg_ssid.uc_ssid_len))) { return OAL_SUCC; } pst_roam_alg = &(pst_roam_info->st_alg); /* 挑选HMAC_SCAN_MAX_VALID_SCANNED_BSS_EXPIRE时间以内的有效bss */ if (oal_time_after((oal_uint32)OAL_TIME_GET_STAMP_MS(),(pst_bss_dscr->ul_timestamp + HMAC_SCAN_MAX_VALID_SCANNED_BSS_EXPIRE))) { return OAL_SUCC; } /* 检查黑名单 */ ul_ret = hmac_roam_alg_find_in_blacklist(pst_roam_info, pst_bss_dscr->auc_bssid); if (OAL_TRUE == ul_ret) { OAM_WARNING_LOG3(0, OAM_SF_ROAM,"{hmac_roam_alg_bss_check:: [%02X:XX:XX:XX:%02X:%02X] in blacklist!}", pst_bss_dscr->auc_bssid[0], pst_bss_dscr->auc_bssid[4], pst_bss_dscr->auc_bssid[5]); return OAL_SUCC; } /* 排除当前bss的rssi值计算,本地已经保存了dmac上报的rssi */ if (0 == oal_compare_mac_addr(pst_mac_vap->auc_bssid, pst_bss_dscr->auc_bssid)) { return OAL_SUCC; } /* wep的bss直接过滤掉 */ pst_cap_info = (mac_cap_info_stru *)&pst_bss_dscr->us_cap_info; if ((0 == pst_bss_dscr->st_bss_sec_info.uc_bss_80211i_mode) && (0 != pst_cap_info->bit_privacy)) { return OAL_SUCC; } /* open加密方式到wpa/wpa2直接过滤掉 */ /*lint -e731*/ if ((0 == pst_cap_info->bit_privacy) != (OAL_TRUE != mac_mib_get_privacyinvoked(&pst_hmac_vap->st_vap_base_info))) { return OAL_SUCC; } /*lint +e731*/ /* c_current_rssi为0时,表示linkloss上报的触发,不需要考虑rssi增益 */ c_delta_rssi = hmac_roam_alg_adjust_rssi_increase(pst_roam_info, pst_bss_dscr); if (c_delta_rssi <= 0) { return OAL_SUCC; } ul_avail_channel_capacity = hmac_roam_alg_calc_avail_channel_capacity(pst_bss_dscr); if ((0 != ul_avail_channel_capacity) && ((OAL_PTR_NULL == pst_roam_alg->pst_max_capacity_bss) || (ul_avail_channel_capacity > pst_roam_alg->ul_max_capacity))) { //暂时不考虑容量 //pst_roam_alg->ul_max_capacity = ul_avail_channel_capacity; //pst_roam_alg->pst_max_capacity_bss = pst_bss_dscr; } c_tmp_rssi = pst_bss_dscr->c_rssi; /* 对于已存在pmk缓存的bss进行加分处理 */ puc_pmkid = hmac_vap_get_pmksa(pst_hmac_vap, pst_bss_dscr->auc_bssid); if (OAL_PTR_NULL != puc_pmkid) { c_tmp_rssi += ROAM_RSSI_DIFF_4_DB; } if ((OAL_PTR_NULL == pst_roam_alg->pst_max_rssi_bss) || (c_tmp_rssi > pst_roam_alg->c_max_rssi)) { pst_roam_alg->c_max_rssi = c_tmp_rssi; pst_roam_alg->pst_max_rssi_bss = pst_bss_dscr; } return OAL_SUCC; }
oal_uint32 hmac_roam_alg_bss_check(hmac_roam_info_stru *pst_roam_info, mac_bss_dscr_stru *pst_bss_dscr) { hmac_vap_stru *pst_hmac_vap; mac_vap_stru *pst_mac_vap; hmac_roam_alg_stru *pst_roam_alg; mac_cap_info_stru *pst_cap_info; mac_cfg_ssid_param_stru st_cfg_ssid; oal_uint32 ul_ret; oal_uint32 ul_avail_channel_capacity; oal_uint8 uc_stru_len; oal_int8 c_delta_rssi; if ((OAL_PTR_NULL == pst_roam_info) || (OAL_PTR_NULL == pst_bss_dscr)) { OAM_ERROR_LOG0(0, OAM_SF_ROAM, "{hmac_roam_alg_bss_check::param null.}"); return OAL_ERR_CODE_PTR_NULL; } pst_hmac_vap = pst_roam_info->pst_hmac_vap; if (OAL_PTR_NULL == pst_hmac_vap) { return OAL_ERR_CODE_ROAM_INVALID_VAP; } pst_mac_vap = &(pst_hmac_vap->st_vap_base_info); mac_mib_get_ssid(pst_mac_vap, &uc_stru_len, (oal_uint8 *)(&st_cfg_ssid)); if ((OAL_STRLEN(pst_bss_dscr->ac_ssid) != st_cfg_ssid.uc_ssid_len) || (0 != oal_memcmp(st_cfg_ssid.ac_ssid, pst_bss_dscr->ac_ssid, st_cfg_ssid.uc_ssid_len))) { return OAL_SUCC; } pst_roam_alg = &(pst_roam_info->st_alg); /* 检查黑名单 */ ul_ret = hmac_roam_alg_find_in_blacklist(pst_roam_info, pst_bss_dscr->auc_bssid); if (OAL_TRUE == ul_ret) { return OAL_SUCC; } /* 排除当前bss的rssi值计算,本地已经保存了dmac上报的rssi */ if (0 == oal_compare_mac_addr(pst_mac_vap->auc_bssid, pst_bss_dscr->auc_bssid)) { return OAL_SUCC; } /* wep的bss直接过滤掉 */ pst_cap_info = (mac_cap_info_stru *)&pst_bss_dscr->us_cap_info; if ((0 == pst_bss_dscr->st_bss_sec_info.uc_bss_80211i_mode) && (0 != pst_cap_info->bit_privacy)) { return OAL_SUCC; } /* open加密方式到wpa/wpa2直接过滤掉 */ /*lint -e731*/ if ((0 == pst_cap_info->bit_privacy) != (OAL_TRUE != mac_mib_get_privacyinvoked(&pst_hmac_vap->st_vap_base_info))) { return OAL_SUCC; } /*lint +e731*/ /* c_current_rssi为0时,表示linkloss上报的触发,不需要考虑rssi增益 */ c_delta_rssi = hmac_roam_alg_adjust_rssi_increase(pst_roam_info, pst_bss_dscr); if (c_delta_rssi <= 0) { return OAL_SUCC; } ul_avail_channel_capacity = hmac_roam_alg_calc_avail_channel_capacity(pst_bss_dscr); if ((0 != ul_avail_channel_capacity) && ((OAL_PTR_NULL == pst_roam_alg->pst_max_capacity_bss) || (ul_avail_channel_capacity > pst_roam_alg->ul_max_capacity))) { //暂时不考虑容量 //pst_roam_alg->ul_max_capacity = ul_avail_channel_capacity; //pst_roam_alg->pst_max_capacity_bss = pst_bss_dscr; } if ((OAL_PTR_NULL == pst_roam_alg->pst_max_rssi_bss) || (pst_bss_dscr->c_rssi > pst_roam_alg->c_max_rssi)) { pst_roam_alg->c_max_rssi = pst_bss_dscr->c_rssi; pst_roam_alg->pst_max_rssi_bss = pst_bss_dscr; } return OAL_SUCC; }