| 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
23#include <ui/qt/progress_frame.h>
24
25#include "packet_list_record.h"
26
27#include "cfile.h"
28
29 class QElapsedTimer;
30
31 class PacketListModel : public QAbstractItemModel
32{
33 Q_OBJECT
34 public:
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);
42 ~PacketListModel();
43 void setCaptureFile(capture_file *cf);
44 QModelIndex index(int row, int column,
45 const QModelIndex & = QModelIndex()) const;
46 QModelIndex parent(const QModelIndex &) const;
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;
53 int columnCount(const QModelIndex & = QModelIndex()) const;
54 QVariant data(const QModelIndex &d_index, int role) const;
55 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
56
57 int appendPacket(frame_data *fdata);
58 frame_data *getRowFdata(QModelIndex idx) const;
59 frame_data *getRowFdata(int row) const;
60 void ensureRowColorized(int row);
61 int visibleIndexOf(const frame_data *fdata) const;
65 void invalidateAllColumnStrings();
69 void resetColumns();
70 void resetColorized();
71 void toggleFrameMark(const QModelIndexList &indeces);
72 void setDisplayedFrameMark(bool set);
73 void toggleFrameIgnore(const QModelIndexList &indeces);
74 void setDisplayedFrameIgnore(bool set);
75 void toggleFrameRefTime(const QModelIndex &rt_index);
76 void unsetAllFrameRefTime();
77 void addFrameComment(const QModelIndexList &indices, const QByteArray &comment);
78 void setFrameComment(const QModelIndex &index, const QByteArray &comment, unsigned c_number);
79 void deleteFrameComments(const QModelIndexList &indices);
80 void deleteAllFrameComments();
81
82signals:
83 void packetAppended(capture_file *cap_file, frame_data *fdata, qsizetype row);
84 void goToPacket(int);
85
86 void bgColorizationProgress(int first, int last);
87
88 public slots:
89 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
90 void stopSorting();
91 void flushVisibleRows();
92 void dissectIdle(bool reset = false);
93
94 private:
95 capture_file *cap_file_;
96 QList<QString> col_names_;
97 QVector<PacketListRecord *> physical_rows_;
98 QVector<PacketListRecord *> visible_rows_;
99 QVector<PacketListRecord *> new_visible_rows_;
100 QVector<int> number_to_row_;
101 bool need_recreate_visible_rows_;
102
103 static int sort_column_;
104 static int sort_column_is_numeric_;
105 static int text_sort_column_;
106 static Qt::SortOrder sort_order_;
107 static capture_file *sort_cap_file_;
108 static bool recordLessThan(PacketListRecord *r1, PacketListRecord *r2);
109 static double parseNumericColumn(const QString &val, bool *ok);
110
111 static bool stop_flag_;
112 static ProgressFrame *progress_frame_;
113 static double exp_comps_;
114 static double comps_;
115
116 QElapsedTimer *idle_dissection_timer_;
117 int idle_dissection_row_;
118
119 bool isNumericColumn(int column);
120 void updateVisibleRows(PacketListRecord*);
121};
122
123#endif // PACKET_LIST_MODEL_H
cfile.h
PacketListModel
Definition packet_list_model.h:32
PacketListModel::invalidateAllColumnStrings
void invalidateAllColumnStrings()
Invalidate any cached column strings.
Definition packet_list_model.cpp:168
PacketListModel::resetColumns
void resetColumns()
Rebuild columns from settings.
Definition packet_list_model.cpp:209
PacketListRecord
Definition packet_list_record.h:29
ProgressFrame
Definition progress_frame.h:37
packet.h
packet_list_record.h
progress_frame.h
_capture_file
Definition cfile.h:67