1 /* lte_rlc_graph_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 LTE_RLC_GRAPH_DIALOG_H
11 #define LTE_RLC_GRAPH_DIALOG_H
12 
13 #include "wireshark_dialog.h"
14 #include <ui/tap-rlc-graph.h>
15 
16 #include <ui/qt/widgets/qcustomplot.h>
17 
18 class QMenu;
19 class QRubberBand;
20 
21 namespace Ui {
22 class LteRlcGraphDialog;
23 }
24 
25 class LteRlcGraphDialog : public WiresharkDialog
26 {
27     Q_OBJECT
28 
29 public:
30     // TODO: will need to add another constructor option to give channel explicitly,
31     // rather than find in currently selected packet, for when launch graph from
32     // RLC statistics dialog.
33     explicit LteRlcGraphDialog(QWidget &parent, CaptureFile &cf, bool channelKnown);
34     ~LteRlcGraphDialog();
35 
36     void setChannelInfo(guint16 ueid, guint8 rlcMode,
37                         guint16 channelType, guint16 channelId, guint8 direction,
38                         bool maybe_empty=false);
39 
40 signals:
41     void goToPacket(int packet_num);
42 
43 protected:
44     void showEvent(QShowEvent *event);
45     void keyPressEvent(QKeyEvent *event);
46 
47 private:
48     Ui::LteRlcGraphDialog *ui;
49     bool mouse_drags_;
50     QRubberBand *rubber_band_;
51     QPoint rb_origin_;
52     QMenu *ctx_menu_;
53 
54     // Data gleaned directly from tapping packets (shared with gtk impl)
55     struct rlc_graph graph_;
56 
57     // Data
58     QMultiMap<double, struct rlc_segment *> time_stamp_map_;
59     QMap<double, struct rlc_segment *> sequence_num_map_;
60 
61     QCPGraph *base_graph_; // Clickable packets
62     QCPGraph *reseg_graph_;
63     QCPGraph *acks_graph_;
64     QCPGraph *nacks_graph_;
65     QCPItemTracer *tracer_;
66     guint32 packet_num_;
67 
68     void completeGraph(bool may_be_empty=false);
69 
70     bool compareHeaders(rlc_segment *seg);
71 
72     void findChannel(bool may_fail=false);
73     void fillGraph();
74 
75     void zoomAxes(bool in);
76     void zoomXAxis(bool in);
77     void zoomYAxis(bool in);
78 
79     void panAxes(int x_pixels, int y_pixels);
80     QRectF getZoomRanges(QRect zoom_rect);
81 
82     void toggleTracerStyle(bool force_default);
83 
84 private slots:
85     void graphClicked(QMouseEvent *event);
86     void mouseMoved(QMouseEvent *event);
87     void mouseReleased(QMouseEvent *event);
88     void resetAxes();
89 
90     void on_dragRadioButton_toggled(bool checked);
91     void on_zoomRadioButton_toggled(bool checked);
92     void on_resetButton_clicked();
93     void on_otherDirectionButton_clicked();
94 
95     void on_actionReset_triggered();
96     void on_actionZoomIn_triggered();
97     void on_actionZoomOut_triggered();
98     void on_actionMoveUp10_triggered();
99     void on_actionMoveLeft10_triggered();
100     void on_actionMoveRight10_triggered();
101     void on_actionMoveDown10_triggered();
102     void on_actionMoveUp1_triggered();
103     void on_actionMoveLeft1_triggered();
104     void on_actionMoveRight1_triggered();
105     void on_actionMoveDown1_triggered();
106     void on_actionDragZoom_triggered();
107     void on_actionMoveUp100_triggered();
108     void on_actionMoveDown100_triggered();
109     void on_actionGoToPacket_triggered();
110     void on_actionCrosshairs_triggered();
111     void on_actionSwitchDirection_triggered();
112 
113     void on_buttonBox_accepted();
114 };
115 
116 #endif // LTE_RLC_GRAPH_DIALOG_H
117