static void print_network(struct wlan_network *network) { wmprintf("\"%s\"\r\n\tSSID: %s\r\n\tBSSID: ", network->name, network->ssid[0] ? network->ssid : "(hidden)"); print_mac(network->bssid); if (network->channel) wmprintf("\r\n\tchannel: %d", network->channel); else wmprintf("\r\n\tchannel: %s", "(Auto)"); wmprintf("\r\n\trole: %s\r\n", print_role(network->role)); char *sec_tag = "\tsecurity"; if (!network->security_specific) { sec_tag = "\tsecurity [Wildcard]"; } switch (network->security.type) { case WLAN_SECURITY_NONE: wmprintf("%s: none\r\n", sec_tag); break; case WLAN_SECURITY_WEP_OPEN: wmprintf("%s: WEP (open)\r\n", sec_tag); break; case WLAN_SECURITY_WEP_SHARED: wmprintf("%s: WEP (shared)\r\n", sec_tag); break; case WLAN_SECURITY_WPA: wmprintf("%s: WPA\r\n", sec_tag); break; case WLAN_SECURITY_WPA2: wmprintf("%s: WPA2\r\n", sec_tag); break; case WLAN_SECURITY_WPA_WPA2_MIXED: wmprintf("%s: WPA/WPA2 Mixed\r\n", sec_tag); break; case WLAN_SECURITY_EAP_TLS: wmprintf("%s: (WPA2)EAP-TLS\r\n", sec_tag); break; default: break; } print_address(&network->address); }
int ObStatManager::get_scanner(ObNewScanner &scanner) const { int ret = OB_SUCCESS; int64_t last_used_mod = OB_INVALID_ID; char ipbuf[OB_IP_STR_BUFF] = {0}; server_.ip_to_string(ipbuf, sizeof (ipbuf)); ObString ipstr = ObString::make_string(ipbuf); const int32_t port = server_.get_port(); ObString server_name = ObString::make_string(print_role(get_server_type())); int64_t total_stat_cnt = 0; /* create row_desc */ ObRowDesc row_desc; int32_t column_id = OB_APP_MIN_COLUMN_ID; row_desc.add_column_desc(OB_ALL_SERVER_STAT_TID, column_id++); row_desc.add_column_desc(OB_ALL_SERVER_STAT_TID, column_id++); row_desc.add_column_desc(OB_ALL_SERVER_STAT_TID, column_id++); row_desc.add_column_desc(OB_ALL_SERVER_STAT_TID, column_id++); row_desc.add_column_desc(OB_ALL_SERVER_STAT_TID, column_id++); row_desc.set_rowkey_cell_count(4); ObRow row; ObObj obj; // drop mod id info for (int32_t mod = 0; mod < OB_MAX_MOD_NUMBER; mod++) { ObStat stat; total_stat_cnt += stat_cnt_[mod]; // drop table id info for (int32_t i = 0; i < table_stats_[mod].get_array_index(); i++) { for (int32_t j = 0; j < stat_cnt_[mod]; j++) { stat.inc(j, table_stats_[mod].at(i)->get_value(j)); } } for (int32_t i = 0; i < stat_cnt_[mod]; i++) { column_id = OB_APP_MIN_COLUMN_ID; row.set_row_desc(row_desc); row.reset(false, ObRow::DEFAULT_NULL); /* server type */ obj.set_type(ObVarcharType); obj.set_varchar(server_name); row.set_cell(OB_ALL_SERVER_STAT_TID, column_id++, obj); /* server ip */ obj.set_type(ObVarcharType); obj.set_varchar(ipstr); row.set_cell(OB_ALL_SERVER_STAT_TID, column_id++, obj); /* port */ obj.set_type(ObIntType); obj.set_int(port); row.set_cell(OB_ALL_SERVER_STAT_TID, column_id++, obj); /* key */ obj.set_type(ObVarcharType); obj.set_varchar(ObString::make_string(get_name(mod, i))); row.set_cell(OB_ALL_SERVER_STAT_TID, column_id++, obj); /* value */ obj.set_type(ObIntType); obj.set_int(stat.get_value(i)); row.set_cell(OB_ALL_SERVER_STAT_TID, column_id++, obj); scanner.add_row(row); // for last rowkey last_used_mod = mod; } } /* last rowkey */ if (total_stat_cnt > 0) { static ObObj rk_objs[4]; rk_objs[0].set_type(ObVarcharType); rk_objs[0].set_varchar(server_name); rk_objs[1].set_type(ObVarcharType); rk_objs[1].set_varchar(ipstr); rk_objs[2].set_type(ObIntType); rk_objs[2].set_int(port); rk_objs[3].set_type(ObVarcharType); rk_objs[3].set_varchar(ObString::make_string(get_name(last_used_mod, stat_cnt_[last_used_mod] - 1))); ObRowkey rowkey(rk_objs, 4); scanner.set_last_row_key(rowkey); } /* fullfilled */ scanner.set_is_req_fullfilled(true, total_stat_cnt); return ret; }
int __scan_cb(unsigned int count) { struct wlan_scan_result res; int i; int err; if (count == 0) { wmprintf("no networks found\r\n"); return 0; } wmprintf("%d network%s found:\r\n", count, count == 1 ? "" : "s"); for (i = 0; i < count; i++) { err = wlan_get_scan_result(i, &res); if (err) { wmprintf("Error: can't get scan res %d\r\n", i); continue; } print_mac(res.bssid); if (res.ssid[0]) wmprintf(" \"%s\" %s\r\n", res.ssid, print_role(res.role)); else wmprintf(" (hidden) %s\r\n", print_role(res.role)); wmprintf("\tchannel: %d\r\n", res.channel); wmprintf("\trssi: -%d dBm\r\n", res.rssi); wmprintf("\tsecurity: "); if (res.wep) wmprintf("WEP "); if (res.wpa && res.wpa2) wmprintf("WPA/WPA2 Mixed "); else { if (res.wpa) wmprintf("WPA "); if (res.wpa2) wmprintf("WPA2 "); #ifdef CONFIG_WPA2_ENTP if (res.wpa2_entp) wmprintf("WPA2(EAP-TLS)"); #endif } if (!(res.wep || res.wpa || res.wpa2 #ifdef CONFIG_WPA2_ENTP || res.wpa2_entp #endif )) wmprintf("OPEN "); wmprintf("\r\n"); wmprintf("\tWMM: %s\r\n", res.wmm ? "YES" : "NO"); #ifdef CONFIG_WPS2 if (res.wps) { if (res.wps_session == WPS_SESSION_PBC) wmprintf("\tWPS: %s, Session: %s\r\n", "YES", "Push Button"); else if (res.wps_session == WPS_SESSION_PIN) wmprintf("\tWPS: %s, Session: %s\r\n", "YES", "PIN"); else wmprintf("\tWPS: %s, Session: %s\r\n", "YES", "Not active"); } else wmprintf("\tWPS: %s \r\n", "NO"); #endif } return 0; }