Wireshark 4.5.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 "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;
46 QModelIndex parent(const QModelIndex &) const;
47 int packetNumberToRow(int packet_num) const;
48 unsigned recreateVisibleRows();
49 void clear();
50
51 int rowCount(const QModelIndex &parent = QModelIndex()) const;
52 int columnCount(const QModelIndex & = QModelIndex()) const;
53 QVariant data(const QModelIndex &d_index, int role) const;
54 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
55
56 int appendPacket(frame_data *fdata);
57 frame_data *getRowFdata(QModelIndex idx) const;
58 frame_data *getRowFdata(int row) const;
59 void ensureRowColorized(int row);
60 int visibleIndexOf(frame_data *fdata) const;
68 void resetColumns();
69 void resetColorized();
70 void toggleFrameMark(const QModelIndexList &indeces);
71 void setDisplayedFrameMark(bool set);
72 void toggleFrameIgnore(const QModelIndexList &indeces);
73 void setDisplayedFrameIgnore(bool set);
74 void toggleFrameRefTime(const QModelIndex &rt_index);
75 void unsetAllFrameRefTime();
76 void addFrameComment(const QModelIndexList &indices, const QByteArray &comment);
77 void setFrameComment(const QModelIndex &index, const QByteArray &comment, unsigned c_number);
78 void deleteFrameComments(const QModelIndexList &indices);
79 void deleteAllFrameComments();
80
81signals:
82 void packetAppended(capture_file *cap_file, frame_data *fdata, qsizetype row);
83 void goToPacket(int);
84
85 void bgColorizationProgress(int first, int last);
86
87public slots:
88 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
89 void stopSorting();
90 void flushVisibleRows();
91 void dissectIdle(bool reset = false);
92
93private:
94 capture_file *cap_file_;
95 QList<QString> col_names_;
96 QVector<PacketListRecord *> physical_rows_;
97 QVector<PacketListRecord *> visible_rows_;
98 QVector<PacketListRecord *> new_visible_rows_;
99 QVector<int> number_to_row_;
100
101 static int sort_column_;
102 static int sort_column_is_numeric_;
103 static int text_sort_column_;
104 static Qt::SortOrder sort_order_;
105 static capture_file *sort_cap_file_;
106 static bool recordLessThan(PacketListRecord *r1, PacketListRecord *r2);
107 static double parseNumericColumn(const QString &val, bool *ok);
108
109 static bool stop_flag_;
110 static ProgressFrame *progress_frame_;
111 static double exp_comps_;
112 static double comps_;
113
114 QElapsedTimer *idle_dissection_timer_;
115 int idle_dissection_row_;
116
117 bool isNumericColumn(int column);
118};
119
120#endif // PACKET_LIST_MODEL_H
Definition packet_list_model.h:32
void invalidateAllColumnStrings()
Invalidate any cached column strings.
Definition packet_list_model.cpp:177
void resetColumns()
Rebuild columns from settings.
Definition packet_list_model.cpp:218
Definition packet_list_record.h:29
Definition progress_frame.h:37
Definition cfile.h:67