Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
rtp_analysis_dialog.h
Go to the documentation of this file.
1
9
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 <QPushButton>
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
47typedef struct {
50
52 QVector<double> *time_vals;
53
55 QVector<double> *jitter_vals;
56
58 QVector<double> *diff_vals;
59
61 QVector<double> *delta_vals;
62
64 QTreeWidget *tree_widget;
65
68
70 QString *tab_name;
71
73 QCPGraph *jitter_graph;
74
76 QCPGraph *diff_graph;
77
79 QCPGraph *delta_graph;
80
83
85 QCheckBox *stream_checkbox;
86
88 QCheckBox *jitter_checkbox;
89
91 QCheckBox *diff_checkbox;
92
94 QCheckBox *delta_checkbox;
95
100
104// Singleton by https://refactoring.guru/design-patterns/singleton/cpp/example#example-1
106{
107 Q_OBJECT
108
109public:
117 static RtpAnalysisDialog *openRtpAnalysisDialog(QWidget &parent, CaptureFile &cf, PacketList *packet_list);
118
124
128 void operator=(const RtpAnalysisDialog &) = delete;
129
136 static QPushButton *addAnalyzeButton(QDialogButtonBox *button_box, RtpBaseDialog *dialog);
137
144 void replaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
145
152 void addRtpStreams(QVector<rtpstream_id_t *> stream_ids);
153
160 void removeRtpStreams(QVector<rtpstream_id_t *> stream_ids);
161
162signals:
167 void goToPacket(int packet_num);
168
173 void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
174
179 void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *> stream_ids);
180
185 void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *> stream_ids);
186
192 void updateFilter(QString filter, bool force = false);
193
194public slots:
198 void rtpPlayerReplace();
199
203 void rtpPlayerAdd();
204
208 void rtpPlayerRemove();
209
210protected slots:
214 virtual void updateWidgets() override;
215
216protected:
222 explicit RtpAnalysisDialog(QWidget &parent, CaptureFile &cf);
223
228
229private slots:
233 void on_actionGoToPacket_triggered();
234
238 void on_actionNextProblem_triggered();
239
243 void on_actionSaveOneCsv_triggered();
244
248 void on_actionSaveAllCsv_triggered();
249
253 void on_actionSaveGraph_triggered();
254
258 void on_buttonBox_helpRequested();
259
264 void showStreamMenu(QPoint pos);
265
270 void showGraphMenu(const QPoint &pos);
271
276 void graphClicked(QMouseEvent *event);
277
282 void closeTab(int index);
283
288 void rowCheckboxChanged(int checked);
289
294 void singleCheckboxChanged(int checked);
295
299 void on_actionPrepareFilterOne_triggered();
300
304 void on_actionPrepareFilterAll_triggered();
305
306private:
308 static RtpAnalysisDialog *pinstance_;
309
311 static std::mutex init_mutex_;
312
314 static std::mutex run_mutex_;
315
317 Ui::RtpAnalysisDialog *ui;
318
322 enum StreamDirection {
323 dir_all_,
324 dir_one_
325 };
326
328 int tab_seq;
329
331 QVector<tab_info_t *> tabs_;
332
334 QMultiHash<unsigned, tab_info_t *> tab_hash_;
335
337 QPushButton *player_button_;
338
340 QList<QCPGraph *>graphs_;
341
343 QString err_str_;
344
346 QMenu stream_ctx_menu_;
347
349 QMenu graph_ctx_menu_;
350
355 static void tapReset(void *tapinfo_ptr);
356
365 static tap_packet_status tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *rtpinfo_ptr, tap_flags_t flags);
366
371 static void tapDraw(void *tapinfo_ptr);
372
376 void resetStatistics();
377
384 void addPacket(tab_info_t *tab, packet_info *pinfo, const struct _rtp_info *rtpinfo);
385
389 void updateStatistics();
390
394 void updateGraph();
395
401 void saveCsvHeader(QFile *save_file, QTreeWidget *tree);
402
408 void saveCsvData(QFile *save_file, QTreeWidget *tree);
409
414 void saveCsv(StreamDirection direction);
415
421 bool eventFilter(QObject*, QEvent* event) override;
422
427 QVector<rtpstream_id_t *>getSelectedRtpIds();
428
434 int addTabUI(tab_info_t *new_tab);
435
445 void applyTabColors(const tab_info_t *tab, int tab_no);
446
451 tab_info_t *getTabInfoForCurrentTab();
452
457 void deleteTabInfo(tab_info_t *tab_info);
458
463 void clearLayout(QLayout *layout);
464
469 void addRtpStreamsPrivate(QVector<rtpstream_id_t *> stream_ids);
470};
471
472#endif // RTP_ANALYSIS_DIALOG_H
Manages a capture file and its associated state and operations.
Definition capture_file.h:27
The main packet list view for displaying captured packets.
Definition packet_list.h:51
~RtpAnalysisDialog()
Destroys the RtpAnalysisDialog.
Definition rtp_analysis_dialog.cpp:314
void rtpPlayerRemove()
Slot to handle removing streams from the RTP player.
Definition rtp_analysis_dialog.cpp:861
void rtpPlayerDialogRemoveRtpStreams(QVector< rtpstream_id_t * > stream_ids)
Signal emitted to remove RTP streams in the RTP player dialog.
static RtpAnalysisDialog * openRtpAnalysisDialog(QWidget &parent, CaptureFile &cf, PacketList *packet_list)
Returns singleton instance of the RTP analysis dialog.
Definition rtp_analysis_dialog.cpp:238
void rtpPlayerDialogAddRtpStreams(QVector< rtpstream_id_t * > stream_ids)
Signal emitted to add RTP streams in the RTP player dialog.
void rtpPlayerDialogReplaceRtpStreams(QVector< rtpstream_id_t * > stream_ids)
Signal emitted to replace RTP streams in the RTP player dialog.
void rtpPlayerAdd()
Slot to handle adding streams to the RTP player.
Definition rtp_analysis_dialog.cpp:854
void addRtpStreams(QVector< rtpstream_id_t * > stream_ids)
Add RTP streams to analyse. Requires array of rtpstream_id_t.
Definition rtp_analysis_dialog.cpp:1070
static QPushButton * addAnalyzeButton(QDialogButtonBox *button_box, RtpBaseDialog *dialog)
Common routine to add a "Analyze" button to a QDialogButtonBox.
Definition rtp_analysis_dialog.cpp:1161
RtpAnalysisDialog(RtpAnalysisDialog &other)=delete
Should not be cloneable.
void rtpPlayerReplace()
Slot to handle replacing streams in the RTP player.
Definition rtp_analysis_dialog.cpp:847
void goToPacket(int packet_num)
Signal emitted to go to a specific packet number.
void operator=(const RtpAnalysisDialog &)=delete
Should not be assignable.
void updateFilter(QString filter, bool force=false)
Signal emitted to update the display filter.
void replaceRtpStreams(QVector< rtpstream_id_t * > stream_ids)
Replace an RTP streams to analyse. Requires array of rtpstream_id_t.
Definition rtp_analysis_dialog.cpp:1054
virtual void updateWidgets() override
Updates the UI widgets.
Definition rtp_analysis_dialog.cpp:534
void removeRtpStreams(QVector< rtpstream_id_t * > stream_ids)
Remove RTP streams to analyse. Requires array of rtpstream_id_t.
Definition rtp_analysis_dialog.cpp:1126
Base class for RTP related dialogs providing common functionality.
Definition rtp_player_dialog.h:74
WiresharkDialog(QWidget &parent, CaptureFile &capture_file)
Constructs a new WiresharkDialog object.
Definition wireshark_dialog.cpp:30
struct epan_dissect epan_dissect_t
Opaque type representing a single packet dissection context.
Definition epan.h:62
struct _packet_info packet_info
Represents the metadata and indexing information for a single captured frame.
struct _rtpstream_info rtpstream_info_t
Holds all state and statistics accumulated for a single RTP stream.
Definition packet-rtp.h:29
Structure to hold information and UI elements for an RTP stream analysis tab.
Definition rtp_analysis_dialog.h:47
QCheckBox * diff_checkbox
Definition rtp_analysis_dialog.h:91
QTreeWidget * tree_widget
Definition rtp_analysis_dialog.h:64
int graph_color_idx
Definition rtp_analysis_dialog.h:98
QVector< double > * diff_vals
Definition rtp_analysis_dialog.h:58
QCPGraph * delta_graph
Definition rtp_analysis_dialog.h:79
QLabel * statistics_label
Definition rtp_analysis_dialog.h:67
QCheckBox * jitter_checkbox
Definition rtp_analysis_dialog.h:88
rtpstream_info_t stream
Definition rtp_analysis_dialog.h:49
QHBoxLayout * graphHorizontalLayout
Definition rtp_analysis_dialog.h:82
QCheckBox * delta_checkbox
Definition rtp_analysis_dialog.h:94
QCheckBox * stream_checkbox
Definition rtp_analysis_dialog.h:85
QCPGraph * diff_graph
Definition rtp_analysis_dialog.h:76
QVector< double > * delta_vals
Definition rtp_analysis_dialog.h:61
QString * tab_name
Definition rtp_analysis_dialog.h:70
QVector< double > * jitter_vals
Definition rtp_analysis_dialog.h:55
QCPGraph * jitter_graph
Definition rtp_analysis_dialog.h:73
QVector< double > * time_vals
Definition rtp_analysis_dialog.h:52
tap_packet_status
Definition tap.h:22