3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
10 #ifndef TCP_STREAM_DIALOG_H
11 #define TCP_STREAM_DIALOG_H
17 #include <epan/dissectors/packet-tcp.h>
19 #include "ui/tap-tcp-stream.h"
21 #include "geometry_state_dialog.h"
23 #include <ui/qt/widgets/qcustomplot.h>
25 #include <QRubberBand>
29 class TCPStreamDialog
;
30 class QCPErrorBarsNotSelectable
;
33 class QCPErrorBarsNotSelectable
: public QCPErrorBars
38 explicit QCPErrorBarsNotSelectable(QCPAxis
*keyAxis
, QCPAxis
*valueAxis
);
39 virtual ~QCPErrorBarsNotSelectable();
41 virtual double selectTest(const QPointF
&pos
, bool onlySelectable
, QVariant
*details
= 0) const Q_DECL_OVERRIDE
;
44 class TCPStreamDialog
: public GeometryStateDialog
49 explicit TCPStreamDialog(QWidget
*parent
= 0, capture_file
*cf
= NULL
, tcp_graph_type graph_type
= GRAPH_TSEQ_TCPTRACE
);
53 void goToPacket(int packet_num
);
56 void setCaptureFile(capture_file
*cf
);
60 void showEvent(QShowEvent
*event
);
61 void keyPressEvent(QKeyEvent
*event
);
62 void mousePressEvent(QMouseEvent
*event
);
63 void mouseReleaseEvent(QMouseEvent
*event
);
66 Ui::TCPStreamDialog
*ui
;
67 capture_file
*cap_file_
;
68 QMultiMap
<double, struct segment
*> time_stamp_map_
;
71 QMap
<double, struct segment
*> sequence_num_map_
;
73 bool seq_origin_zero_
;
74 struct tcp_graph graph_
;
75 QCPTextElement
*title_
;
77 QCPGraph
*base_graph_
; // Clickable packets
78 QCPGraph
*tput_graph_
;
79 QCPGraph
*goodput_graph_
;
81 QCPErrorBars
*seg_eb_
;
83 QCPGraph
*sack_graph_
;
84 QCPErrorBars
*sack_eb_
;
85 QCPGraph
*sack2_graph_
;
86 QCPErrorBars
*sack2_eb_
;
87 QCPGraph
*rwin_graph_
;
88 QCPGraph
*dup_ack_graph_
;
89 QCPGraph
*zero_win_graph_
;
90 QCPItemTracer
*tracer_
;
93 QTransform y_axis_xfrm_
;
95 QRubberBand
*rubber_band_
;
101 GraphUpdater(TCPStreamDialog
*dialog
) :
103 graph_update_timer_(NULL
),
104 reset_axes_(false) {}
105 void triggerUpdate(int timeout
, bool reset_axes
= false);
106 void clearPendingUpdate();
108 bool hasPendingUpdate() { return graph_update_timer_
!= NULL
; }
110 TCPStreamDialog
*dialog_
;
111 QTimer
*graph_update_timer_
;
114 friend class GraphUpdater
;
115 GraphUpdater graph_updater_
;
119 int num_sack_ranges_
;
121 double ma_window_size_
;
124 void fillGraph(bool reset_axes
= true, bool set_focus
= true);
125 void showWidgetsForGraphType();
126 void zoomAxes(bool in
);
127 void zoomXAxis(bool in
);
128 void zoomYAxis(bool in
);
129 void panAxes(int x_pixels
, int y_pixels
);
133 void fillThroughput();
134 void fillRoundTripTime();
135 void fillWindowScale();
136 QString
streamDescription();
137 bool compareHeaders(struct segment
*seg
);
138 void toggleTracerStyle(bool force_default
= false);
139 QRectF
getZoomRanges(QRect zoom_rect
);
142 void showContextMenu(const QPoint
&pos
);
143 void graphClicked(QMouseEvent
*event
);
144 void axisClicked(QCPAxis
*axis
, QCPAxis::SelectablePart part
, QMouseEvent
*event
);
145 void mouseMoved(QMouseEvent
*event
);
146 void mouseReleased(QMouseEvent
*event
);
147 void transformYRange(const QCPRange
&y_range1
);
148 void on_buttonBox_accepted();
149 void on_graphTypeComboBox_currentIndexChanged(int index
);
150 void on_resetButton_clicked();
151 void on_streamNumberSpinBox_valueChanged(int new_stream
);
152 void on_streamNumberSpinBox_editingFinished();
153 void on_maWindowSizeSpinBox_valueChanged(double new_ma_size
);
154 void on_maWindowSizeSpinBox_editingFinished();
155 void on_selectSACKsCheckBox_stateChanged(int state
);
156 void on_otherDirectionButton_clicked();
157 void on_dragRadioButton_toggled(bool checked
);
158 void on_zoomRadioButton_toggled(bool checked
);
159 void on_bySeqNumberCheckBox_stateChanged(int state
);
160 void on_showSegLengthCheckBox_stateChanged(int state
);
161 void on_showThroughputCheckBox_stateChanged(int state
);
162 void on_showGoodputCheckBox_stateChanged(int state
);
163 void on_showRcvWinCheckBox_stateChanged(int state
);
164 void on_showBytesOutCheckBox_stateChanged(int state
);
165 void on_actionZoomIn_triggered();
166 void on_actionZoomInX_triggered();
167 void on_actionZoomInY_triggered();
168 void on_actionZoomOut_triggered();
169 void on_actionZoomOutX_triggered();
170 void on_actionZoomOutY_triggered();
171 void on_actionReset_triggered();
172 void on_actionMoveRight10_triggered();
173 void on_actionMoveLeft10_triggered();
174 void on_actionMoveUp10_triggered();
175 void on_actionMoveDown10_triggered();
176 void on_actionMoveRight1_triggered();
177 void on_actionMoveLeft1_triggered();
178 void on_actionMoveUp1_triggered();
179 void on_actionMoveDown1_triggered();
180 void on_actionNextStream_triggered();
181 void on_actionPreviousStream_triggered();
182 void on_actionSwitchDirection_triggered();
183 void on_actionGoToPacket_triggered();
184 void on_actionDragZoom_triggered();
185 void on_actionToggleSequenceNumbers_triggered();
186 void on_actionToggleTimeOrigin_triggered();
187 void on_actionRoundTripTime_triggered();
188 void on_actionThroughput_triggered();
189 void on_actionStevens_triggered();
190 void on_actionTcptrace_triggered();
191 void on_actionWindowScaling_triggered();
192 void on_buttonBox_helpRequested();
195 #endif // TCP_STREAM_DIALOG_H