22b6527e4cda7e631717718cd5297601fc0ee0e9
[gd/wireshark/.git] / ui / qt / sctp_graph_dialog.h
1 /* sctp_graph_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 #ifndef SCTP_GRAPH_DIALOG_H
10 #define SCTP_GRAPH_DIALOG_H
11
12 #include <config.h>
13 #include <glib.h>
14
15 #include "cfile.h"
16
17 #include <QDialog>
18
19 namespace Ui {
20 class SCTPGraphDialog;
21 }
22
23 class QCPAbstractPlottable;
24 class QCustomPlot;
25
26 struct _sctp_assoc_info;
27
28 struct chunk_header {
29     guint8  type;
30     guint8  flags;
31     guint16 length;
32 };
33
34 struct data_chunk_header {
35     guint8  type;
36     guint8  flags;
37     guint16 length;
38     guint32 tsn;
39     guint16 sid;
40     guint16 ssn;
41     guint32 ppi;
42 };
43
44 struct gaps {
45     guint16 start;
46     guint16 end;
47 };
48
49 struct sack_chunk_header {
50     guint8  type;
51     guint8  flags;
52     guint16 length;
53     guint32 cum_tsn_ack;
54     guint32 a_rwnd;
55     guint16 nr_of_gaps;
56     guint16 nr_of_dups;
57     struct gaps gaps[1];
58 };
59
60 struct nr_sack_chunk_header {
61     guint8  type;
62     guint8  flags;
63     guint16 length;
64     guint32 cum_tsn_ack;
65     guint32 a_rwnd;
66     guint16 nr_of_gaps;
67     guint16 nr_of_nr_gaps;
68     guint16 nr_of_dups;
69     guint16 reserved;
70     struct gaps gaps[1];
71 };
72
73
74 class SCTPGraphDialog : public QDialog
75 {
76     Q_OBJECT
77
78 public:
79     explicit SCTPGraphDialog(QWidget *parent = 0, struct _sctp_assoc_info *assoc = NULL, capture_file *cf = NULL, int dir = 0);
80     ~SCTPGraphDialog();
81     static void save_graph(QDialog *dlg, QCustomPlot *plot);
82
83 public slots:
84     void setCaptureFile(capture_file *cf) { cap_file_ = cf; }
85
86 private slots:
87     void on_pushButton_clicked();
88
89     void on_pushButton_2_clicked();
90
91     void on_pushButton_3_clicked();
92
93     void on_pushButton_4_clicked();
94
95     void graphClicked(QCPAbstractPlottable* plottable, QMouseEvent* event);
96
97     void on_saveButton_clicked();
98
99 private:
100     Ui::SCTPGraphDialog *ui;
101     struct _sctp_assoc_info *selected_assoc;
102     capture_file *cap_file_;
103     int frame_num;
104     int direction;
105     QVector<double> xt, yt, xs, ys, xg, yg, xd, yd, xn, yn;
106     QVector<guint32> ft, fs, fg, fd, fn;
107     QVector<QString> typeStrings;
108     bool gIsSackChunkPresent;
109     bool gIsNRSackChunkPresent;
110
111     void drawGraph(int which);
112     void drawTSNGraph();
113     void drawSACKGraph();
114     void drawNRSACKGraph();
115 };
116
117 #endif // SCTP_GRAPH_DIALOG_H
118
119 /*
120  * Editor modelines
121  *
122  * Local Variables:
123  * c-basic-offset: 4
124  * tab-width: 8
125  * indent-tabs-mode: nil
126  * End:
127  *
128  * ex: set shiftwidth=4 tabstop=8 expandtab:
129  * :indentSize=4:tabSize=8:noTabs=true:
130  */