Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

decode_as_model.h
1 /* decode_as_model.h
2 * Data model for Decode As records.
3 *
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11 #ifndef DECODE_AS_MODEL_H
12 #define DECODE_AS_MODEL_H
13
14 #include <config.h>
15 #include <glib.h>
16
17 #include <QAbstractItemModel>
18 #include <QList>
19
20 #include "cfile.h"
21
22 #include <epan/packet.h>
23 #include <epan/dissectors/packet-dcerpc.h>
24
25 class DecodeAsItem
26 {
27 public:
28 DecodeAsItem();
29 virtual ~DecodeAsItem();
30
31 const gchar* tableName_;
32 const gchar* tableUIName_;
33
34 //save our sanity and not have to worry about memory management
35 //between (lack of) persistent data in GUI and underlying data
36 uint selectorUint_;
37 QString selectorString_;
38 decode_dcerpc_bind_values_t* selectorDCERPC_; //for special handling of DCE/RPC
39
40 QString default_proto_;
41 QString current_proto_;
42 dissector_handle_t dissector_handle_;
43 };
44
45 class DecodeAsModel : public QAbstractTableModel
46 {
47 Q_OBJECT
48
49 public:
50 DecodeAsModel(QObject *parent, capture_file *cf = NULL);
51
52 enum DecodeAsColumn {
53 colTable = 0, // aka "Field" (or dissector table like "TCP Port")
54 colSelector, // the actual table value (e.g., port number 80)
55 colType, // field type (e.g. "Integer, base 16")
56 colDefault, // aka "initial" protocol chosen by Wireshark
57 colProtocol, // aka "current" protocol selected by user
58 colDecodeAsMax //not used
59 };
60
61 Qt::ItemFlags flags(const QModelIndex &index) const;
62 QVariant data(const QModelIndex &index, int role) const;
63 QVariant headerData(int section, Qt::Orientation orientation,
64 int role = Qt::DisplayRole) const;
65 int rowCount(const QModelIndex &parent = QModelIndex()) const;
66 int columnCount(const QModelIndex &parent = QModelIndex()) const;
67
68 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
69 void fillTable();
70
71 void setDissectorHandle(const QModelIndex &index, dissector_handle_t dissector_handle);
72
73 bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
74 bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
75 bool copyRow(int dst_row, int src_row);
76
77 static QString entryString(const gchar *table_name, gpointer value);
78
79 void applyChanges();
80
81 protected:
82 static void buildChangedList(const gchar *table_name, ftenum_t selector_type,
83 gpointer key, gpointer value, gpointer user_data);
84 static void buildDceRpcChangedList(gpointer data, gpointer user_data);
85 static void gatherChangedEntries(const gchar *table_name, ftenum_t selector_type,
86 gpointer key, gpointer value, gpointer user_data);
87
88
89 private:
90 capture_file *cap_file_;
91 QList<DecodeAsItem *> decode_as_items_;
92 QList<QPair<const char *, guint32> > changed_uint_entries_;
93 QList<QPair<const char *, const char *> > changed_string_entries_;
94 };
95
96 #endif // DECODE_AS_MODEL_H
decode_dcerpc_bind_values_s
Definition: packet-dcerpc.h:455
DecodeAsModel
Definition: decode_as_model.h:45
dissector_handle
Definition: packet.c:659
_capture_file
Definition: cfile.h:58
DecodeAsItem
Definition: decode_as_model.h:25