| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
rtp_analysis_dialog.h
Go to the documentation of this file.
1
10#ifndef RTP_ANALYSIS_DIALOG_H
11#define RTP_ANALYSIS_DIALOG_H
12
13#include <config.h>
14
15#include <mutex>
16
17#include "epan/address.h"
18
19#include "ui/rtp_stream.h"
20#include "ui/tap-rtp-common.h"
21#include "ui/tap-rtp-analysis.h"
22
23#include <QMenu>
24#include <QTreeWidget>
25#include <QLabel>
26#include <QFile>
27#include <QCheckBox>
28#include <QHBoxLayout>
29#include <QToolButton>
30
31#include "wireshark_dialog.h"
32
33namespace Ui {
34class RtpAnalysisDialog;
35}
36
37class QCPGraph;
38class QTemporaryFile;
39class QDialogButtonBox;
40
41class PacketList;
42class RtpBaseDialog;
43
44 typedef struct {
45 rtpstream_info_t stream;
46 QVector<double> *time_vals;
47 QVector<double> *jitter_vals;
48 QVector<double> *diff_vals;
49 QVector<double> *delta_vals;
50 QTreeWidget *tree_widget;
51 QLabel *statistics_label;
52 QString *tab_name;
53 QCPGraph *jitter_graph;
54 QCPGraph *diff_graph;
55 QCPGraph *delta_graph;
56 QHBoxLayout *graphHorizontalLayout;
57 QCheckBox *stream_checkbox;
58 QCheckBox *jitter_checkbox;
59 QCheckBox *diff_checkbox;
60 QCheckBox *delta_checkbox;
61} tab_info_t;
62
63// Singleton by https://refactoring.guru/design-patterns/singleton/cpp/example#example-1
64 class RtpAnalysisDialog : public WiresharkDialog
65{
66 Q_OBJECT
67
68public:
72 static RtpAnalysisDialog *openRtpAnalysisDialog(QWidget &parent, CaptureFile &cf, PacketList *packet_list);
73
77 RtpAnalysisDialog(RtpAnalysisDialog &other) = delete;
78 void operator=(const RtpAnalysisDialog &) = delete;
79
85 static QToolButton *addAnalyzeButton(QDialogButtonBox *button_box, RtpBaseDialog *dialog);
86
92 void replaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
93 void addRtpStreams(QVector<rtpstream_id_t *> stream_ids);
94 void removeRtpStreams(QVector<rtpstream_id_t *> stream_ids);
95
96signals:
97 void goToPacket(int packet_num);
98 void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
99 void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *> stream_ids);
100 void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *> stream_ids);
101 void updateFilter(QString filter, bool force = false);
102
103public slots:
104 void rtpPlayerReplace();
105 void rtpPlayerAdd();
106 void rtpPlayerRemove();
107
108protected slots:
109 virtual void updateWidgets();
110
111protected:
112 explicit RtpAnalysisDialog(QWidget &parent, CaptureFile &cf);
113 ~RtpAnalysisDialog();
114
115private slots:
116 void on_actionGoToPacket_triggered();
117 void on_actionNextProblem_triggered();
118 void on_actionSaveOneCsv_triggered();
119 void on_actionSaveAllCsv_triggered();
120 void on_actionSaveGraph_triggered();
121 void on_buttonBox_helpRequested();
122 void showStreamMenu(QPoint pos);
123 void showGraphMenu(const QPoint &pos);
124 void graphClicked(QMouseEvent *event);
125 void closeTab(int index);
126 void rowCheckboxChanged(int checked);
127 void singleCheckboxChanged(int checked);
128 void on_actionPrepareFilterOne_triggered();
129 void on_actionPrepareFilterAll_triggered();
130
131private:
132 static RtpAnalysisDialog *pinstance_;
133 static std::mutex init_mutex_;
134 static std::mutex run_mutex_;
135
136 Ui::RtpAnalysisDialog *ui;
137 enum StreamDirection { dir_all_, dir_one_ };
138 int tab_seq;
139
140 QVector<tab_info_t *> tabs_;
141 QMultiHash<unsigned, tab_info_t *> tab_hash_;
142
143 QToolButton *player_button_;
144
145 // Graph data for QCustomPlot
146 QList<QCPGraph *>graphs_;
147
148 QString err_str_;
149
150 QMenu stream_ctx_menu_;
151 QMenu graph_ctx_menu_;
152
153 // Tap callbacks
154 static void tapReset(void *tapinfo_ptr);
155 static tap_packet_status tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *rtpinfo_ptr, tap_flags_t flags);
156 static void tapDraw(void *tapinfo_ptr);
157
158 void resetStatistics();
159 void addPacket(tab_info_t *tab, packet_info *pinfo, const struct _rtp_info *rtpinfo);
160 void updateStatistics();
161 void updateGraph();
162
163 void saveCsvHeader(QFile *save_file, QTreeWidget *tree);
164 void saveCsvData(QFile *save_file, QTreeWidget *tree);
165 void saveCsv(StreamDirection direction);
166
167 bool eventFilter(QObject*, QEvent* event);
168
169 QVector<rtpstream_id_t *>getSelectedRtpIds();
170 int addTabUI(tab_info_t *new_tab);
171 tab_info_t *getTabInfoForCurrentTab();
172 void deleteTabInfo(tab_info_t *tab_info);
173 void clearLayout(QLayout *layout);
174 void addRtpStreamsPrivate(QVector<rtpstream_id_t *> stream_ids);
175};
176
177#endif // RTP_ANALYSIS_DIALOG_H
address.h
CaptureFile
Definition capture_file.h:21
PacketList
Definition packet_list.h:40
RtpAnalysisDialog
Definition rtp_analysis_dialog.h:65
RtpAnalysisDialog::openRtpAnalysisDialog
static RtpAnalysisDialog * openRtpAnalysisDialog(QWidget &parent, CaptureFile &cf, PacketList *packet_list)
Definition rtp_analysis_dialog.cpp:241
RtpAnalysisDialog::RtpAnalysisDialog
RtpAnalysisDialog(RtpAnalysisDialog &other)=delete
RtpAnalysisDialog::replaceRtpStreams
void replaceRtpStreams(QVector< rtpstream_id_t * > stream_ids)
Definition rtp_analysis_dialog.cpp:1040
RtpAnalysisDialog::addAnalyzeButton
static QToolButton * addAnalyzeButton(QDialogButtonBox *button_box, RtpBaseDialog *dialog)
Common routine to add a "Analyze" button to a QDialogButtonBox.
Definition rtp_analysis_dialog.cpp:1147
RtpBaseDialog
Definition rtp_player_dialog.h:66
WiresharkDialog
Definition wireshark_dialog.h:35
rtp_stream.h
_packet_info
Definition packet_info.h:43
_rtp_info
Definition packet-rtp.h:29
_rtpstream_info
Definition rtp_stream.h:40
epan_dissect
Definition epan_dissect.h:28
stream
Definition stream.c:41
tab_info_t
Definition rtp_analysis_dialog.h:44
tap-rtp-analysis.h
tap-rtp-common.h
tap_packet_status
tap_packet_status
Definition tap.h:25
wireshark_dialog.h