Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
tcp_stream_dialog.h
Go to the documentation of this file.
1
9
10#ifndef TCP_STREAM_DIALOG_H
11#define TCP_STREAM_DIALOG_H
12
13#include <config.h>
14
15#include <file.h>
16
17#include <epan/dissectors/packet-tcp.h>
18#include <epan/follow.h>
19#include <wsutil/str_util.h>
20
21#include "ui/tap-tcp-stream.h"
22
23#include "capture_file.h"
25
26#include <ui/qt/widgets/qcustomplot.h>
27#include <QMenu>
28#include <QRubberBand>
29#include <QTimer>
30
31namespace Ui {
32class TCPStreamDialog;
33class QCPErrorBarsNotSelectable;
34class DupAckGraph;
35}
36
40class QCPErrorBarsNotSelectable : public QCPErrorBars
41{
42 Q_OBJECT
43
44public:
50 explicit QCPErrorBarsNotSelectable(QCPAxis *keyAxis, QCPAxis *valueAxis);
51
56
64 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details = 0) const Q_DECL_OVERRIDE;
65
71 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override;
72};
73
77class DupAckGraph : public QCPGraph
78{
79 Q_OBJECT
80
81public:
87 explicit DupAckGraph(QCPAxis *keyAxis, QCPAxis *valueAxis);
88
92 virtual ~DupAckGraph();
93
99 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override;
100};
101
106{
107 Q_OBJECT
108
109public:
116 explicit TCPStreamDialog(QWidget *parent, const CaptureFile &cf, tcp_graph_type graph_type = GRAPH_TSEQ_TCPTRACE);
117
122
123signals:
128 void goToPacket(int packet_num);
129
130public slots:
134 void updateGraph();
135
136protected:
141 void showEvent(QShowEvent *event) override;
142
147 void keyPressEvent(QKeyEvent *event) override;
148
153 void mousePressEvent(QMouseEvent *event) override;
154
159 void mouseReleaseEvent(QMouseEvent *event) override;
160
161private:
163 Ui::TCPStreamDialog *ui;
164
166 const CaptureFile &cap_file_;
167
169 bool file_closed_;
170
172 bool tapping_;
173
175 QMultiMap<double, struct segment *> time_stamp_map_;
176
178 double ts_offset_;
179
181 bool ts_origin_conn_;
182
184 QMap<double, struct segment *> sequence_num_map_;
185
187 uint32_t seq_offset_;
188
190 bool seq_origin_zero_;
191
193 bool si_units_;
194
196 int x_axis_width_ = -1;
197
199 bool legend_visible_;
200
202 struct tcp_graph graph_;
203
205 follow_stream_count_func get_stream_count_;
206
208 QCPTextElement *title_;
209
211 QString stream_desc_;
212
214 QCPGraph *base_graph_;
215
217 QCPGraph *tput_graph_;
218
220 QCPGraph *goodput_graph_;
221
223 QCPGraph *seg_graph_;
224
226 QCPErrorBars *seg_eb_;
227
229 QCPGraph *ack_graph_;
230
232 QCPGraph *sack_graph_;
233
235 QCPErrorBars *sack_eb_;
236
238 QCPGraph *sack2_graph_;
239
241 QCPErrorBars *sack2_eb_;
242
244 QCPGraph *rwin_graph_;
245
247 QCPGraph *dup_ack_graph_;
248
250 QCPGraph *zero_win_graph_;
251
253 QCPItemTracer *tracer_;
254
256 QRectF axis_bounds_;
257
259 uint32_t packet_num_;
260
262 QTransform y_axis_xfrm_;
263
265 bool mouse_drags_;
266
268 QRubberBand *rubber_band_;
269
271 QPoint rb_origin_;
272
274 QMenu ctx_menu_;
275
279 class GraphUpdater {
280 public:
286 dialog_(dialog),
287 graph_update_timer_(NULL),
288 reset_axes_(false) {}
289
295 void triggerUpdate(int timeout, bool reset_axes = false);
296
300 void clearPendingUpdate();
301
306 void doUpdate(follow_stream_count_func get_count);
307
312 bool hasPendingUpdate() { return graph_update_timer_ != NULL; }
313 private:
314 TCPStreamDialog *dialog_;
315 QTimer *graph_update_timer_;
316 bool reset_axes_;
317 };
319 friend class GraphUpdater;
320
322 GraphUpdater graph_updater_;
323
325 int num_dsegs_;
326
328 int num_acks_;
329
331 int num_sack_ranges_;
332
334 double ma_window_size_;
335
337 void findStream();
338
344 void fillGraph(bool reset_axes = true, bool set_focus = true);
345
347 void showWidgetsForGraphType();
348
353 void zoomAxes(bool in);
354
359 void zoomXAxis(bool in);
360
365 void zoomYAxis(bool in);
366
372 void setAxisUnits(QCPAxis *axis, format_size_units_e units);
373
379 void fitXAxisTicks();
380
386 void panAxes(int x_pixels, int y_pixels);
387
389 void resetAxes();
390
392 void fillLegend();
393
395 void moveLegend();
396
398 void toggleLegend();
399
401 void fillStevens();
402
404 void fillTcptrace();
405
407 void fillThroughput();
408
410 void fillRoundTripTime();
411
413 void fillWindowScale();
414
416 void applySeriesColors();
417
419 void applyYAxis2Color();
420
425 QString streamDescription();
426
432 bool compareHeaders(struct segment *seg);
433
438 void toggleTracerStyle(bool force_default = false);
439
445 QRectF getZoomRanges(QRect zoom_rect);
446
447private slots:
452 void showContextMenu(const QPoint &pos);
453
458 void graphClicked(QMouseEvent *event);
459
466 void axisClicked(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);
467
472 void mouseMoved(QMouseEvent *event);
473
478 void mouseReleased(QMouseEvent *event);
479
484 void captureEvent(CaptureEvent e);
485
490 void transformYRange(const QCPRange &y_range1);
491
493 void toggleUnits();
494
496 void on_buttonBox_accepted();
497
499 void on_graphTypeComboBox_currentIndexChanged(int index);
500
502 void on_resetButton_clicked();
503
505 void on_streamNumberSpinBox_valueChanged(int new_stream);
506
508 void on_streamNumberSpinBox_editingFinished();
509
511 void on_maWindowSizeSpinBox_valueChanged(double new_ma_size);
512
514 void on_maWindowSizeSpinBox_editingFinished();
515
517 void on_selectSACKsCheckBox_stateChanged(int state);
518
520 void on_otherDirectionButton_clicked();
521
523 void on_dragRadioButton_toggled(bool checked);
524
526 void on_zoomRadioButton_toggled(bool checked);
527
529 void on_bySeqNumberCheckBox_stateChanged(int state);
530
532 void on_samplingMethodComboBox_currentIndexChanged(int index);
533
535 void on_showSegLengthCheckBox_stateChanged(int state);
536
538 void on_showThroughputCheckBox_stateChanged(int state);
539
541 void on_showGoodputCheckBox_stateChanged(int state);
542
544 void on_showRcvWinCheckBox_stateChanged(int state);
545
547 void on_showBytesOutCheckBox_stateChanged(int state);
548
550 void on_actionZoomIn_triggered();
551
553 void on_actionZoomInX_triggered();
554
556 void on_actionZoomInY_triggered();
557
559 void on_actionZoomOut_triggered();
560
562 void on_actionZoomOutX_triggered();
563
565 void on_actionZoomOutY_triggered();
566
568 void on_actionReset_triggered();
569
571 void on_actionMoveRight10_triggered();
572
574 void on_actionMoveLeft10_triggered();
575
577 void on_actionMoveUp10_triggered();
578
580 void on_actionMoveDown10_triggered();
581
583 void on_actionMoveRight1_triggered();
584
586 void on_actionMoveLeft1_triggered();
587
589 void on_actionMoveUp1_triggered();
590
592 void on_actionMoveDown1_triggered();
593
595 void on_actionNextStream_triggered();
596
598 void on_actionPreviousStream_triggered();
599
601 void on_actionSwitchDirection_triggered();
602
604 void on_actionGoToPacket_triggered();
605
607 void on_actionDragZoom_triggered();
608
610 void on_actionToggleSequenceNumbers_triggered();
611
613 void on_actionToggleTimeOrigin_triggered();
614
616 void on_actionRoundTripTime_triggered();
617
619 void on_actionThroughput_triggered();
620
622 void on_actionStevens_triggered();
623
625 void on_actionTcptrace_triggered();
626
628 void on_actionWindowScaling_triggered();
629
631 void on_buttonBox_helpRequested();
632};
633
634#endif // TCP_STREAM_DIALOG_H
635
Represents an event occurring during a capture or file operation.
Definition capture_event.h:24
Manages a capture file and its associated state and operations.
Definition capture_file.h:27
virtual ~DupAckGraph()
Destroys the DupAckGraph.
Definition tcp_stream_dialog.cpp:124
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override
Draws the legend icon specific to Duplicate ACKs.
Definition tcp_stream_dialog.cpp:128
DupAckGraph(QCPAxis *keyAxis, QCPAxis *valueAxis)
Constructs a new DupAckGraph.
Definition tcp_stream_dialog.cpp:119
GeometryStateDialog(QWidget *parent, Qt::WindowFlags f=Qt::Window)
Constructs a new GeometryStateDialog with the specified parent and window flags.
Definition geometry_state_dialog.h:91
virtual ~QCPErrorBarsNotSelectable()
Destroys the QCPErrorBarsNotSelectable instance.
Definition tcp_stream_dialog.cpp:86
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override
Draws the legend icon for the error bars.
Definition tcp_stream_dialog.cpp:98
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE
Overrides the selectTest to always return -1, disabling selection.
Definition tcp_stream_dialog.cpp:90
QCPErrorBarsNotSelectable(QCPAxis *keyAxis, QCPAxis *valueAxis)
Constructs a new QCPErrorBarsNotSelectable instance.
Definition tcp_stream_dialog.cpp:81
void keyPressEvent(QKeyEvent *event) override
Handles key press events within the dialog (e.g., zooming/panning shortcuts).
Definition tcp_stream_dialog.cpp:451
friend class GraphUpdater
Friend class allowing access to private members.
Definition tcp_stream_dialog.h:319
void showEvent(QShowEvent *event) override
Handles the show event for the dialog.
Definition tcp_stream_dialog.cpp:446
void goToPacket(int packet_num)
Signal emitted to navigate to a specific packet in the main UI.
void updateGraph()
Triggers an update of the graph data and display.
Definition tcp_stream_dialog.cpp:2318
void mousePressEvent(QMouseEvent *event) override
Handles mouse press events on the graph.
Definition tcp_stream_dialog.cpp:570
~TCPStreamDialog()
Destroys the TCPStreamDialog.
Definition tcp_stream_dialog.cpp:435
void mouseReleaseEvent(QMouseEvent *event) override
Handles mouse release events on the graph.
Definition tcp_stream_dialog.cpp:578
TCPStreamDialog(QWidget *parent, const CaptureFile &cf, tcp_graph_type graph_type=GRAPH_TSEQ_TCPTRACE)
Constructs a new TCPStreamDialog.
Definition tcp_stream_dialog.cpp:136
format_size_units_e
Unit types used by format_size_wmem() for formatting size values.
Definition str_util.h:375
Represents a single decoded TCP segment extracted from a captured frame for graph analysis.
Definition tap-tcp-stream.h:56
Describes a TCP stream graph, including the stream identity, graph type, and collected segment list.
Definition tap-tcp-stream.h:83
enum tcp_graph_type_ tcp_graph_type
Selects the plot type displayed in the TCP Stream Graph dialog.
@ GRAPH_TSEQ_TCPTRACE
Definition tap-tcp-stream.h:26