wireshark/ui/qt/voip_calls_dialog.h

145 lines
4.2 KiB
C
Raw Normal View History

/* voip_calls_dialog.h
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef VOIP_CALLS_DIALOG_H
#define VOIP_CALLS_DIALOG_H
#include <config.h>
#include <glib.h>
#include <mutex>
#include "cfile.h"
#include "ui/voip_calls.h"
#include "ui/rtp_stream.h"
#include "ui/rtp_stream_id.h"
#include <ui/qt/models/voip_calls_info_model.h>
#include <ui/qt/models/cache_proxy_model.h>
#include "ui/rtp_stream_id.h"
#include "wireshark_dialog.h"
#include <QMenu>
#include <QAbstractButton>
#include <QPushButton>
#include <QToolButton>
class SequenceInfo;
namespace Ui {
class VoipCallsDialog;
}
// Singleton by https://refactoring.guru/design-patterns/singleton/cpp/example#example-1
class VoipCallsDialog : public WiresharkDialog
{
Q_OBJECT
public:
/**
* Returns singleton
*/
static VoipCallsDialog *openVoipCallsDialogVoip(QWidget &parent, CaptureFile &cf, QObject *packet_list);
static VoipCallsDialog *openVoipCallsDialogSip(QWidget &parent, CaptureFile &cf, QObject *packet_list);
/**
* Should not be clonnable and assignable
*/
VoipCallsDialog(VoipCallsDialog &other) = delete;
void operator=(const VoipCallsDialog &) = delete;
signals:
void updateFilter(QString filter, bool force = false);
void captureFileChanged(capture_file *cf);
void goToPacket(int packet_num);
void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *> stream_ids);
void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *> stream_ids);
void rtpStreamsDialogSelectRtpStreams(QVector<rtpstream_id_t *> stream_ids);
void rtpStreamsDialogDeselectRtpStreams(QVector<rtpstream_id_t *> stream_ids);
public slots:
void displayFilterSuccess(bool success);
void rtpPlayerReplace();
void rtpPlayerAdd();
void rtpPlayerRemove();
protected:
explicit VoipCallsDialog(QWidget &parent, CaptureFile &cf, bool all_flows = false);
~VoipCallsDialog();
void contextMenuEvent(QContextMenuEvent *event);
virtual void removeTapListeners();
void captureFileClosing();
void captureFileClosed();
bool eventFilter(QObject *obj, QEvent *event);
protected slots:
void changeEvent(QEvent* event);
private:
// We have two singletones - one for all protocols, one for sip protocol
static VoipCallsDialog *pinstance_voip_;
static VoipCallsDialog *pinstance_sip_;
bool all_flows_;
static std::mutex mutex_;
Ui::VoipCallsDialog *ui;
VoipCallsInfoModel *call_infos_model_;
CacheProxyModel *cache_model_;
QSortFilterProxyModel *sorted_model_;
QWidget &parent_;
voip_calls_tapinfo_t tapinfo_;
SequenceInfo *sequence_info_;
QPushButton *prepare_button_;
QPushButton *sequence_button_;
QToolButton *player_button_;
QPushButton *copy_button_;
bool voip_calls_tap_listeners_removed_;
GQueue* shown_callsinfos_; /* queue with all shown calls (voip_calls_info_t) */
// Tap callbacks
static void tapReset(void *tapinfo_ptr);
static tap_packet_status tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *data);
static void tapDraw(void *tapinfo_ptr);
static gint compareCallNums(gconstpointer a, gconstpointer b);
void updateCalls();
void prepareFilter();
void showSequence();
Qt: Initial RTP playback. Note the "initial". This is woefully incomplete. See the "to do" lists below and in the code. This differs a bit from the GTK+ version in that you specify one or more streams to be decoded. Instead of showing waveforms in individual widgets, add them all to a single QCustomPlot. This conserves screen real estate and lets us more easily take advantage of the QCP API. It also looks better IMHO. Change a bunch of checks for QtMultimediaWidgets to QtMultimedia. We probably won't use the widgets until we make 5.0 our minimum Qt version and plain old QtMultimedia lets us support Qt 4 more easily (in theory at least). Add resampling code from libspeex. I initially used this to resample each packet to match the preferred rate of our output device, but this resulted in poorer audio quality than expected. Leave it in and use to create visual samples for QCP and to match rates any time the rate changes. The latter is currently untested. Add some debugging macros. Note that both the RTP player and RTP analysis dialogs decode audio data using different code. Note that voip_calls_packet and voip_calls_init_tap appear to be dead code. To do: - Add silence frames where needed. - Implement the jitter buffer. - Implement the playback timing controls. - Tapping / scanning streams might be too slow. Change-Id: I20dd3b66d3df53c9b1f3501262dc01458849f6b4 Bug: 9007 Reviewed-on: https://code.wireshark.org/review/10458 Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-13 00:51:40 +00:00
void showPlayer();
void removeAllCalls();
void invertSelection();
QList<QVariant> streamRowData(int row) const;
QVector<rtpstream_id_t *>getSelectedRtpIds();
private slots:
void selectAll();
void selectNone();
void copyAsCSV();
void copyAsYAML();
void switchTimeOfDay();
void on_callTreeView_activated(const QModelIndex &index);
void on_buttonBox_clicked(QAbstractButton *button);
void on_buttonBox_helpRequested();
void updateWidgets();
void captureEvent(CaptureEvent e);
void on_displayFilterCheckBox_toggled(bool checked);
void on_actionSelectAll_triggered();
void on_actionSelectInvert_triggered();
void on_actionSelectNone_triggered();
void on_actionSelectRtpStreams_triggered();
void on_actionDeselectRtpStreams_triggered();
};
#endif // VOIP_CALLS_DIALOG_H