1 /* rtp_analysis_dialog.h
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0+*/
9 #ifndef RTP_ANALYSIS_DIALOG_H
10 #define RTP_ANALYSIS_DIALOG_H
16 #include "epan/address.h"
18 #include "ui/rtp_stream.h"
19 #include "ui/tap-rtp-analysis.h"
21 #include <QAbstractButton>
25 #include "wireshark_dialog.h"
28 class RtpAnalysisDialog;
37 TAP_RTP_PADDING_ERROR,
41 class RtpAnalysisDialog : public WiresharkDialog
46 explicit RtpAnalysisDialog(QWidget &parent, CaptureFile &cf, struct _rtp_stream_info *stream_fwd = 0, struct _rtp_stream_info *stream_rev = 0);
50 void goToPacket(int packet_num);
53 virtual void captureFileClosing();
56 virtual void updateWidgets();
59 void on_actionGoToPacket_triggered();
60 void on_actionNextProblem_triggered();
61 void on_fJitterCheckBox_toggled(bool checked);
62 void on_fDiffCheckBox_toggled(bool checked);
63 void on_fDeltaCheckBox_toggled(bool checked);
64 void on_rJitterCheckBox_toggled(bool checked);
65 void on_rDiffCheckBox_toggled(bool checked);
66 void on_rDeltaCheckBox_toggled(bool checked);
67 void on_actionSaveAudioUnsync_triggered();
68 void on_actionSaveForwardAudioUnsync_triggered();
69 void on_actionSaveReverseAudioUnsync_triggered();
70 void on_actionSaveAudioSyncStream_triggered();
71 void on_actionSaveForwardAudioSyncStream_triggered();
72 void on_actionSaveReverseAudioSyncStream_triggered();
73 void on_actionSaveAudioSyncFile_triggered();
74 void on_actionSaveForwardAudioSyncFile_triggered();
75 void on_actionSaveReverseAudioSyncFile_triggered();
76 void on_actionSaveCsv_triggered();
77 void on_actionSaveForwardCsv_triggered();
78 void on_actionSaveReverseCsv_triggered();
79 void on_actionSaveGraph_triggered();
80 void on_buttonBox_clicked(QAbstractButton *button);
81 void on_buttonBox_helpRequested();
82 void showStreamMenu(QPoint pos);
83 void graphClicked(QMouseEvent *event);
86 Ui::RtpAnalysisDialog *ui;
87 enum StreamDirection { dir_both_, dir_forward_, dir_reverse_ };
88 enum SyncType { sync_unsync_, sync_sync_stream_, sync_sync_file_ };
90 // XXX These are copied to and from rtp_stream_info_t structs. Should
91 // we just have a pair of those instead?
93 guint32 port_src_fwd_;
95 guint32 port_dst_fwd_;
97 guint32 packet_count_fwd_;
98 guint32 setup_frame_number_fwd_;
99 nstime_t start_rel_time_fwd_;
102 guint32 port_src_rev_;
104 guint32 port_dst_rev_;
106 guint32 packet_count_rev_;
107 guint32 setup_frame_number_rev_;
108 nstime_t start_rel_time_rev_;
112 tap_rtp_stat_t fwd_statinfo_;
113 tap_rtp_stat_t rev_statinfo_;
115 QPushButton *player_button_;
117 QTemporaryFile *fwd_tempfile_;
118 QTemporaryFile *rev_tempfile_;
120 // Graph data for QCustomPlot
121 QList<QCPGraph *>graphs_;
122 QVector<double> fwd_time_vals_;
123 QVector<double> fwd_jitter_vals_;
124 QVector<double> fwd_diff_vals_;
125 QVector<double> fwd_delta_vals_;
127 QVector<double> rev_time_vals_;
128 QVector<double> rev_jitter_vals_;
129 QVector<double> rev_diff_vals_;
130 QVector<double> rev_delta_vals_;
132 rtpstream_tapinfo_t tapinfo_;
134 rtp_error_type_t save_payload_error_;
136 QMenu stream_ctx_menu_;
137 QMenu graph_ctx_menu_;
142 static void tapReset(void *tapinfo_ptr);
143 static gboolean tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *rtpinfo_ptr);
144 static void tapDraw(void *tapinfo_ptr);
146 void resetStatistics();
147 void addPacket(bool forward, packet_info *pinfo, const struct _rtp_info *rtpinfo);
148 void savePayload(QTemporaryFile *tmpfile, tap_rtp_stat_t *statinfo, packet_info *pinfo, const struct _rtp_info *rtpinfo);
149 void updateStatistics();
154 size_t convert_payload_to_samples(unsigned int payload_type, QTemporaryFile *tempfile, gchar *pd_out, size_t expected_nchars);
155 gboolean saveAudioAUSilence(size_t total_len, QFile *save_file, gboolean *stop_flag);
156 gboolean saveAudioAUUnidir(tap_rtp_stat_t &statinfo, QTemporaryFile *tempfile, QFile *save_file, size_t header_end, gboolean *stop_flag, gboolean interleave, size_t prefix_silence);
157 gboolean saveAudioAUBidir(tap_rtp_stat_t &fwd_statinfo, tap_rtp_stat_t &rev_statinfo, QTemporaryFile *fwd_tempfile, QTemporaryFile *rev_tempfile, QFile *save_file, size_t header_end, gboolean *stop_flag, size_t prefix_silence_fwd, size_t prefix_silence_rev);
158 gboolean saveAudioAU(StreamDirection direction, QFile *save_file, gboolean *stop_flag, RtpAnalysisDialog::SyncType sync);
159 gboolean saveAudioRAW(StreamDirection direction, QFile *save_file, gboolean *stop_flag);
160 void saveAudio(StreamDirection direction, RtpAnalysisDialog::SyncType sync);
161 void saveCsv(StreamDirection direction);
163 guint32 processNode(proto_node *ptree_node, header_field_info *hfinformation, const gchar* proto_field, bool *ok);
164 guint32 getIntFromProtoTree(proto_tree *protocol_tree, const gchar *proto_name, const gchar *proto_field, bool *ok);
166 bool eventFilter(QObject*, QEvent* event);
169 #endif // RTP_ANALYSIS_DIALOG_H
177 * indent-tabs-mode: nil
180 * ex: set shiftwidth=4 tabstop=8 expandtab:
181 * :indentSize=4:tabSize=8:noTabs=true: