Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
iax2_analysis_dialog.h
1 /* iax2_analysis_dialog.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9 
10 #ifndef IAX2_ANALYSIS_DIALOG_H
11 #define IAX2_ANALYSIS_DIALOG_H
12 
13 // The GTK+ UI checks for multiple RTP streams, and if found opens the RTP
14 // stream dialog. That seems to violate the principle of least surprise.
15 // Migrate the code but disable it.
16 // #define IAX2_RTP_STREAM_CHECK
17 
18 #include <config.h>
19 
20 #include <glib.h>
21 
22 #include <epan/address.h>
23 
24 #include "ui/tap-iax2-analysis.h"
25 
26 #include <QAbstractButton>
27 #include <QMenu>
28 
29 #include "wireshark_dialog.h"
30 
31 namespace Ui {
32 class Iax2AnalysisDialog;
33 }
34 
35 class QCPGraph;
36 class QTemporaryFile;
37 
38 typedef enum {
39  TAP_IAX2_NO_ERROR,
40  TAP_IAX2_NO_PACKET_SELECTED,
41  TAP_IAX2_WRONG_LENGTH,
42  TAP_IAX2_FILE_IO_ERROR
43 } iax2_error_type_t;
44 
45 
47 {
48  Q_OBJECT
49 
50 public:
51  explicit Iax2AnalysisDialog(QWidget &parent, CaptureFile &cf);
53 
54 signals:
55  void goToPacket(int packet_num);
56 
57 protected slots:
58  void captureEvent(CaptureEvent e);
59  virtual void updateWidgets();
60 
61 private slots:
62  void on_actionGoToPacket_triggered();
63  void on_actionNextProblem_triggered();
64  void on_fJitterCheckBox_toggled(bool checked);
65  void on_fDiffCheckBox_toggled(bool checked);
66  void on_rJitterCheckBox_toggled(bool checked);
67  void on_rDiffCheckBox_toggled(bool checked);
68  void on_actionSaveAudio_triggered();
69  void on_actionSaveForwardAudio_triggered();
70  void on_actionSaveReverseAudio_triggered();
71  void on_actionSaveCsv_triggered();
72  void on_actionSaveForwardCsv_triggered();
73  void on_actionSaveReverseCsv_triggered();
74  void on_actionSaveGraph_triggered();
75  void on_buttonBox_helpRequested();
76  void showStreamMenu(QPoint pos);
77  void graphClicked(QMouseEvent *event);
78 
79 private:
81  enum StreamDirection { dir_both_, dir_forward_, dir_reverse_ };
82 
83  address src_fwd_;
84  guint32 port_src_fwd_;
85  address dst_fwd_;
86  guint32 port_dst_fwd_;
87  address src_rev_;
88  guint32 port_src_rev_;
89  address dst_rev_;
90  guint32 port_dst_rev_;
91 
92  tap_iax2_stat_t fwd_statinfo_;
93  tap_iax2_stat_t rev_statinfo_;
94 
95  QTemporaryFile *fwd_tempfile_;
96  QTemporaryFile *rev_tempfile_;
97 
98  // Graph data for QCustomPlot
99  QList<QCPGraph *>graphs_;
100  QVector<double> fwd_time_vals_;
101  QVector<double> fwd_jitter_vals_;
102  QVector<double> fwd_diff_vals_;
103 
104  QVector<double> rev_time_vals_;
105  QVector<double> rev_jitter_vals_;
106  QVector<double> rev_diff_vals_;
107 
108  QString err_str_;
109  iax2_error_type_t save_payload_error_;
110 
111  QMenu stream_ctx_menu_;
112  QMenu graph_ctx_menu_;
113 
114  // Tap callbacks
115  static void tapReset(void *tapinfo_ptr);
116  static gboolean tapPacket(void *tapinfo_ptr, packet_info *pinfo, struct epan_dissect *, const void *iax2info_ptr);
117  static void tapDraw(void *tapinfo_ptr);
118 
119  void resetStatistics();
120  void addPacket(bool forward, packet_info *pinfo, const struct _iax2_info_t *iax2info);
121  void savePayload(QTemporaryFile *tmpfile, packet_info *pinfo, const struct _iax2_info_t *iax2info);
122  void updateStatistics();
123  void updateGraph();
124 
125  void saveAudio(StreamDirection direction);
126  void saveCsv(StreamDirection direction);
127 
128 #if 0
129  guint32 processNode(proto_node *ptree_node, header_field_info *hfinformation, const gchar* proto_field, bool *ok);
130  guint32 getIntFromProtoTree(proto_tree *protocol_tree, const gchar *proto_name, const gchar *proto_field, bool *ok);
131 #endif
132 
133  bool eventFilter(QObject*, QEvent* event);
134 };
135 
136 #endif // IAX2_ANALYSIS_DIALOG_H
137 
138 /*
139  * Editor modelines
140  *
141  * Local Variables:
142  * c-basic-offset: 4
143  * tab-width: 8
144  * indent-tabs-mode: nil
145  * End:
146  *
147  * ex: set shiftwidth=4 tabstop=8 expandtab:
148  * :indentSize=4:tabSize=8:noTabs=true:
149  */
Definition: proto.h:622
Definition: packet_info.h:44
Definition: iax2_analysis_dialog.h:46
Definition: ui_about_dialog.h:291
A plottable representing a graph in a plot.
Definition: qcustomplot.h:2492
Definition: capture_event.h:19
Definition: ui_iax2_analysis_dialog.h:305
Definition: tap-iax2-analysis.h:43
Definition: epan_dissect.h:28
Definition: wireshark_dialog.h:32
Definition: proto.h:759
Definition: packet-iax2.h:228
Definition: capture_file.h:22
Definition: address.h:47