aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2020-01-09 16:32:26 -0800
committerAnders Broman <a.broman58@gmail.com>2020-01-10 04:57:52 +0000
commit999e63543fccc327f929329b7ae96164df492e92 (patch)
tree7b613e7f070e9d900a50e48938fa5bc7041bc351
parent0db890ba59b713e9fd362cb898eac154f1949a11 (diff)
Qt: Add elements back to the tcptrace graph.
Segment and SACK elements in the tcptrace graph are plotted using QCustomPlot's error bars. This part of QCP's API changed from version 1 to 2, and were #ifdef'ed out as part of the switch to QCP 2.0.1. Update our code to use the new API. Bug: 16281 Change-Id: Ieae2808686ddc631e0cd18c0c32fc7a2c0f396b7 Reviewed-on: https://code.wireshark.org/review/35726 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--ui/qt/tcp_stream_dialog.cpp94
-rw-r--r--ui/qt/tcp_stream_dialog.h3
2 files changed, 57 insertions, 40 deletions
diff --git a/ui/qt/tcp_stream_dialog.cpp b/ui/qt/tcp_stream_dialog.cpp
index f20681b98f..102c387046 100644
--- a/ui/qt/tcp_stream_dialog.cpp
+++ b/ui/qt/tcp_stream_dialog.cpp
@@ -57,10 +57,8 @@ const int moving_avg_period_ = 20;
const QRgb graph_color_1 = tango_sky_blue_5;
const QRgb graph_color_2 = tango_butter_6;
const QRgb graph_color_3 = tango_chameleon_5;
-#if 0 // Deactivated due to function not implemented in v2
const QRgb graph_color_4 = tango_scarlet_red_4;
const QRgb graph_color_5 = tango_scarlet_red_6;
-#endif
// Size of selectable packet points in the base graph
const double pkt_point_size_ = 3.0;
@@ -84,21 +82,24 @@ TCPStreamDialog::TCPStreamDialog(QWidget *parent, capture_file *cf, tcp_graph_ty
ts_origin_conn_(true),
seq_offset_(0),
seq_origin_zero_(true),
- title_(NULL),
- base_graph_(NULL),
- tput_graph_(NULL),
- goodput_graph_(NULL),
- seg_graph_(NULL),
- ack_graph_(NULL),
- sack_graph_(NULL),
- sack2_graph_(NULL),
- rwin_graph_(NULL),
- dup_ack_graph_(NULL),
- zero_win_graph_(NULL),
- tracer_(NULL),
+ title_(nullptr),
+ base_graph_(nullptr),
+ tput_graph_(nullptr),
+ goodput_graph_(nullptr),
+ seg_graph_(nullptr),
+ seg_eb_(nullptr),
+ ack_graph_(nullptr),
+ sack_graph_(nullptr),
+ sack_eb_(nullptr),
+ sack2_graph_(nullptr),
+ sack2_eb_(nullptr),
+ rwin_graph_(nullptr),
+ dup_ack_graph_(nullptr),
+ zero_win_graph_(nullptr),
+ tracer_(nullptr),
packet_num_(0),
mouse_drags_(true),
- rubber_band_(NULL),
+ rubber_band_(nullptr),
graph_updater_(this),
num_dsegs_(-1),
num_acks_(-1),
@@ -230,52 +231,63 @@ TCPStreamDialog::TCPStreamDialog(QWidget *parent, capture_file *cf, tcp_graph_ty
// Base Graph - enables selecting segments (both data and SACKs)
base_graph_ = sp->addGraph();
base_graph_->setPen(QPen(QBrush(graph_color_1), pen_width));
+
// Throughput Graph - rate of sent bytes
tput_graph_ = sp->addGraph(sp->xAxis, sp->yAxis2);
tput_graph_->setPen(QPen(QBrush(graph_color_2), pen_width));
tput_graph_->setLineStyle(QCPGraph::lsStepLeft);
+
// Goodput Graph - rate of ACKed bytes
goodput_graph_ = sp->addGraph(sp->xAxis, sp->yAxis2);
goodput_graph_->setPen(QPen(QBrush(graph_color_3), pen_width));
goodput_graph_->setLineStyle(QCPGraph::lsStepLeft);
+
// Seg Graph - displays forward data segments on tcptrace graph
seg_graph_ = sp->addGraph();
seg_graph_->setLineStyle(QCPGraph::lsNone);
seg_graph_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDot, Qt::transparent, 0));
-#if 0 // Deactivated due to function not implemented in v2
- seg_graph_->setErrorType(QCPGraph::etValue);
- seg_graph_->setErrorPen(QPen(QBrush(graph_color_1), pen_width));
- seg_graph_->setErrorBarSkipSymbol(false); // draw error spine as single line
- seg_graph_->setErrorBarSize(pkt_point_size_);
-#endif
+ seg_eb_ = new QCPErrorBars(sp->xAxis, sp->yAxis);
+ seg_eb_->setErrorType(QCPErrorBars::etValueError);
+ seg_eb_->setPen(QPen(QBrush(graph_color_1), pen_width));
+ seg_eb_->setSymbolGap(0.0); // draw error spine as single line
+ seg_eb_->setWhiskerWidth(pkt_point_size_);
+ seg_eb_->removeFromLegend();
+ seg_eb_->setDataPlottable(seg_graph_);
+
// Ack Graph - displays ack numbers from reverse packets
ack_graph_ = sp->addGraph();
ack_graph_->setPen(QPen(QBrush(graph_color_2), pen_width));
ack_graph_->setLineStyle(QCPGraph::lsStepLeft);
+
// Sack Graph - displays highest number (most recent) SACK block
sack_graph_ = sp->addGraph();
- sack_graph_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDot, Qt::transparent, 0));
-#if 0 // Deactivated due to function not implemented in v2
- sack_graph_->setErrorType(QCPGraph::etValue);
sack_graph_->setLineStyle(QCPGraph::lsNone);
- sack_graph_->setErrorPen(QPen(QBrush(graph_color_4), pen_width));
- sack_graph_->setErrorBarSkipSymbol(false);
- sack_graph_->setErrorBarSize(0.0);
-#endif
- // RWin graph - displays upper extent of RWIN advertised on reverse packets
+ sack_graph_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDot, Qt::transparent, 0));
+ sack_eb_ = new QCPErrorBars(sp->xAxis, sp->yAxis);
+ sack_eb_->setErrorType(QCPErrorBars::etValueError);
+ sack_eb_->setPen(QPen(QBrush(graph_color_4), pen_width));
+ sack_eb_->setSymbolGap(0.0); // draw error spine as single line
+ sack_eb_->setWhiskerWidth(0.0);
+ sack_eb_->removeFromLegend();
+ sack_eb_->setDataPlottable(sack_graph_);
+
// Sack Graph 2 - displays subsequent SACK blocks
sack2_graph_ = sp->addGraph();
sack2_graph_->setLineStyle(QCPGraph::lsNone);
sack2_graph_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDot, Qt::transparent, 0));
-#if 0 // Deactivated due to function not implemented in v2
- sack2_graph_->setErrorType(QCPGraph::etValue);
- sack2_graph_->setErrorPen(QPen(QBrush(graph_color_5), pen_width));
- sack2_graph_->setErrorBarSkipSymbol(false);
- sack2_graph_->setErrorBarSize(0.0);
-#endif
+ sack2_eb_ = new QCPErrorBars(sp->xAxis, sp->yAxis);
+ sack2_eb_->setErrorType(QCPErrorBars::etValueError);
+ sack2_eb_->setPen(QPen(QBrush(graph_color_5), pen_width));
+ sack2_eb_->setSymbolGap(0.0); // draw error spine as single line
+ sack2_eb_->setWhiskerWidth(0.0);
+ sack2_eb_->removeFromLegend();
+ sack2_eb_->setDataPlottable(sack2_graph_);
+
+ // RWin graph - displays upper extent of RWIN advertised on reverse packets
rwin_graph_ = sp->addGraph();
rwin_graph_->setPen(QPen(QBrush(graph_color_3), pen_width));
rwin_graph_->setLineStyle(QCPGraph::lsStepLeft);
+
// Duplicate ACK Graph - displays duplicate ack ticks
// QCustomPlot doesn't have QCPScatterStyle::ssTick so we have to make our own.
int tick_len = 3;
@@ -293,6 +305,7 @@ TCPStreamDialog::TCPStreamDialog(QWidget *parent, capture_file *cf, tcp_graph_ty
QCPScatterStyle da_ss = QCPScatterStyle(QCPScatterStyle::ssPixmap, graph_color_2, 0);
da_ss.setPixmap(da_tick_pm);
dup_ack_graph_->setScatterStyle(da_ss);
+
// Zero Window Graph - displays zero window crosses (x)
zero_win_graph_ = sp->addGraph();
zero_win_graph_->setLineStyle(QCPGraph::lsNone);
@@ -862,11 +875,12 @@ void TCPStreamDialog::fillTcptrace()
}
base_graph_->setData(pkt_time, pkt_seqnums);
ack_graph_->setData(ackrwin_time, ack);
-#if 0 // Deactivated due to function not implemented in v2
- seg_graph_->setDataValueError(sb_time, sb_center, sb_span);
- sack_graph_->setDataValueError(sack_time, sack_center, sack_span);
- sack2_graph_->setDataValueError(sack2_time, sack2_center, sack2_span);
-#endif
+ seg_graph_->setData(sb_time, sb_center);
+ seg_eb_->setData(sb_span);
+ sack_graph_->setData(sack_time, sack_center);
+ sack_eb_->setData(sack_span);
+ sack2_graph_->setData(sack2_time, sack2_center);
+ sack2_eb_->setData(sack2_span);
rwin_graph_->setData(ackrwin_time, rwin);
dup_ack_graph_->setData(dup_ack_time, dup_ack);
zero_win_graph_->setData(zero_win_time, zero_win);
diff --git a/ui/qt/tcp_stream_dialog.h b/ui/qt/tcp_stream_dialog.h
index deb612d303..edd6133a15 100644
--- a/ui/qt/tcp_stream_dialog.h
+++ b/ui/qt/tcp_stream_dialog.h
@@ -68,9 +68,12 @@ private:
QCPGraph *tput_graph_;
QCPGraph *goodput_graph_;
QCPGraph *seg_graph_;
+ QCPErrorBars *seg_eb_;
QCPGraph *ack_graph_;
QCPGraph *sack_graph_;
+ QCPErrorBars *sack_eb_;
QCPGraph *sack2_graph_;
+ QCPErrorBars *sack2_eb_;
QCPGraph *rwin_graph_;
QCPGraph *dup_ack_graph_;
QCPGraph *zero_win_graph_;