2014-11-19 00:21:42 +00:00
|
|
|
/* voip_calls_dialog.h
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-04-30 07:47:58 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2014-11-19 00:21:42 +00:00
|
|
|
|
|
|
|
#ifndef VOIP_CALLS_DIALOG_H
|
|
|
|
#define VOIP_CALLS_DIALOG_H
|
|
|
|
|
2015-04-26 17:21:09 +00:00
|
|
|
#include <config.h>
|
2014-11-19 00:21:42 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
2021-05-09 14:29:11 +00:00
|
|
|
#include <mutex>
|
2014-11-19 00:21:42 +00:00
|
|
|
|
2017-12-03 18:53:58 +00:00
|
|
|
#include "cfile.h"
|
|
|
|
|
2014-11-19 00:21:42 +00:00
|
|
|
#include "ui/voip_calls.h"
|
2021-03-27 20:01:43 +00:00
|
|
|
#include "ui/rtp_stream.h"
|
|
|
|
#include "ui/rtp_stream_id.h"
|
2014-11-19 00:21:42 +00:00
|
|
|
|
2017-07-25 14:47:16 +00:00
|
|
|
#include <ui/qt/models/voip_calls_info_model.h>
|
|
|
|
#include <ui/qt/models/cache_proxy_model.h>
|
2020-12-30 08:51:00 +00:00
|
|
|
#include "ui/rtp_stream_id.h"
|
2014-12-29 19:42:01 +00:00
|
|
|
#include "wireshark_dialog.h"
|
|
|
|
|
2014-11-19 00:21:42 +00:00
|
|
|
#include <QMenu>
|
2021-05-01 22:33:54 +00:00
|
|
|
#include <QAbstractButton>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QToolButton>
|
2014-11-19 00:21:42 +00:00
|
|
|
|
2015-11-15 21:57:43 +00:00
|
|
|
class SequenceInfo;
|
|
|
|
|
2014-11-19 00:21:42 +00:00
|
|
|
namespace Ui {
|
|
|
|
class VoipCallsDialog;
|
|
|
|
}
|
|
|
|
|
2021-05-09 14:29:11 +00:00
|
|
|
// Singleton by https://refactoring.guru/design-patterns/singleton/cpp/example#example-1
|
2014-12-29 19:42:01 +00:00
|
|
|
class VoipCallsDialog : public WiresharkDialog
|
2014-11-19 00:21:42 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2021-05-09 14:29:11 +00:00
|
|
|
/**
|
|
|
|
* 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;
|
2014-11-19 00:21:42 +00:00
|
|
|
|
|
|
|
signals:
|
2015-09-18 21:33:41 +00:00
|
|
|
void updateFilter(QString filter, bool force = false);
|
2017-12-03 18:53:58 +00:00
|
|
|
void captureFileChanged(capture_file *cf);
|
2014-11-19 00:21:42 +00:00
|
|
|
void goToPacket(int packet_num);
|
2021-04-22 19:33:11 +00:00
|
|
|
void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
|
|
|
|
void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *> stream_ids);
|
|
|
|
void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *> stream_ids);
|
2021-04-19 13:54:58 +00:00
|
|
|
void rtpStreamsDialogSelectRtpStreams(QVector<rtpstream_id_t *> stream_ids);
|
|
|
|
void rtpStreamsDialogDeselectRtpStreams(QVector<rtpstream_id_t *> stream_ids);
|
2014-11-19 00:21:42 +00:00
|
|
|
|
2021-01-01 15:51:47 +00:00
|
|
|
public slots:
|
|
|
|
void displayFilterSuccess(bool success);
|
2021-03-27 20:01:43 +00:00
|
|
|
void rtpPlayerReplace();
|
|
|
|
void rtpPlayerAdd();
|
|
|
|
void rtpPlayerRemove();
|
2021-01-01 15:51:47 +00:00
|
|
|
|
2014-11-19 00:21:42 +00:00
|
|
|
protected:
|
2021-05-09 14:29:11 +00:00
|
|
|
explicit VoipCallsDialog(QWidget &parent, CaptureFile &cf, bool all_flows = false);
|
|
|
|
~VoipCallsDialog();
|
|
|
|
|
2014-11-19 00:21:42 +00:00
|
|
|
void contextMenuEvent(QContextMenuEvent *event);
|
2018-01-14 20:37:16 +00:00
|
|
|
virtual void removeTapListeners();
|
2021-01-10 20:57:47 +00:00
|
|
|
void captureFileClosing();
|
|
|
|
void captureFileClosed();
|
2021-03-13 20:28:06 +00:00
|
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
2014-11-19 00:21:42 +00:00
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void changeEvent(QEvent* event);
|
|
|
|
|
|
|
|
private:
|
2021-05-09 14:29:11 +00:00
|
|
|
// 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_;
|
|
|
|
|
2014-11-19 00:21:42 +00:00
|
|
|
Ui::VoipCallsDialog *ui;
|
2017-02-13 00:36:58 +00:00
|
|
|
VoipCallsInfoModel *call_infos_model_;
|
2017-03-16 23:51:08 +00:00
|
|
|
CacheProxyModel *cache_model_;
|
2017-02-13 00:36:58 +00:00
|
|
|
QSortFilterProxyModel *sorted_model_;
|
2014-11-19 00:21:42 +00:00
|
|
|
|
2015-02-14 00:18:57 +00:00
|
|
|
QWidget &parent_;
|
2014-11-19 00:21:42 +00:00
|
|
|
voip_calls_tapinfo_t tapinfo_;
|
2015-11-15 21:57:43 +00:00
|
|
|
SequenceInfo *sequence_info_;
|
2014-11-19 00:21:42 +00:00
|
|
|
QPushButton *prepare_button_;
|
|
|
|
QPushButton *sequence_button_;
|
2021-05-01 22:33:54 +00:00
|
|
|
QToolButton *player_button_;
|
2016-06-16 21:09:28 +00:00
|
|
|
QPushButton *copy_button_;
|
2020-01-05 22:33:04 +00:00
|
|
|
bool voip_calls_tap_listeners_removed_;
|
2020-12-31 00:00:57 +00:00
|
|
|
GQueue* shown_callsinfos_; /* queue with all shown calls (voip_calls_info_t) */
|
2014-11-19 00:21:42 +00:00
|
|
|
|
|
|
|
// Tap callbacks
|
2020-12-13 13:04:11 +00:00
|
|
|
static void tapReset(void *tapinfo_ptr);
|
2019-01-01 03:36:12 +00:00
|
|
|
static tap_packet_status tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *data);
|
2014-11-19 00:21:42 +00:00
|
|
|
static void tapDraw(void *tapinfo_ptr);
|
2020-12-31 13:14:14 +00:00
|
|
|
static gint compareCallNums(gconstpointer a, gconstpointer b);
|
2014-11-19 00:21:42 +00:00
|
|
|
|
|
|
|
void updateCalls();
|
|
|
|
void prepareFilter();
|
|
|
|
void showSequence();
|
2014-12-13 00:51:40 +00:00
|
|
|
void showPlayer();
|
2021-01-01 15:51:47 +00:00
|
|
|
void removeAllCalls();
|
2021-03-13 20:28:06 +00:00
|
|
|
void invertSelection();
|
2014-11-19 00:21:42 +00:00
|
|
|
|
2016-06-16 21:09:28 +00:00
|
|
|
QList<QVariant> streamRowData(int row) const;
|
2021-04-22 19:33:11 +00:00
|
|
|
QVector<rtpstream_id_t *>getSelectedRtpIds();
|
2016-06-16 21:09:28 +00:00
|
|
|
|
2014-11-19 00:21:42 +00:00
|
|
|
private slots:
|
2019-08-02 18:39:13 +00:00
|
|
|
void selectAll();
|
2021-01-06 22:49:36 +00:00
|
|
|
void selectNone();
|
2019-08-02 18:39:13 +00:00
|
|
|
void copyAsCSV();
|
|
|
|
void copyAsYAML();
|
|
|
|
void switchTimeOfDay();
|
2017-02-13 00:36:58 +00:00
|
|
|
void on_callTreeView_activated(const QModelIndex &index);
|
2014-11-19 00:21:42 +00:00
|
|
|
void on_buttonBox_clicked(QAbstractButton *button);
|
|
|
|
void on_buttonBox_helpRequested();
|
2017-02-13 00:36:58 +00:00
|
|
|
void updateWidgets();
|
2021-01-01 15:51:47 +00:00
|
|
|
void captureEvent(CaptureEvent e);
|
|
|
|
void on_displayFilterCheckBox_toggled(bool checked);
|
2021-03-13 20:28:06 +00:00
|
|
|
void on_actionSelectAll_triggered();
|
|
|
|
void on_actionSelectInvert_triggered();
|
|
|
|
void on_actionSelectNone_triggered();
|
2021-04-19 13:54:58 +00:00
|
|
|
void on_actionSelectRtpStreams_triggered();
|
|
|
|
void on_actionDeselectRtpStreams_triggered();
|
2014-11-19 00:21:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VOIP_CALLS_DIALOG_H
|