aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/conversation_hash_tables_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ui/qt/conversation_hash_tables_dialog.cpp')
-rw-r--r--ui/qt/conversation_hash_tables_dialog.cpp59
1 files changed, 14 insertions, 45 deletions
diff --git a/ui/qt/conversation_hash_tables_dialog.cpp b/ui/qt/conversation_hash_tables_dialog.cpp
index 9a26838ca9..80dec2e482 100644
--- a/ui/qt/conversation_hash_tables_dialog.cpp
+++ b/ui/qt/conversation_hash_tables_dialog.cpp
@@ -33,6 +33,7 @@ fill_named_table(gpointer key, gpointer value _U_, gpointer user_data)
if (html_table->isEmpty()) {
html_table->append("<tr>");
int addr_count = 1;
+ int port_count = 1;
int string_count = 1;
int uint_count = 1;
int uint64_count = 1;
@@ -42,6 +43,9 @@ fill_named_table(gpointer key, gpointer value _U_, gpointer user_data)
case CE_ADDRESS:
title = QString("Address %1").arg(addr_count++);
break;
+ case CE_PORT:
+ title = QString("Port %1").arg(port_count++);
+ break;
case CE_STRING:
title = QString("String %1").arg(string_count++);
break;
@@ -70,6 +74,9 @@ title_done:
case CE_ADDRESS:
val = address_to_qstring(&cur_el->addr_val);
break;
+ case CE_PORT:
+ val = QString::number(cur_el->port_val);
+ break;
case CE_STRING:
val = cur_el->str_val;
break;
@@ -102,12 +109,7 @@ ConversationHashTablesDialog::ConversationHashTablesDialog(QWidget *parent) :
QString html;
- html += "<h3>Conversation Hash Tables</h3>\n";
-
- html += hashTableToHtmlTable("conversation_hashtable_exact", get_conversation_hashtable_exact());
- html += hashTableToHtmlTable("conversation_hashtable_no_addr2", get_conversation_hashtable_no_addr2());
- html += hashTableToHtmlTable("conversation_hashtable_no_port2", get_conversation_hashtable_no_port2());
- html += hashTableToHtmlTable("conversation_hashtable_no_addr2_or_port2", get_conversation_hashtable_no_addr2_or_port2());
+ html += "<h2>Conversation Hash Tables</h2>\n";
wmem_map_t *conversation_tables = get_conversation_hashtables();
wmem_list_t *table_names = wmem_map_get_keys(NULL, conversation_tables);
@@ -116,7 +118,12 @@ ConversationHashTablesDialog::ConversationHashTablesDialog(QWidget *parent) :
const char *table_name = static_cast<const char *>(wmem_list_frame_data(cur_frame));
wmem_map_t *table = static_cast<wmem_map_t *>(wmem_map_lookup(conversation_tables, table_name));
- html += QString("<p>%1, %2 entries</p>\n").arg(table_name).arg(wmem_map_size(table));
+ if (!table) {
+ html += QString("<h3>%1, Error: table not found</h3>\n").arg(table_name);
+ continue;
+ }
+
+ html += QString("<h3>%1, %2 entries</h3>\n").arg(table_name).arg(wmem_map_size(table));
QString html_table;
html += "<table>\n";
wmem_map_foreach(table, fill_named_table, &html_table);
@@ -131,41 +138,3 @@ ConversationHashTablesDialog::~ConversationHashTablesDialog()
{
delete ui;
}
-
-static void
-populate_html_table(gpointer data, gpointer user_data)
-{
- const conversation_key_t conv_key = (conversation_key_t)data;
- QString* html_table = (QString*)user_data;
- gchar* tmp = conversation_get_html_hash(conv_key);
-
- // XXX Add a column for the hash value.
- (*html_table) += QString(tmp);
- wmem_free(NULL, tmp);
-}
-
-const QString ConversationHashTablesDialog::hashTableToHtmlTable(const QString table_name, wmem_map_t *hash_table)
-{
- wmem_list_t *conversation_keys = NULL;
- guint num_keys = 0;
- if (hash_table)
- {
- conversation_keys = wmem_map_get_keys(NULL, hash_table);
- num_keys = wmem_list_count(conversation_keys);
- }
-
- QString html_table = QString("<p>%1, %2 entries</p>").arg(table_name).arg(num_keys);
- if (num_keys > 0)
- {
- int one_em = fontMetrics().height();
- html_table += QString("<table cellpadding=\"%1\">\n").arg(one_em / 4);
-
- html_table += "<tr><th align=\"left\">Address 1</th><th align=\"left\">Port 1</th><th align=\"left\">Address 2</th><th align=\"left\">Port 2</th></tr>\n";
-
- wmem_list_foreach(conversation_keys, populate_html_table, (void*)&html_table);
- html_table += "</table>\n";
- }
- if (conversation_keys)
- wmem_destroy_list(conversation_keys);
- return html_table;
-}