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