Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
proto_tree.h
Go to the documentation of this file.
1
10#ifndef PROTO_TREE_H
11#define PROTO_TREE_H
12
13#include <config.h>
14
15#include <epan/proto.h>
16
17#include <epan/cfile.h>
18
20#include <QTreeView>
21#include <QMenu>
22
23class ProtoTreeModel;
24class ProtoNode;
25
29class ProtoTree : public QTreeView
30{
31 Q_OBJECT
32public:
38 explicit ProtoTree(QWidget *parent = 0, epan_dissect_t *edt_fixed = 0);
39
44 QMenu *colorizeMenu() { return &colorize_menu_; }
45
50 void setRootNode(proto_node *root_node);
51
57 void emitRelatedFrame(int related_frame, ft_framenum_type_t framenum_type = FT_FRAMENUM_NONE);
58
63 void autoScrollTo(const QModelIndex &index);
64
69 void goToHfid(int hfid);
70
74 void clear();
75
80
86 QString toString(const QModelIndex &start_idx = QModelIndex()) const;
87
88protected:
89
93 enum {
94 Name = 0,
96 Value
97 };
98
103 virtual void contextMenuEvent(QContextMenuEvent *event) override;
104
109 virtual void timerEvent(QTimerEvent *event) override;
110
115 virtual void keyReleaseEvent(QKeyEvent *event) override;
116
121 virtual void focusInEvent(QFocusEvent *event) override;
122
129 virtual bool eventFilter(QObject * obj, QEvent * ev) override;
130
137 virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
138
145 QString traverseTree(const QModelIndex & rootNode, int identLevel = 0) const;
146
147private:
149 ProtoTreeModel *proto_tree_model_;
150
152 QMenu conv_menu_;
153
155 QMenu colorize_menu_;
156
158 QList<QAction *> copy_actions_;
159
161 int column_resize_timer_;
162
164 QList<QPair<int,int> > selected_hfid_path_;
165
167 QPoint drag_start_position_;
168
170 capture_file *cap_file_;
171
173 epan_dissect_t *edt_;
174
179 void saveSelectedField(QModelIndex &index);
180
186 static void foreachTreeNode(proto_node *node, void *proto_tree_ptr);
187
192 void foreachExpand(const QModelIndex &index);
193
194signals:
200
205 void openPacketInNewWindow(bool open);
206
211 void goToPacket(int packet_num);
212
218 void relatedFrame(int frame_num, ft_framenum_type_t type);
219
224 void showProtocolPreferences(const QString module_name);
225
232
237
242
243public slots:
244
250
255 void setMonospaceFont(const QFont &mono_font);
256
261 void syncExpanded(const QModelIndex & index);
262
267 void syncCollapsed(const QModelIndex & index);
268
272 void expandSubtrees();
273
277 void collapseSubtrees();
278
282 void expandAll();
283
287 void collapseAll();
288
293 void itemClicked(const QModelIndex & index);
294
299 void itemDoubleClicked(const QModelIndex & index);
300
306
311 void selectedFrameChanged(QList<int> frames);
312
313protected slots:
319 void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
320
321#if 0
325 void ctxShowPacketBytes();
326
330 void ctxExportPacketBytes();
331#endif
332
336 void ctxCopyVisibleItems();
337
341 void ctxCopyAsFilter();
342
346 void ctxCopySelectedInfo();
347
351 void ctxOpenUrlWiki();
352
353private slots:
357 void updateContentWidth();
358
362 void connectToMainWindow();
363};
364
365#endif // PROTO_TREE_H
Represents information about a dissected packet field.
Definition field_information.h:26
A wrapper class for the core proto_node structure, providing tree traversal and data access.
Definition proto_node.h:24
A tree view for displaying protocol dissection details.
Definition proto_tree.h:30
virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
Handles cursor movements within the tree.
Definition proto_tree.cpp:1004
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override
Handles changes in the tree view selection.
Definition proto_tree.cpp:640
void fieldSelected(FieldInformation *finfo)
Signal emitted when a field is selected.
void openPacketInNewWindow(bool open)
Signal emitted to open the packet in a new window.
QMenu * colorizeMenu()
Retrieves the colorize menu.
Definition proto_tree.h:44
void expandSubtrees()
Expands all subtrees of the currently selected item.
Definition proto_tree.cpp:694
void emitRelatedFrame(int related_frame, ft_framenum_type_t framenum_type=FT_FRAMENUM_NONE)
Emits a signal indicating a related frame.
Definition proto_tree.cpp:617
void ctxCopyVisibleItems()
Context menu action to copy all visible items.
Definition proto_tree.cpp:120
void setMonospaceFont(const QFont &mono_font)
Sets the monospace font used in the tree view.
Definition proto_tree.cpp:558
@ Value
Definition proto_tree.h:96
@ Name
Definition proto_tree.h:94
@ Description
Definition proto_tree.h:95
void syncExpanded(const QModelIndex &index)
Synchronizes the expanded state of a node.
Definition proto_tree.cpp:668
void autoScrollTo(const QModelIndex &index)
Automatically scrolls to a specific model index.
Definition proto_tree.cpp:622
void clear()
Clears the protocol tree.
Definition proto_tree.cpp:104
virtual void focusInEvent(QFocusEvent *event) override
Handles focus in events.
Definition proto_tree.cpp:529
void selectedFrameChanged(QList< int > frames)
Slot triggered when the selected frame changes.
Definition proto_tree.cpp:814
void redissectPacketsRequested()
Signal emitted to request redissection of packets.
QString toString(const QModelIndex &start_idx=QModelIndex()) const
Converts the tree or a subtree to a string representation.
Definition proto_tree.cpp:907
void goToPacket(int packet_num)
Signal emitted to jump to a specific packet.
void relatedFrame(int frame_num, ft_framenum_type_t type)
Signal emitted to indicate a related frame.
void collapseAll()
Collapses all items in the tree.
Definition proto_tree.cpp:747
void ctxOpenUrlWiki()
Context menu action to open the associated protocol wiki page.
Definition proto_tree.cpp:193
virtual void timerEvent(QTimerEvent *event) override
Handles timer events.
Definition proto_tree.cpp:498
void expandAll()
Expands all items in the tree.
Definition proto_tree.cpp:738
virtual bool eventFilter(QObject *obj, QEvent *ev) override
Filters events for watched objects.
Definition proto_tree.cpp:931
void goToHfid(int hfid)
Navigates to a specific Header Field ID (HFID).
Definition proto_tree.cpp:634
void editProtocolPreference(pref_t *pref, module_t *module)
Signal emitted to edit a specific protocol preference.
virtual void keyReleaseEvent(QKeyEvent *event) override
Handles key release events.
Definition proto_tree.cpp:511
virtual void contextMenuEvent(QContextMenuEvent *event) override
Handles context menu events.
Definition proto_tree.cpp:246
void showProtocolPreferences(const QString module_name)
Signal emitted to show preferences for a specific protocol.
void restoreSelectedField()
Restores the previously selected field in the tree.
Definition proto_tree.cpp:860
void ctxCopySelectedInfo()
Context menu action to copy the selected information.
Definition proto_tree.cpp:154
void setRootNode(proto_node *root_node)
Sets the root protocol node to be displayed.
Definition proto_tree.cpp:603
void itemDoubleClicked(const QModelIndex &index)
Slot triggered when an item is double-clicked.
Definition proto_tree.cpp:793
void setCaptureFile(capture_file *cf)
Set the capture file.
Definition proto_tree.cpp:922
QString traverseTree(const QModelIndex &rootNode, int identLevel=0) const
Traverses the tree and builds a string representation.
Definition proto_tree.cpp:883
void ctxCopyAsFilter()
Context menu action to copy the selected item as a display filter.
Definition proto_tree.cpp:138
void syncCollapsed(const QModelIndex &index)
Synchronizes the collapsed state of a node.
Definition proto_tree.cpp:681
void collapseSubtrees()
Collapses all subtrees of the currently selected item.
Definition proto_tree.cpp:716
void itemClicked(const QModelIndex &index)
Slot triggered when an item is clicked.
Definition proto_tree.cpp:756
void selectedFieldChanged(FieldInformation *finfo)
Slot triggered when the selected field changes.
Definition proto_tree.cpp:826
void recolorPacketsRequested()
Signal emitted to request packet recolorization.
Item model that exposes a libwireshark proto_node tree to Qt views, enabling the packet-details tree ...
Definition proto_tree_model.h:25
enum ft_framenum_type ft_framenum_type_t
Convenience typedef for ft_framenum_type.
Definition ftypes.h:208
@ FT_FRAMENUM_NONE
Definition ftypes.h:197
Represents a capture file and its associated metadata.
Definition cfile.h:84
Definition proto.h:909
Holds all state for the dissection of a single byte array, including session, buffer,...
Definition epan_dissect.h:28
Represents a preference module grouping related preferences under a named, hierarchical entry in the ...
Definition prefs-int.h:27
Definition prefs.c:207