Wireshark  4.3.0
The Wireshark network protocol analyzer
packet_list_record.h
Go to the documentation of this file.
1 
10 #ifndef PACKET_LIST_RECORD_H
11 #define PACKET_LIST_RECORD_H
12 
13 #include <config.h>
14 
15 #include "cfile.h"
16 
17 #include <epan/column.h>
18 #include <epan/packet.h>
19 
20 #include <QByteArray>
21 #include <QCache>
22 #include <QList>
23 #include <QVariant>
24 
25 struct conversation;
26 struct _GStringChunk;
27 
29 {
30 public:
31  PacketListRecord(frame_data *frameData);
32  virtual ~PacketListRecord();
33 
34  // Ensure that the record is colorized.
35  void ensureColorized(capture_file *cap_file);
36  // Return the string value for a column. Data is cached if possible.
37  const QString columnString(capture_file *cap_file, int column, bool colorized = false);
38  frame_data *frameData() const { return fdata_; }
39  // packet_list->col_to_text in gtk/packet_list_store.c
40  static int textColumn(int column) { return cinfo_column_.value(column, -1); }
41  bool colorized() { return colorized_ && (color_ver_ == rows_color_ver_); }
42  unsigned int conversation() { return conv_index_; }
43 
44  int columnTextSize(const char *str);
45 
46  void invalidateColorized() { colorized_ = false; }
47  void invalidateRecord() { col_text_cache_.remove(fdata_->num); }
48  static void invalidateAllRecords() { col_text_cache_.clear(); }
49  /* In Qt 6, QCache maxCost is a qsizetype, but the QAbstractItemModel
50  * number of rows is still an int, so we're limited to INT_MAX anyway.
51  */
52  static void setMaxCache(int cost) { col_text_cache_.setMaxCost(cost); }
53  static void resetColumns(column_info *cinfo);
54  static void resetColorization() { rows_color_ver_++; }
55 
56  inline int lineCount() { return lines_; }
57  inline int lineCountChanged() { return line_count_changed_; }
58 
59 private:
61  static QCache<uint32_t, QStringList> col_text_cache_;
62 
63  frame_data *fdata_;
64  int lines_;
65  bool line_count_changed_;
66  static QMap<int, int> cinfo_column_;
67 
69  static unsigned int rows_color_ver_;
70  unsigned int color_ver_;
71  bool colorized_;
72 
74  unsigned int conv_index_;
75 
76  bool read_failed_;
77 
78  void dissect(capture_file *cap_file, bool dissect_columns, bool dissect_color = false);
79  void cacheColumnStrings(column_info *cinfo);
80 };
81 
82 #endif // PACKET_LIST_RECORD_H
Definition: packet_list_record.h:29
Definition: cfile.h:67
Definition: conversation.h:220
Definition: column-info.h:63