diff options
author | Gerald Combs <gerald@wireshark.org> | 2013-11-11 22:00:48 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2013-11-11 22:00:48 +0000 |
commit | 66bb75dd4eacd671b1320ae7b934fff6caa6d272 (patch) | |
tree | 749275e4a4b87a2ad53e7924b4f0a09e090f5aca /ui | |
parent | a33c6a8ced2a867dee2bf217bf2ffef4ab56e3ca (diff) | |
download | wireshark-66bb75dd4eacd671b1320ae7b934fff6caa6d272.tar.gz |
Sequence / flow diagram updates.
Plumb some controls. Adjust dialog layout. Make sure sequence
information is allocated and freed correctly. Remove a debugging
statement.
svn path=/trunk/; revision=53260
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gtk/flow_graph.c | 6 | ||||
-rw-r--r-- | ui/gtk/graph_analysis.c | 1 | ||||
-rw-r--r-- | ui/qt/sequence_diagram.cpp | 1 | ||||
-rw-r--r-- | ui/qt/sequence_dialog.cpp | 45 | ||||
-rw-r--r-- | ui/qt/sequence_dialog.h | 6 | ||||
-rw-r--r-- | ui/qt/sequence_dialog.ui | 54 | ||||
-rw-r--r-- | ui/tap-sequence-analysis.c | 32 |
7 files changed, 109 insertions, 36 deletions
diff --git a/ui/gtk/flow_graph.c b/ui/gtk/flow_graph.c index b4842f98f2..ae76a0d000 100644 --- a/ui/gtk/flow_graph.c +++ b/ui/gtk/flow_graph.c @@ -138,7 +138,7 @@ toggle_select_srcdst(GtkWidget *widget _U_, gpointer user_data _U_) { /* is the button now active? */ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(src_dst_rb))) { - graph_analysis->any_addr = FALSE; + graph_analysis->any_addr = TRUE; } } @@ -300,7 +300,7 @@ flow_graph_dlg_create(void) ("Nodes in the diagram are identified with source and destination addresses")); g_signal_connect(src_dst_rb, "toggled", G_CALLBACK(toggle_select_srcdst), NULL); ws_gtk_grid_attach(GTK_GRID(node_addr_grid), src_dst_rb, 0, 0, 1, 1); - if (!graph_analysis->any_addr) { + if (graph_analysis->any_addr) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(src_dst_rb),TRUE); } gtk_widget_show(src_dst_rb); @@ -312,7 +312,7 @@ flow_graph_dlg_create(void) ("Nodes in the diagram are identified with network source and destination addresses")); g_signal_connect(net_src_dst_rb, "toggled", G_CALLBACK(toggle_select_netsrcdst), NULL); ws_gtk_grid_attach(GTK_GRID(node_addr_grid), net_src_dst_rb, 0, 1, 1, 1); - if (graph_analysis->any_addr) { + if (!graph_analysis->any_addr) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(net_src_dst_rb),TRUE); } gtk_widget_show(net_src_dst_rb); diff --git a/ui/gtk/graph_analysis.c b/ui/gtk/graph_analysis.c index 7188ebbc26..f1f1291e2d 100644 --- a/ui/gtk/graph_analysis.c +++ b/ui/gtk/graph_analysis.c @@ -799,7 +799,6 @@ static void dialog_graph_draw(graph_analysis_data_t *user_data) } pango_layout_set_text(layout, label_string, -1); #endif -g_warning("= layout width: %d: %s", pango_layout_get_width(layout), pango_layout_get_text(layout)); pango_layout_get_pixel_size(layout, &label_width, &label_height); if ((int)left_x_border > ((int)label_x-(int)label_width/2)) diff --git a/ui/qt/sequence_diagram.cpp b/ui/qt/sequence_diagram.cpp index a68ef90895..23b7b54fef 100644 --- a/ui/qt/sequence_diagram.cpp +++ b/ui/qt/sequence_diagram.cpp @@ -56,6 +56,7 @@ SequenceDiagram::SequenceDiagram(QCPAxis *keyAxis, QCPAxis *valueAxis, QCPAxis * key_axis_(keyAxis), value_axis_(valueAxis), comment_axis_(commentAxis), + data_(NULL), sainfo_(NULL) { data_ = new WSCPSeqDataMap(); diff --git a/ui/qt/sequence_dialog.cpp b/ui/qt/sequence_dialog.cpp index 2d0f91f036..593e3ab85e 100644 --- a/ui/qt/sequence_dialog.cpp +++ b/ui/qt/sequence_dialog.cpp @@ -34,11 +34,8 @@ #include <QDebug> // To do: -// - Implement controls -// - Make reset button "apply"? // - Save as // - Add UTF8 to text dump -// - Fix scroll bar ranges // - Context menu // - Selection highlighting // - Keyboard shortcuts @@ -76,15 +73,27 @@ SequenceDialog::SequenceDialog(QWidget *parent, capture_file *cf, SequenceType t connect(sp->yAxis, SIGNAL(rangeChanged(QCPRange)), sp->yAxis2, SLOT(setRange(QCPRange))); memset (&seq_analysis_, 0, sizeof(seq_analysis_)); + + ui->showComboBox->setCurrentIndex(0); + ui->addressComboBox->setCurrentIndex(0); + + QComboBox *fcb = ui->flowComboBox; + fcb->addItem(ui->actionFlowAny->text(), SEQ_ANALYSIS_ANY); + fcb->addItem(ui->actionFlowTcp->text(), SEQ_ANALYSIS_TCP); + switch (type) { case any: seq_analysis_.type = SEQ_ANALYSIS_ANY; + ui->flowComboBox->setCurrentIndex(SEQ_ANALYSIS_ANY); break; case tcp: seq_analysis_.type = SEQ_ANALYSIS_TCP; + ui->flowComboBox->setCurrentIndex(SEQ_ANALYSIS_TCP); break; case voip: seq_analysis_.type = SEQ_ANALYSIS_VOIP; + ui->flowComboBox->hide(); + ui->flowLabel->hide(); break; } seq_analysis_.all_packets = TRUE; @@ -291,3 +300,33 @@ void SequenceDialog::on_actionGoToPacket_triggered() emit goToPacket(packet_num_); } } + +void SequenceDialog::on_showComboBox_currentIndexChanged(int index) +{ + if (index == 0) { + seq_analysis_.all_packets = TRUE; + } else { + seq_analysis_.all_packets = FALSE; + } + + if (isVisible()) fillDiagram(); +} + +void SequenceDialog::on_flowComboBox_currentIndexChanged(int index) +{ + if (index < 0) return; + seq_analysis_.type = static_cast<seq_analysis_type>(ui->flowComboBox->itemData(index).toInt()); + + if (isVisible()) fillDiagram(); +} + +void SequenceDialog::on_addressComboBox_currentIndexChanged(int index) +{ + if (index == 0) { + seq_analysis_.any_addr = TRUE; + } else { + seq_analysis_.any_addr = FALSE; + } + + if (isVisible()) fillDiagram(); +} diff --git a/ui/qt/sequence_dialog.h b/ui/qt/sequence_dialog.h index 44f213d5c1..186b6495bf 100644 --- a/ui/qt/sequence_dialog.h +++ b/ui/qt/sequence_dialog.h @@ -73,6 +73,12 @@ private slots: void on_resetButton_clicked(); void on_actionGoToPacket_triggered(); + void on_showComboBox_currentIndexChanged(int index); + + void on_flowComboBox_currentIndexChanged(int index); + + void on_addressComboBox_currentIndexChanged(int index); + private: Ui::SequenceDialog *ui; SequenceDiagram *seq_diagram_; diff --git a/ui/qt/sequence_dialog.ui b/ui/qt/sequence_dialog.ui index bf497d3989..e0696d718d 100644 --- a/ui/qt/sequence_dialog.ui +++ b/ui/qt/sequence_dialog.ui @@ -53,7 +53,7 @@ </widget> </item> <item> - <layout class="QHBoxLayout" name="controlHorizontalLayout"> + <layout class="QHBoxLayout" name="controlHorizontalLayout" stretch="0,0,0,0,0,0,0,0,1"> <item> <widget class="QLabel" name="label"> <property name="text"> @@ -62,7 +62,7 @@ </widget> </item> <item> - <widget class="QComboBox" name="packetComboBox"> + <widget class="QComboBox" name="showComboBox"> <item> <property name="text"> <string>All packets</string> @@ -89,25 +89,14 @@ </spacer> </item> <item> - <widget class="QLabel" name="label_2"> + <widget class="QLabel" name="flowLabel"> <property name="text"> <string>Flow type:</string> </property> </widget> </item> <item> - <widget class="QComboBox" name="flowComboBox"> - <item> - <property name="text"> - <string>General</string> - </property> - </item> - <item> - <property name="text"> - <string>TCP</string> - </property> - </item> - </widget> + <widget class="QComboBox" name="flowComboBox"/> </item> <item> <spacer name="horizontalSpacer_2"> @@ -143,6 +132,19 @@ </item> </widget> </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> </layout> </item> <item> @@ -191,6 +193,28 @@ <string>G</string> </property> </action> + <action name="actionFlowAny"> + <property name="text"> + <string>All Flows</string> + </property> + <property name="toolTip"> + <string>Show flows for all packets</string> + </property> + <property name="shortcut"> + <string>1</string> + </property> + </action> + <action name="actionFlowTcp"> + <property name="text"> + <string>TCP Flows</string> + </property> + <property name="toolTip"> + <string>Show only TCP flow information</string> + </property> + <property name="shortcut"> + <string>1</string> + </property> + </action> </widget> <customwidgets> <customwidget> diff --git a/ui/tap-sequence-analysis.c b/ui/tap-sequence-analysis.c index 16d5d63ffc..676331cd93 100644 --- a/ui/tap-sequence-analysis.c +++ b/ui/tap-sequence-analysis.c @@ -60,36 +60,31 @@ seq_analysis_frame_packet( void *ptr, packet_info *pinfo, epan_dissect_t *edt _U if ((sainfo->all_packets)||(pinfo->fd->flags.passed_dfilter==1)){ int i; - gchar *protocol; - gchar *colinfo; - seq_analysis_item_t *sai; - - protocol = NULL; - colinfo = NULL; + gchar *protocol = NULL; + gchar *colinfo = NULL; + seq_analysis_item_t *sai = NULL; if (sainfo->any_addr) { if (pinfo->net_src.type!=AT_NONE && pinfo->net_dst.type!=AT_NONE) { - sai = (seq_analysis_item_t *)g_malloc(sizeof(seq_analysis_item_t)); + sai = (seq_analysis_item_t *)g_malloc0(sizeof(seq_analysis_item_t)); COPY_ADDRESS(&(sai->src_addr),&(pinfo->net_src)); COPY_ADDRESS(&(sai->dst_addr),&(pinfo->net_dst)); } - else return FALSE; } else { if (pinfo->src.type!=AT_NONE && pinfo->dst.type!=AT_NONE) { - sai = (seq_analysis_item_t *)g_malloc(sizeof(seq_analysis_item_t)); + sai = (seq_analysis_item_t *)g_malloc0(sizeof(seq_analysis_item_t)); COPY_ADDRESS(&(sai->src_addr),&(pinfo->src)); COPY_ADDRESS(&(sai->dst_addr),&(pinfo->dst)); } - else return FALSE; } + if (!sai) return FALSE; + sai->fd = pinfo->fd; sai->port_src=pinfo->srcport; sai->port_dst=pinfo->destport; - sai->comment=NULL; - sai->frame_label=NULL; if(pinfo->cinfo) { if (pinfo->cinfo->col_first[COL_INFO]>=0){ @@ -159,7 +154,7 @@ seq_analysis_tcp_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt gchar flags[64]; seq_analysis_item_t *sai; - sai = (seq_analysis_item_t *)g_malloc(sizeof(seq_analysis_item_t)); + sai = (seq_analysis_item_t *)g_malloc0(sizeof(seq_analysis_item_t)); sai->fd = pinfo->fd; if (sainfo->any_addr) { COPY_ADDRESS(&(sai->src_addr),&(pinfo->net_src)); @@ -259,6 +254,7 @@ void sequence_analysis_list_free(seq_analysis_info_t *sainfo) { GList *list; + int i; if (!sainfo) return; @@ -274,8 +270,16 @@ sequence_analysis_list_free(seq_analysis_info_t *sainfo) list = g_list_next(list); } g_list_free(sainfo->list); - sainfo->nconv = 0; sainfo->list = NULL; + sainfo->nconv = 0; + + for (i=0; i<MAX_NUM_NODES; i++) { + sainfo->nodes[i].type = AT_NONE; + sainfo->nodes[i].len = 0; + g_free((void *)sainfo->nodes[i].data); + sainfo->nodes[i].data = NULL; + } + sainfo->num_nodes = 0; } /****************************************************************************/ |