Wireshark  4.3.0
The Wireshark network protocol analyzer
voip_calls_dialog.h
Go to the documentation of this file.
1 
10 #ifndef VOIP_CALLS_DIALOG_H
11 #define VOIP_CALLS_DIALOG_H
12 
13 #include <config.h>
14 
15 #include <mutex>
16 
17 #include "cfile.h"
18 
19 #include "ui/voip_calls.h"
20 #include "ui/rtp_stream.h"
21 #include "ui/rtp_stream_id.h"
22 
25 #include "ui/rtp_stream_id.h"
26 #include "wireshark_dialog.h"
27 
28 #include <QMenu>
29 #include <QAbstractButton>
30 #include <QPushButton>
31 #include <QToolButton>
32 
33 class SequenceInfo;
34 
35 namespace Ui {
36 class VoipCallsDialog;
37 }
38 
39 // Singleton by https://refactoring.guru/design-patterns/singleton/cpp/example#example-1
41 {
42  Q_OBJECT
43 
44 public:
48  static VoipCallsDialog *openVoipCallsDialogVoip(QWidget &parent, CaptureFile &cf, QObject *packet_list);
49  static VoipCallsDialog *openVoipCallsDialogSip(QWidget &parent, CaptureFile &cf, QObject *packet_list);
50 
54  VoipCallsDialog(VoipCallsDialog &other) = delete;
55  void operator=(const VoipCallsDialog &) = delete;
56 
57 signals:
58  void updateFilter(QString filter, bool force = false);
59  void captureFileChanged(capture_file *cf);
60  void goToPacket(int packet_num);
61  void rtpPlayerDialogReplaceRtpStreams(QVector<rtpstream_id_t *> stream_ids);
62  void rtpPlayerDialogAddRtpStreams(QVector<rtpstream_id_t *> stream_ids);
63  void rtpPlayerDialogRemoveRtpStreams(QVector<rtpstream_id_t *> stream_ids);
64  void rtpStreamsDialogSelectRtpStreams(QVector<rtpstream_id_t *> stream_ids);
65  void rtpStreamsDialogDeselectRtpStreams(QVector<rtpstream_id_t *> stream_ids);
66 
67 public slots:
68  void displayFilterSuccess(bool success);
69  void rtpPlayerReplace();
70  void rtpPlayerAdd();
71  void rtpPlayerRemove();
72 
73 protected:
74  explicit VoipCallsDialog(QWidget &parent, CaptureFile &cf, bool all_flows = false);
75  ~VoipCallsDialog();
76 
77  void contextMenuEvent(QContextMenuEvent *event);
78  virtual void removeTapListeners();
79  void captureFileClosing();
80  void captureFileClosed();
81  bool eventFilter(QObject *obj, QEvent *event);
82 
83 protected slots:
84  void changeEvent(QEvent* event);
85 
86 private:
87  // We have two singletones - one for all protocols, one for sip protocol
88  static VoipCallsDialog *pinstance_voip_;
89  static VoipCallsDialog *pinstance_sip_;
90  bool all_flows_;
91  static std::mutex init_mutex_;
92 
93  Ui::VoipCallsDialog *ui;
94  VoipCallsInfoModel *call_infos_model_;
95  CacheProxyModel *cache_model_;
96  QSortFilterProxyModel *sorted_model_;
97 
98  QWidget &parent_;
99  voip_calls_tapinfo_t tapinfo_;
100  SequenceInfo *sequence_info_;
101  QPushButton *prepare_button_;
102  QPushButton *sequence_button_;
103  QToolButton *player_button_;
104  QPushButton *copy_button_;
105  bool voip_calls_tap_listeners_removed_;
106  GQueue* shown_callsinfos_; /* queue with all shown calls (voip_calls_info_t) */
107 
108  // Tap callbacks
109  static void tapReset(void *tapinfo_ptr);
110  static tap_packet_status tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *data, tap_flags_t flags);
111  static void tapDraw(void *tapinfo_ptr);
112  static int compareCallNums(gconstpointer a, gconstpointer b);
113 
114  void updateCalls();
115  void prepareFilter();
116  void showSequence();
117  void showPlayer();
118  void removeAllCalls();
119  void invertSelection();
120 
121  QList<QVariant> streamRowData(int row) const;
122  QVector<rtpstream_id_t *>getSelectedRtpIds();
123 
124 private slots:
125  void selectAll();
126  void selectNone();
127  void copyAsCSV();
128  void copyAsYAML();
129  void switchTimeOfDay();
130  void on_callTreeView_activated(const QModelIndex &index);
131  void on_buttonBox_clicked(QAbstractButton *button);
132  void on_buttonBox_helpRequested();
133  void updateWidgets();
134  void captureEvent(CaptureEvent e);
135  void displayFilterCheckBoxToggled(bool checked);
136  void on_actionSelectAll_triggered();
137  void on_actionSelectInvert_triggered();
138  void on_actionSelectNone_triggered();
139  void on_actionSelectRtpStreams_triggered();
140  void on_actionDeselectRtpStreams_triggered();
141 };
142 
143 #endif // VOIP_CALLS_DIALOG_H
Definition: cache_proxy_model.h:26
Definition: capture_event.h:21
Definition: capture_file.h:21
Definition: sequence_dialog.h:33
Definition: voip_calls_dialog.h:41
static VoipCallsDialog * openVoipCallsDialogVoip(QWidget &parent, CaptureFile &cf, QObject *packet_list)
Definition: voip_calls_dialog.cpp:50
void captureFileClosing()
Called when the capture file is about to close. This can be used to disconnect taps and similar actio...
Definition: voip_calls_dialog.cpp:237
VoipCallsDialog(VoipCallsDialog &other)=delete
void captureFileClosed()
Called when the capture file was closed. This can be used to enable or disable widgets according to t...
Definition: voip_calls_dialog.cpp:251
virtual void removeTapListeners()
Remove all tap listeners registered via registerTapListener.
Definition: voip_calls_dialog.cpp:228
Definition: voip_calls_info_model.h:22
Definition: wireshark_dialog.h:35
Definition: cfile.h:67
Definition: packet_info.h:44
Definition: voip_calls.h:173
Definition: epan_dissect.h:28
tap_packet_status
Definition: tap.h:25