3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
10 #ifndef RTP_STREAM_DIALOG_H
11 #define RTP_STREAM_DIALOG_H
13 #include "wireshark_dialog.h"
17 #include "ui/rtp_stream.h"
18 #include "rtp_player_dialog.h"
20 #include <QToolButton>
24 class RtpStreamDialog
;
27 // Singleton by https://refactoring.guru/design-patterns/singleton/cpp/example#example-1
28 class RtpStreamDialog
: public WiresharkDialog
36 static RtpStreamDialog
*openRtpStreamDialog(QWidget
&parent
, CaptureFile
&cf
, QObject
*packet_list
);
39 * Should not be clonnable and assignable
41 RtpStreamDialog(RtpStreamDialog
&other
) = delete;
42 void operator=(const RtpStreamDialog
&) = delete;
44 // Caller must provide ids which are immutable to recap
45 void selectRtpStream(QVector
<rtpstream_id_t
*> stream_ids
);
46 // Caller must provide ids which are immutable to recap
47 void deselectRtpStream(QVector
<rtpstream_id_t
*> stream_ids
);
50 // Tells the packet list to redraw. An alternative might be to add a
51 // cf_packet_marked callback to file.[ch] but that's synchronous and
52 // might incur too much overhead.
54 void updateFilter(QString filter
, bool force
= false);
55 void goToPacket(int packet_num
);
56 void rtpPlayerDialogReplaceRtpStreams(QVector
<rtpstream_id_t
*> stream_ids
);
57 void rtpPlayerDialogAddRtpStreams(QVector
<rtpstream_id_t
*> stream_ids
);
58 void rtpPlayerDialogRemoveRtpStreams(QVector
<rtpstream_id_t
*> stream_ids
);
59 void rtpAnalysisDialogReplaceRtpStreams(QVector
<rtpstream_id_t
*> stream_infos
);
60 void rtpAnalysisDialogAddRtpStreams(QVector
<rtpstream_id_t
*> stream_infos
);
61 void rtpAnalysisDialogRemoveRtpStreams(QVector
<rtpstream_id_t
*> stream_infos
);
64 void displayFilterSuccess(bool success
);
65 void rtpPlayerReplace();
67 void rtpPlayerRemove();
68 void rtpAnalysisReplace();
69 void rtpAnalysisAdd();
70 void rtpAnalysisRemove();
73 explicit RtpStreamDialog(QWidget
&parent
, CaptureFile
&cf
);
76 bool eventFilter(QObject
*obj
, QEvent
*event
);
77 void captureFileClosing();
78 void captureFileClosed();
81 static RtpStreamDialog
*pinstance_
;
82 static std::mutex mutex_
;
84 Ui::RtpStreamDialog
*ui
;
85 rtpstream_tapinfo_t tapinfo_
;
86 QToolButton
*find_reverse_button_
;
87 QPushButton
*prepare_button_
;
88 QPushButton
*export_button_
;
89 QPushButton
*copy_button_
;
90 QToolButton
*analyze_button_
;
91 QToolButton
*player_button_
;
94 QList
<rtpstream_id_t
> last_selected_
;
96 static void tapReset(rtpstream_tapinfo_t
*tapinfo
);
97 static void tapDraw(rtpstream_tapinfo_t
*tapinfo
);
98 static void tapMarkPacket(rtpstream_tapinfo_t
*tapinfo
, frame_data
*fd
);
100 void updateStreams();
101 void updateWidgets();
104 void setRtpStreamSelection(rtpstream_id_t
*id
, bool state
);
106 QList
<QVariant
> streamRowData(int row
) const;
107 void freeLastSelected();
108 void invertSelection();
109 QVector
<rtpstream_id_t
*>getSelectedRtpIds();
112 void showStreamMenu(QPoint pos
);
113 void on_actionCopyAsCsv_triggered();
114 void on_actionCopyAsYaml_triggered();
115 void on_actionFindReverseNormal_triggered();
116 void on_actionFindReversePair_triggered();
117 void on_actionFindReverseSingle_triggered();
118 void on_actionGoToSetup_triggered();
119 void on_actionMarkPackets_triggered();
120 void on_actionPrepareFilter_triggered();
121 void on_streamTreeWidget_itemSelectionChanged();
122 void on_buttonBox_helpRequested();
123 void on_actionExportAsRtpDump_triggered();
124 void captureEvent(CaptureEvent e
);
125 void displayFilterCheckBoxToggled(bool checked
);
126 void on_todCheckBox_toggled(bool checked
);
127 void on_actionSelectAll_triggered();
128 void on_actionSelectInvert_triggered();
129 void on_actionSelectNone_triggered();
130 void on_actionAnalyze_triggered();
133 #endif // RTP_STREAM_DIALOG_H