Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
tcp_stream_dialog.h
1 /* tcp_stream_dialog.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9 
10 #ifndef TCP_STREAM_DIALOG_H
11 #define TCP_STREAM_DIALOG_H
12 
13 #include <config.h>
14 
15 #include <glib.h>
16 
17 #include <file.h>
18 
19 #include <epan/dissectors/packet-tcp.h>
20 
21 #include "ui/tap-tcp-stream.h"
22 
23 #include "geometry_state_dialog.h"
24 
26 #include <QMenu>
27 #include <QRubberBand>
28 #include <QTimer>
29 
30 namespace Ui {
31 class TCPStreamDialog;
32 }
33 
35 {
36  Q_OBJECT
37 
38 public:
39  explicit TCPStreamDialog(QWidget *parent = 0, capture_file *cf = NULL, tcp_graph_type graph_type = GRAPH_TSEQ_TCPTRACE);
40  ~TCPStreamDialog();
41 
42 signals:
43  void goToPacket(int packet_num);
44 
45 public slots:
46  void setCaptureFile(capture_file *cf);
47  void updateGraph();
48 
49 protected:
50  void showEvent(QShowEvent *event);
51  void keyPressEvent(QKeyEvent *event);
52  void mousePressEvent(QMouseEvent *event);
53  void mouseReleaseEvent(QMouseEvent *event);
54 
55 private:
57  capture_file *cap_file_;
58  QMap<double, struct segment *> time_stamp_map_;
59  double ts_offset_;
60  bool ts_origin_conn_;
61  QMap<double, struct segment *> sequence_num_map_;
62  double seq_offset_;
63  bool seq_origin_zero_;
64  struct tcp_graph graph_;
65  QCPPlotTitle *title_;
66  QString stream_desc_;
67  QCPGraph *base_graph_; // Clickable packets
68  QCPGraph *tput_graph_;
69  QCPGraph *goodput_graph_;
70  QCPGraph *seg_graph_;
71  QCPGraph *ack_graph_;
72  QCPGraph *sack_graph_;
73  QCPGraph *sack2_graph_;
74  QCPGraph *rwin_graph_;
75  QCPGraph *dup_ack_graph_;
76  QCPGraph *zero_win_graph_;
77  QCPItemTracer *tracer_;
78  QRectF axis_bounds_;
79  guint32 packet_num_;
80  QTransform y_axis_xfrm_;
81  bool mouse_drags_;
82  QRubberBand *rubber_band_;
83  QPoint rb_origin_;
84  QMenu ctx_menu_;
85 
86  class GraphUpdater {
87  public:
88  GraphUpdater(TCPStreamDialog *dialog) :
89  dialog_(dialog),
90  graph_update_timer_(NULL),
91  reset_axes_(false) {}
92  void triggerUpdate(int timeout, bool reset_axes = false);
93  void clearPendingUpdate();
94  void doUpdate();
95  bool hasPendingUpdate() { return graph_update_timer_ != NULL; }
96  private:
97  TCPStreamDialog *dialog_;
98  QTimer *graph_update_timer_;
99  bool reset_axes_;
100  };
101  friend class GraphUpdater;
102  GraphUpdater graph_updater_;
103 
104  int num_dsegs_;
105  int num_acks_;
106  int num_sack_ranges_;
107 
108  double ma_window_size_;
109 
110  void findStream();
111  void fillGraph(bool reset_axes = true, bool set_focus = true);
112  void showWidgetsForGraphType();
113  void zoomAxes(bool in);
114  void zoomXAxis(bool in);
115  void zoomYAxis(bool in);
116  void panAxes(int x_pixels, int y_pixels);
117  void resetAxes();
118  void fillStevens();
119  void fillTcptrace();
120  void fillThroughput();
121  void fillRoundTripTime();
122  void fillWindowScale();
123  QString streamDescription();
124  bool compareHeaders(struct segment *seg);
125  void toggleTracerStyle(bool force_default = false);
126  QRectF getZoomRanges(QRect zoom_rect);
127 
128 private slots:
129  void graphClicked(QMouseEvent *event);
130  void axisClicked(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);
131  void mouseMoved(QMouseEvent *event);
132  void mouseReleased(QMouseEvent *event);
133  void transformYRange(const QCPRange &y_range1);
134  void on_buttonBox_accepted();
135  void on_graphTypeComboBox_currentIndexChanged(int index);
136  void on_resetButton_clicked();
137  void on_streamNumberSpinBox_valueChanged(int new_stream);
138  void on_streamNumberSpinBox_editingFinished();
139  void on_maWindowSizeSpinBox_valueChanged(double new_ma_size);
140  void on_maWindowSizeSpinBox_editingFinished();
141  void on_selectSACKsCheckBox_stateChanged(int state);
142  void on_otherDirectionButton_clicked();
143  void on_dragRadioButton_toggled(bool checked);
144  void on_zoomRadioButton_toggled(bool checked);
145  void on_bySeqNumberCheckBox_stateChanged(int state);
146  void on_showSegLengthCheckBox_stateChanged(int state);
147  void on_showThroughputCheckBox_stateChanged(int state);
148  void on_showGoodputCheckBox_stateChanged(int state);
149  void on_showRcvWinCheckBox_stateChanged(int state);
150  void on_showBytesOutCheckBox_stateChanged(int state);
151  void on_actionZoomIn_triggered();
152  void on_actionZoomInX_triggered();
153  void on_actionZoomInY_triggered();
154  void on_actionZoomOut_triggered();
155  void on_actionZoomOutX_triggered();
156  void on_actionZoomOutY_triggered();
157  void on_actionReset_triggered();
158  void on_actionMoveRight10_triggered();
159  void on_actionMoveLeft10_triggered();
160  void on_actionMoveUp10_triggered();
161  void on_actionMoveDown10_triggered();
162  void on_actionMoveRight1_triggered();
163  void on_actionMoveLeft1_triggered();
164  void on_actionMoveUp1_triggered();
165  void on_actionMoveDown1_triggered();
166  void on_actionNextStream_triggered();
167  void on_actionPreviousStream_triggered();
168  void on_actionSwitchDirection_triggered();
169  void on_actionGoToPacket_triggered();
170  void on_actionDragZoom_triggered();
171  void on_actionToggleSequenceNumbers_triggered();
172  void on_actionToggleTimeOrigin_triggered();
173  void on_actionRoundTripTime_triggered();
174  void on_actionThroughput_triggered();
175  void on_actionStevens_triggered();
176  void on_actionTcptrace_triggered();
177  void on_actionWindowScaling_triggered();
178  void on_buttonBox_helpRequested();
179 };
180 
181 #endif // TCP_STREAM_DIALOG_H
182 
183 /*
184  * Editor modelines
185  *
186  * Local Variables:
187  * c-basic-offset: 4
188  * tab-width: 8
189  * indent-tabs-mode: nil
190  * End:
191  *
192  * ex: set shiftwidth=4 tabstop=8 expandtab:
193  * :indentSize=4:tabSize=8:noTabs=true:
194  */
Definition: ui_tcp_stream_dialog.h:562
Definition: geometry_state_dialog.h:15
Definition: ui_about_dialog.h:291
Definition: tap-tcp-stream.h:54
A plottable representing a graph in a plot.
Definition: qcustomplot.h:2492
Item that sticks to QCPGraph data points.
Definition: qcustomplot.h:3635
Manages a single axis inside a QCustomPlot.
Definition: qcustomplot.h:982
Definition: tap-tcp-stream.h:29
A layout element displaying a plot title text.
Definition: qcustomplot.h:2295
SelectablePart
Definition: qcustomplot.h:1082
Definition: cfile.h:58
Represents the range an axis is encompassing.
Definition: qcustomplot.h:478
Definition: tcp_stream_dialog.h:34