Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
packet_list_model.h
Go to the documentation of this file.
1
10#ifndef PACKET_LIST_MODEL_H
11#define PACKET_LIST_MODEL_H
12
13#include <config.h>
14
15#include <stdio.h>
16
17#include <epan/packet.h>
18
19#include <QAbstractItemModel>
20#include <QFont>
21#include <QVector>
22
24
25#include "packet_list_record.h"
26
27#include <epan/cfile.h>
28
29class QElapsedTimer;
30
31class PacketListModel : public QAbstractItemModel
32{
33 Q_OBJECT
34public:
35
36 enum {
37 HEADER_CAN_DISPLAY_STRINGS = Qt::UserRole,
38 HEADER_CAN_DISPLAY_DETAILS,
39 };
40
41 explicit PacketListModel(QObject *parent = 0, capture_file *cf = NULL);
43 void setCaptureFile(capture_file *cf);
44 QModelIndex index(int row, int column,
45 const QModelIndex & = QModelIndex()) const override;
46 QModelIndex parent(const QModelIndex &) const override;
47 int packetNumberToRow(int packet_num) const;
48 unsigned recreateVisibleRows();
49 inline void needRecreateVisibleRows() { need_recreate_visible_rows_ = !physical_rows_.isEmpty(); }
50 void clear();
51
52 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
53 int columnCount(const QModelIndex & = QModelIndex()) const override;
54 Qt::ItemFlags flags(const QModelIndex &index) const override;
55 QVariant data(const QModelIndex &d_index, int role) const override;
56 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
57
58 int appendPacket(frame_data *fdata);
59 frame_data *getRowFdata(QModelIndex idx) const;
60 frame_data *getRowFdata(int row) const;
61 void ensureRowColorized(int row);
62 int visibleIndexOf(const frame_data *fdata) const;
70 void resetColumns();
71 void resetColorized();
72 void toggleFrameMark(const QModelIndexList &indeces);
73 void setDisplayedFrameMark(bool set);
74 void toggleFrameIgnore(const QModelIndexList &indeces);
75 void setDisplayedFrameIgnore(bool set);
76 void toggleFrameRefTime(const QModelIndex &rt_index);
77 void unsetAllFrameRefTime();
78 void addFrameComment(const QModelIndexList &indices, const QByteArray &comment);
79 void setFrameComment(const QModelIndex &index, const QByteArray &comment, unsigned c_number);
80 void deleteFrameComments(const QModelIndexList &indices);
81 void deleteAllFrameComments();
82
83signals:
84 void packetAppended(capture_file *cap_file, frame_data *fdata, qsizetype row);
85 void goToPacket(int);
86
87 void bgColorizationProgress(int first, int last);
88
89public slots:
90 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
91 void stopSorting();
92 void flushVisibleRows();
93 void dissectIdle(bool reset = false);
94
95private:
96 capture_file *cap_file_;
97 QList<QString> col_names_;
98 QVector<PacketListRecord *> physical_rows_;
99 QVector<PacketListRecord *> visible_rows_;
100 QVector<PacketListRecord *> new_visible_rows_;
101 QVector<int> number_to_row_;
102 bool need_recreate_visible_rows_;
103
104 static int sort_column_;
105 static int sort_column_is_numeric_;
106 static int text_sort_column_;
107 static Qt::SortOrder sort_order_;
108 static capture_file *sort_cap_file_;
109 static bool recordLessThan(PacketListRecord *r1, PacketListRecord *r2);
110 static double parseNumericColumn(const QString &val, bool *ok);
111
112 static bool stop_flag_;
113 static ProgressFrame *progress_frame_;
114 static double exp_comps_;
115 static double comps_;
116
117 QElapsedTimer *idle_dissection_timer_;
118 int idle_dissection_row_;
119
120 bool isNumericColumn(int column);
121 void updateVisibleRows(PacketListRecord*);
122};
123
124#endif // PACKET_LIST_MODEL_H
Definition packet_list_model.h:32
void invalidateAllColumnStrings()
Invalidate any cached column strings.
Definition packet_list_model.cpp:171
void resetColumns()
Rebuild columns from settings.
Definition packet_list_model.cpp:212
Definition packet_list_record.h:29
Definition progress_frame.h:37
Definition cfile.h:68