Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
base_data_source_view.h
Go to the documentation of this file.
1
10#pragma once
11
12#include <QAbstractScrollArea>
13
14struct tvbuff;
15
19class BaseDataSourceView : public QAbstractScrollArea
20{
21 Q_OBJECT
22
23public:
31 explicit BaseDataSourceView(const QByteArray &data, QWidget *parent = nullptr) :
32 QAbstractScrollArea(parent),
33 data_(data),
34 tvb_(nullptr),
35 tab_index_(0)
36 {}
37
42 virtual QSize minimumSizeHint() const { return QSize(); }
43
48 virtual bool isEmpty() const { return data_.isEmpty(); }
49
56 struct tvbuff *tvb() const { return tvb_; }
57
62 void setTvb(struct tvbuff *tvb) { tvb_ = tvb; }
63
68 int tabIndex() const { return tab_index_; }
69
74 void setTabIndex(int tab_index) { tab_index_ = tab_index; }
75
76signals:
83 void byteHovered(int pos);
84
90 void byteSelected(int pos);
91
92public slots:
97 virtual void setMonospaceFont(const QFont &mono_font) = 0;
98
102 virtual void detachData() { data_.detach(); }
103
109 virtual void markProtocol(int start, int length) = 0;
110
121 virtual void markField(int start, int length, bool scroll_to = true,
122 bool hover = false) = 0;
123
130 virtual void markAppendix(int start, int length) = 0;
131
135 virtual void unmarkField() = 0;
136
137protected:
141 QByteArray data_;
142
143private:
144 struct tvbuff *tvb_;
145 int tab_index_;
146};
Abstract base class for widgets that display raw packet byte data.
Definition base_data_source_view.h:20
virtual void detachData()
Detach the internal QByteArray from any shared copy.
Definition base_data_source_view.h:102
void setTabIndex(int tab_index)
Set the tab index for this view.
Definition base_data_source_view.h:74
virtual void markProtocol(int start, int length)=0
Highlight the byte range belonging to the enclosing protocol layer.
void setTvb(struct tvbuff *tvb)
Associate a Wireshark tvbuff with this data source.
Definition base_data_source_view.h:62
virtual bool isEmpty() const
Return whether the view contains no displayable data.
Definition base_data_source_view.h:48
QByteArray data_
The raw packet bytes displayed by this view.
Definition base_data_source_view.h:141
virtual void markField(int start, int length, bool scroll_to=true, bool hover=false)=0
Highlight the byte range for a specific dissected field.
virtual QSize minimumSizeHint() const
Return the minimum size hint for the view.
Definition base_data_source_view.h:42
struct tvbuff * tvb() const
Return the tvbuff associated with this data source.
Definition base_data_source_view.h:56
void byteHovered(int pos)
Emitted when the cursor moves over a byte in the view.
virtual void unmarkField()=0
Clear all field and appendix highlights.
void byteSelected(int pos)
Emitted when the user clicks a byte in the view.
int tabIndex() const
Return the tab index of this view within the byte-view panel.
Definition base_data_source_view.h:68
virtual void setMonospaceFont(const QFont &mono_font)=0
Update the monospace font used to render byte values.
BaseDataSourceView(const QByteArray &data, QWidget *parent=nullptr)
Construct a BaseDataSourceView.
Definition base_data_source_view.h:31
virtual void markAppendix(int start, int length)=0
Highlight the appendix byte range for the selected field.
Core tvbuff (testy virtual buffer) structure representing a region of packet data,...
Definition tvbuff-int.h:95