diff options
Diffstat (limited to 'ui/qt/rtp_analysis_dialog.h')
-rw-r--r-- | ui/qt/rtp_analysis_dialog.h | 119 |
1 files changed, 56 insertions, 63 deletions
diff --git a/ui/qt/rtp_analysis_dialog.h b/ui/qt/rtp_analysis_dialog.h index 8c0df74bdf..09d08cc08a 100644 --- a/ui/qt/rtp_analysis_dialog.h +++ b/ui/qt/rtp_analysis_dialog.h @@ -20,9 +20,12 @@ #include "ui/tap-rtp-common.h" #include "ui/tap-rtp-analysis.h" -#include <QAbstractButton> #include <QMenu> +#include <QTreeWidget> +#include <QLabel> #include <QFile> +#include <QCheckBox> +#include <QHBoxLayout> #include "wireshark_dialog.h" @@ -32,6 +35,26 @@ class RtpAnalysisDialog; class QCPGraph; class QTemporaryFile; +class QDialogButtonBox; + +typedef struct { + rtpstream_info_t stream; + QVector<double> *time_vals; + QVector<double> *jitter_vals; + QVector<double> *diff_vals; + QVector<double> *delta_vals; + QTreeWidget *tree_widget; + QLabel *statistics_label; + QString *tab_name; + QCPGraph *jitter_graph; + QCPGraph *diff_graph; + QCPGraph *delta_graph; + QHBoxLayout *graphHorizontalLayout; + QCheckBox *stream_checkbox; + QCheckBox *jitter_checkbox; + QCheckBox *diff_checkbox; + QCheckBox *delta_checkbox; +} tab_info_t; class RtpAnalysisDialog : public WiresharkDialog { @@ -40,6 +63,24 @@ class RtpAnalysisDialog : public WiresharkDialog public: explicit RtpAnalysisDialog(QWidget &parent, CaptureFile &cf, rtpstream_info_t *stream_fwd = 0, rtpstream_info_t *stream_rev = 0); ~RtpAnalysisDialog(); + /** + * @brief Common routine to add a "Analyze" button to a QDialogButtonBox. + * @param button_box Caller's QDialogButtonBox. + * @return The new "Analyze" button. + */ + static QPushButton *addAnalyzeButton(QDialogButtonBox *button_box, QDialog *dialog); + + /** Replace/Add/Remove an RTP streams to analyse. + * Requires array of rtpstream_info_t. + * Each item must have filled items: src_addr, src_port, dest_addr, + * dest_port, ssrc, packet_count, setup_frame_number, and start_rel_time. + * + * @param rtpstream struct with rtpstream info + */ + void replaceRtpStreams(QVector<rtpstream_info_t *> stream_infos); + void addRtpStreams(QVector<rtpstream_info_t *> stream_infos); + void removeRtpStreams(QVector<rtpstream_info_t *> stream_infos); + void findRtpStreams(); signals: void goToPacket(int packet_num); @@ -58,102 +99,54 @@ protected slots: private slots: void on_actionGoToPacket_triggered(); void on_actionNextProblem_triggered(); - void on_fJitterCheckBox_toggled(bool checked); - void on_fDiffCheckBox_toggled(bool checked); - void on_fDeltaCheckBox_toggled(bool checked); - void on_rJitterCheckBox_toggled(bool checked); - void on_rDiffCheckBox_toggled(bool checked); - void on_rDeltaCheckBox_toggled(bool checked); - void on_actionSaveAudioUnsync_triggered(); - void on_actionSaveForwardAudioUnsync_triggered(); - void on_actionSaveReverseAudioUnsync_triggered(); - void on_actionSaveAudioSyncStream_triggered(); - void on_actionSaveForwardAudioSyncStream_triggered(); - void on_actionSaveReverseAudioSyncStream_triggered(); - void on_actionSaveAudioSyncFile_triggered(); - void on_actionSaveForwardAudioSyncFile_triggered(); - void on_actionSaveReverseAudioSyncFile_triggered(); - void on_actionSaveCsv_triggered(); - void on_actionSaveForwardCsv_triggered(); - void on_actionSaveReverseCsv_triggered(); + void on_actionSaveOneCsv_triggered(); + void on_actionSaveAllCsv_triggered(); void on_actionSaveGraph_triggered(); void on_buttonBox_helpRequested(); void showStreamMenu(QPoint pos); void graphClicked(QMouseEvent *event); + void closeTab(int index); + void rowCheckboxChanged(int checked); + void singleCheckboxChanged(int checked); private: Ui::RtpAnalysisDialog *ui; - enum StreamDirection { dir_both_, dir_forward_, dir_reverse_ }; - enum SyncType { sync_unsync_, sync_sync_stream_, sync_sync_file_ }; + enum StreamDirection { dir_all_, dir_one_ }; + int tab_seq; - /* Save Audio Errors */ - bool sae_stopped_; - bool sae_file_error_; - bool sae_unsupported_codec_; - bool sae_unsupported_rate_; - bool sae_other_error_; - - int num_streams_; - - rtpstream_info_t fwd_statinfo_; - rtpstream_info_t rev_statinfo_; + QVector<tab_info_t *> tabs_; QPushButton *player_button_; - QTemporaryFile *fwd_tempfile_; - QTemporaryFile *rev_tempfile_; - // Graph data for QCustomPlot QList<QCPGraph *>graphs_; - QVector<double> fwd_time_vals_; - QVector<double> fwd_jitter_vals_; - QVector<double> fwd_diff_vals_; - QVector<double> fwd_delta_vals_; - - QVector<double> rev_time_vals_; - QVector<double> rev_jitter_vals_; - QVector<double> rev_diff_vals_; - QVector<double> rev_delta_vals_; rtpstream_tapinfo_t tapinfo_; QString err_str_; - tap_rtp_error_type_t save_payload_error_; QMenu stream_ctx_menu_; QMenu graph_ctx_menu_; - void findStreams(); - // Tap callbacks static void tapReset(void *tapinfo_ptr); static tap_packet_status tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *rtpinfo_ptr); static void tapDraw(void *tapinfo_ptr); void resetStatistics(); - void addPacket(bool forward, packet_info *pinfo, const struct _rtp_info *rtpinfo); - void savePayload(QTemporaryFile *tmpfile, tap_rtp_stat_t *statinfo, packet_info *pinfo, const struct _rtp_info *rtpinfo); + void addPacket(tab_info_t *tab, packet_info *pinfo, const struct _rtp_info *rtpinfo); void updateStatistics(); void updateGraph(); - void showPlayer(); - - size_t convert_payload_to_samples(unsigned int payload_type, const gchar *payload_type_names[256], QTemporaryFile *tempfile, uint8_t *pd_out, size_t expected_nchars, struct _GHashTable *decoders_hash); - bool saveAudioAUSilence(size_t total_len, QFile *save_file, gboolean *stop_flag); - bool saveAudioAUUnidir(tap_rtp_stat_t &statinfo, const gchar *payload_type_names[256], QTemporaryFile *tempfile, QFile *save_file, int64_t header_end, gboolean *stop_flag, gboolean interleave, size_t prefix_silence); - bool saveAudioAUBidir(tap_rtp_stat_t &fwd_statinfo, tap_rtp_stat_t &rev_statinfo, const gchar *fwd_payload_type_names[256], const gchar *rev_payload_type_names[256], QTemporaryFile *fwd_tempfile, QTemporaryFile *rev_tempfile, QFile *save_file, int64_t header_end, gboolean *stop_flag, size_t prefix_silence_fwd, size_t prefix_silence_rev); - bool saveAudioAU(StreamDirection direction, QFile *save_file, gboolean *stop_flag, RtpAnalysisDialog::SyncType sync); - bool saveAudioRAW(StreamDirection direction, QFile *save_file, gboolean *stop_flag); - void saveAudio(StreamDirection direction, RtpAnalysisDialog::SyncType sync); + void saveCsvData(QFile *save_file, QTreeWidget *tree); void saveCsv(StreamDirection direction); - uint32_t processNode(proto_node *ptree_node, header_field_info *hfinformation, const gchar* proto_field, bool *ok); - uint32_t getIntFromProtoTree(proto_tree *protocol_tree, const gchar *proto_name, const gchar *proto_field, bool *ok); - bool eventFilter(QObject*, QEvent* event); - void clearSAEErrors(); - bool isSAEOK(); QVector<rtpstream_info_t *>getSelectedRtpStreams(); + int addTabUI(tab_info_t *new_tab); + tab_info_t *getTabInfoForCurrentTab(); + void deleteTabInfo(tab_info_t *tab_info); + void clearLayout(QLayout *layout); }; #endif // RTP_ANALYSIS_DIALOG_H |