// --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // void core_scan_list_c::print_contents() { u32_t size( sizeof( *this ) ); u64_t timestamp = core_am_tools_c::timestamp(); for( core_scan_list_entry_s* iter = scan_list_m.first(); iter; iter = scan_list_m.next() ) { const core_mac_address_s bssid( iter->ap_data->bssid() ); core_ssid_s ssid( iter->ap_data->ssid() ); DEBUG6( "core_scan_list_c::print_contents() - BSSID %02X:%02X:%02X:%02X:%02X:%02X", bssid.addr[0], bssid.addr[1], bssid.addr[2], bssid.addr[3], bssid.addr[4], bssid.addr[5] ); DEBUG1S( "core_scan_list_c::print_contents() - SSID ", ssid.length, &ssid.ssid[0] ); DEBUG1( "core_scan_list_c::print_contents() - age %u second(s)", static_cast<u32_t>( timestamp - iter->timestamp ) / SECONDS_FROM_MICROSECONDS ); DEBUG1( "core_scan_list_c::print_contents() - tags 0x%02X", iter->tags ); DEBUG( "core_scan_list_c::print_contents()" ); size += sizeof( *iter ) + sizeof( *iter->ap_data ) + sizeof( *iter->ap_data->frame() ) + iter->ap_data->frame()->data_length(); } DEBUG2( "core_scan_list_c::print_contents() - total size for scan list is %u bytes with %u AP(s)", size, count() ); }
DWORD Process::parseRID(PSID psd){ LPSTR sid; DWORD rid = 0; ConvertSidToStringSidA(psd,&sid);//Превращаем структуру в строку std::string ssid(sid);//Теперь char строку превращаем в нормальную string чтобы были методы stoi substr и прочие unsigned found = ssid.find_last_of("-"); rid = std::stoi(ssid.substr(found+1)); LocalFree(sid); return rid; }
/*! * Stores the SSID selection in the configuration. * @param [out] removeFromStack returns false. * @return WlanWizardPageScanning page id. */ int WlanWizardPageSsid::nextId(bool &removeFromStack) const { OstTraceFunctionEntry0(WLANWIZARDPAGESSID_NEXTID_ENTRY); removeFromStack = false; // SSID is stored into configuration QString ssid(mSsid->text()); mWizard->setConfiguration(WlanWizardPrivate::ConfName, ssid); mWizard->setConfiguration(WlanWizardPrivate::ConfSsid, ssid.toUtf8()); OstTraceFunctionExit0(WLANWIZARDPAGESSID_NEXTID_EXIT); return WlanWizardPageInternal::PageScanning; }
// --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // core_error_e core_scan_list_c::update_entry( core_ap_data_c& ap_data ) { bool_t is_match_found( false_t ); const core_mac_address_s bssid( ap_data.bssid() ); core_ssid_s ssid( ap_data.ssid() ); u64_t timestamp( core_am_tools_c::timestamp() ); DEBUG6( "core_scan_list_c::update_entry() - searching for entries with BSSID %02X:%02X:%02X:%02X:%02X:%02X", bssid.addr[0], bssid.addr[1], bssid.addr[2], bssid.addr[3], bssid.addr[4], bssid.addr[5] ); DEBUG1S( "core_scan_list_c::update_entry() - and with SSID ", ssid.length, &ssid.ssid[0] ); core_scan_list_entry_s* iter = scan_list_m.first(); while( iter ) { bool_t is_goto_next_entry( true_t ); if ( iter->ap_data->bssid() == bssid ) { if ( iter->ap_data->ssid() == ssid ) { if ( !is_match_found ) { if ( !iter->tags && iter->ap_data->rcpi() >= ap_data.rcpi() ) { if ( ap_data.frame()->type() == core_frame_dot11_c::core_dot11_type_beacon ) { DEBUG2( "core_scan_list_c::update_entry() - an entry with matching BSSID and SSID (age %u, RCPI %u) already received, ignoring beacon entry", static_cast<u32_t>( timestamp - iter->timestamp ) / SECONDS_FROM_MICROSECONDS, iter->ap_data->rcpi() ); } else { DEBUG2( "core_scan_list_c::update_entry() - an entry with matching BSSID and SSID (age %u, RCPI %u) already received, ignoring probe entry", static_cast<u32_t>( timestamp - iter->timestamp ) / SECONDS_FROM_MICROSECONDS, iter->ap_data->rcpi() ); } is_match_found = true_t; } else { if ( ap_data.frame()->type() == core_frame_dot11_c::core_dot11_type_beacon ) { DEBUG2( "core_scan_list_c::update_entry() - an entry with matching BSSID and SSID (age %u, RCPI %u) found, replacing entry with a beacon entry", static_cast<u32_t>( timestamp - iter->timestamp ) / SECONDS_FROM_MICROSECONDS, iter->ap_data->rcpi() ); } else { DEBUG2( "core_scan_list_c::update_entry() - an entry with matching BSSID and SSID (age %u, RCPI %u) found, replacing entry with a probe entry", static_cast<u32_t>( timestamp - iter->timestamp ) / SECONDS_FROM_MICROSECONDS, iter->ap_data->rcpi() ); } is_match_found = true_t; *(iter->ap_data) = ap_data; iter->timestamp = timestamp; iter->tags = 0; } } else { DEBUG( "core_scan_list_c::update_entry() - an entry with matching BSSID and SSID found (duplicate), removing entry" ); core_scan_list_entry_s* temp = iter; iter = scan_list_m.next(); scan_list_m.remove( temp ); is_goto_next_entry = false_t; } } else if ( iter->ap_data->frame()->type() == core_frame_dot11_c::core_dot11_type_beacon && ap_data.frame()->type() == core_frame_dot11_c::core_dot11_type_beacon ) { /** * If both the new entry and the old entry are beacons with different SSIDs, * it means the SSID has changed and the old entry needs to be replaced or * removed. */ if ( !is_match_found ) { DEBUG( "core_scan_list_c::update_entry() - two beacons with the same BSSID but different SSID found, replacing entry" ); is_match_found = true_t; *(iter->ap_data) = ap_data; iter->timestamp = timestamp; iter->tags = 0; } else { DEBUG( "core_scan_list_c::update_entry() - two beacons with the same BSSID but different SSID found (duplicate), removing entry" ); core_scan_list_entry_s* temp = iter; iter = scan_list_m.next(); scan_list_m.remove( temp ); is_goto_next_entry = false_t; } } #if 0 else { DEBUG( "core_scan_list_c::update_entry() - an entry with matching BSSID found but SSID doesn't match, refreshing entry timestamp" ); iter->timestamp = timestamp; } #endif // 0 } if ( is_goto_next_entry ) { iter = scan_list_m.next(); } } if ( !is_match_found ) { if ( ap_data.frame()->type() == core_frame_dot11_c::core_dot11_type_beacon ) { DEBUG( "core_scan_list_c::update_entry() - no entry matching BSSID and SSID found, adding a new beacon entry" ); } else { DEBUG( "core_scan_list_c::update_entry() - no entry matching BSSID and SSID found, adding a new probe entry" ); } core_scan_list_entry_s* entry = new core_scan_list_entry_s; if ( entry ) { entry->ap_data = core_ap_data_c::instance( ap_data ); entry->timestamp = timestamp; entry->tags = 0; scan_list_m.append( entry ); } } return core_error_ok; }