void ServiceResponseTimeDialog::fillTree() { srt_data_t srt_data; srt_data.srt_array = g_array_new(FALSE, TRUE, sizeof(srt_stat_table*)); srt_data.user_data = this; srt_table_dissector_init(srt_, srt_data.srt_array, NULL, NULL); QString display_filter = displayFilter(); GString *error_string = register_tap_listener(get_srt_tap_listener_name(srt_), &srt_data, display_filter.toUtf8().constData(), 0, tapReset, get_srt_packet_func(srt_), tapDraw); if (error_string) { QMessageBox::critical(this, tr("Failed to attach to tap \"%1\"").arg(get_srt_tap_listener_name(srt_)), error_string->str); g_string_free(error_string, TRUE); g_array_free(srt_data.srt_array, TRUE); srt_data.srt_array = NULL; reject(); // XXX Stay open instead? return; } statsTreeWidget()->setSortingEnabled(false); cap_file_.retapPackets(); // We only have one table. Move its tree items up one level. if (statsTreeWidget()->invisibleRootItem()->childCount() == 1) { statsTreeWidget()->setRootIndex(statsTreeWidget()->model()->index(0, 0)); } tapDraw(&srt_data); statsTreeWidget()->sortItems(SRT_COLUMN_PROCEDURE, Qt::AscendingOrder); statsTreeWidget()->setSortingEnabled(true); remove_tap_listener(&srt_data); g_array_free(srt_data.srt_array, TRUE); }
static void dissector_srt_init(const char *opt_arg, void* userdata) { register_srt_t *srt = (register_srt_t*)userdata; const char *filter=NULL; char* err; srt_table_get_filter(srt, opt_arg, &filter, &err); if (err != NULL) { gchar* cmd_str = srt_table_get_tap_string(srt); cmdarg_err("invalid \"-z %s,%s\" argument", cmd_str, err); g_free(cmd_str); g_free(err); exit(1); } /* Need to create the SRT array now */ global_srt_array = g_array_new(FALSE, TRUE, sizeof(srt_stat_table*)); srt_table_dissector_init(srt, global_srt_array); init_srt_tables(srt, filter); }