Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
tcp_stream_dialog.h
Go to the documentation of this file.
1
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;
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);
142
147 void keyPressEvent(QKeyEvent *event);
148
153 void mousePressEvent(QMouseEvent *event);
154
159 void mouseReleaseEvent(QMouseEvent *event);
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 bool legend_visible_;
197
199 struct tcp_graph graph_;
200
202 follow_stream_count_func get_stream_count_;
203
205 QCPTextElement *title_;
206
208 QString stream_desc_;
209
211 QCPGraph *base_graph_;
212
214 QCPGraph *tput_graph_;
215
217 QCPGraph *goodput_graph_;
218
220 QCPGraph *seg_graph_;
221
223 QCPErrorBars *seg_eb_;
224
226 QCPGraph *ack_graph_;
227
229 QCPGraph *sack_graph_;
230
232 QCPErrorBars *sack_eb_;
233
235 QCPGraph *sack2_graph_;
236
238 QCPErrorBars *sack2_eb_;
239
241 QCPGraph *rwin_graph_;
242
244 QCPGraph *dup_ack_graph_;
245
247 QCPGraph *zero_win_graph_;
248
250 QCPItemTracer *tracer_;
251
253 QRectF axis_bounds_;
254
256 uint32_t packet_num_;
257
259 QTransform y_axis_xfrm_;
260
262 bool mouse_drags_;
263
265 QRubberBand *rubber_band_;
266
268 QPoint rb_origin_;
269
271 QMenu ctx_menu_;
272
276 class GraphUpdater {
277 public:
282 GraphUpdater(TCPStreamDialog *dialog) :
283 dialog_(dialog),
284 graph_update_timer_(NULL),
285 reset_axes_(false) {}
286
292 void triggerUpdate(int timeout, bool reset_axes = false);
293
297 void clearPendingUpdate();
298
303 void doUpdate(follow_stream_count_func get_count);
304
309 bool hasPendingUpdate() { return graph_update_timer_ != NULL; }
310 private:
311 TCPStreamDialog *dialog_;
312 QTimer *graph_update_timer_;
313 bool reset_axes_;
314 };
316 friend class GraphUpdater;
317
319 GraphUpdater graph_updater_;
320
322 int num_dsegs_;
323
325 int num_acks_;
326
328 int num_sack_ranges_;
329
331 double ma_window_size_;
332
334 void findStream();
335
341 void fillGraph(bool reset_axes = true, bool set_focus = true);
342
344 void showWidgetsForGraphType();
345
350 void zoomAxes(bool in);
351
356 void zoomXAxis(bool in);
357
362 void zoomYAxis(bool in);
363
369 void setAxisUnits(QCPAxis *axis, format_size_units_e units);
370
376 void panAxes(int x_pixels, int y_pixels);
377
379 void resetAxes();
380
382 void fillLegend();
383
385 void moveLegend();
386
388 void toggleLegend();
389
391 void fillStevens();
392
394 void fillTcptrace();
395
397 void fillThroughput();
398
400 void fillRoundTripTime();
401
403 void fillWindowScale();
404
409 QString streamDescription();
410
416 bool compareHeaders(struct segment *seg);
417
422 void toggleTracerStyle(bool force_default = false);
423
429 QRectF getZoomRanges(QRect zoom_rect);
430
431private slots:
436 void showContextMenu(const QPoint &pos);
437
442 void graphClicked(QMouseEvent *event);
443
450 void axisClicked(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);
451
456 void mouseMoved(QMouseEvent *event);
457
462 void mouseReleased(QMouseEvent *event);
463
468 void captureEvent(CaptureEvent e);
469
474 void transformYRange(const QCPRange &y_range1);
475
477 void toggleUnits();
478
480 void on_buttonBox_accepted();
481
483 void on_graphTypeComboBox_currentIndexChanged(int index);
484
486 void on_resetButton_clicked();
487
489 void on_streamNumberSpinBox_valueChanged(int new_stream);
490
492 void on_streamNumberSpinBox_editingFinished();
493
495 void on_maWindowSizeSpinBox_valueChanged(double new_ma_size);
496
498 void on_maWindowSizeSpinBox_editingFinished();
499
501 void on_selectSACKsCheckBox_stateChanged(int state);
502
504 void on_otherDirectionButton_clicked();
505
507 void on_dragRadioButton_toggled(bool checked);
508
510 void on_zoomRadioButton_toggled(bool checked);
511
513 void on_bySeqNumberCheckBox_stateChanged(int state);
514
516 void on_samplingMethodComboBox_currentIndexChanged(int index);
517
519 void on_showSegLengthCheckBox_stateChanged(int state);
520
522 void on_showThroughputCheckBox_stateChanged(int state);
523
525 void on_showGoodputCheckBox_stateChanged(int state);
526
528 void on_showRcvWinCheckBox_stateChanged(int state);
529
531 void on_showBytesOutCheckBox_stateChanged(int state);
532
534 void on_actionZoomIn_triggered();
535
537 void on_actionZoomInX_triggered();
538
540 void on_actionZoomInY_triggered();
541
543 void on_actionZoomOut_triggered();
544
546 void on_actionZoomOutX_triggered();
547
549 void on_actionZoomOutY_triggered();
550
552 void on_actionReset_triggered();
553
555 void on_actionMoveRight10_triggered();
556
558 void on_actionMoveLeft10_triggered();
559
561 void on_actionMoveUp10_triggered();
562
564 void on_actionMoveDown10_triggered();
565
567 void on_actionMoveRight1_triggered();
568
570 void on_actionMoveLeft1_triggered();
571
573 void on_actionMoveUp1_triggered();
574
576 void on_actionMoveDown1_triggered();
577
579 void on_actionNextStream_triggered();
580
582 void on_actionPreviousStream_triggered();
583
585 void on_actionSwitchDirection_triggered();
586
588 void on_actionGoToPacket_triggered();
589
591 void on_actionDragZoom_triggered();
592
594 void on_actionToggleSequenceNumbers_triggered();
595
597 void on_actionToggleTimeOrigin_triggered();
598
600 void on_actionRoundTripTime_triggered();
601
603 void on_actionThroughput_triggered();
604
606 void on_actionStevens_triggered();
607
609 void on_actionTcptrace_triggered();
610
612 void on_actionWindowScaling_triggered();
613
615 void on_buttonBox_helpRequested();
616};
617
618#endif // TCP_STREAM_DIALOG_H
619
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
A custom QCPGraph representing Duplicate ACKs.
Definition tcp_stream_dialog.h:78
virtual ~DupAckGraph()
Destroys the DupAckGraph.
Definition tcp_stream_dialog.cpp:126
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override
Draws the legend icon specific to Duplicate ACKs.
Definition tcp_stream_dialog.cpp:130
A dialog that remembers its geometry and splitter state.
Definition geometry_state_dialog.h:20
Custom QCPErrorBars class that disables selectability.
Definition tcp_stream_dialog.h:41
virtual ~QCPErrorBarsNotSelectable()
Destroys the QCPErrorBarsNotSelectable instance.
Definition tcp_stream_dialog.cpp:88
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override
Draws the legend icon for the error bars.
Definition tcp_stream_dialog.cpp:100
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:92
A dialog providing various graphical analyses of a TCP stream.
Definition tcp_stream_dialog.h:106
void mouseReleaseEvent(QMouseEvent *event)
Handles mouse release events on the graph.
Definition tcp_stream_dialog.cpp:600
friend class GraphUpdater
Friend class allowing access to private members.
Definition tcp_stream_dialog.h:316
void goToPacket(int packet_num)
Signal emitted to navigate to a specific packet in the main UI.
void keyPressEvent(QKeyEvent *event)
Handles key press events within the dialog (e.g., zooming/panning shortcuts).
Definition tcp_stream_dialog.cpp:473
void updateGraph()
Triggers an update of the graph data and display.
Definition tcp_stream_dialog.cpp:2281
~TCPStreamDialog()
Destroys the TCPStreamDialog.
Definition tcp_stream_dialog.cpp:457
void showEvent(QShowEvent *event)
Handles the show event for the dialog.
Definition tcp_stream_dialog.cpp:468
void mousePressEvent(QMouseEvent *event)
Handles mouse press events on the graph.
Definition tcp_stream_dialog.cpp:592
format_size_units_e
Unit types used by format_size_wmem() for formatting size values.
Definition str_util.h:327
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