Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Protected Attributes | List of all members
BaseDataSourceView Class Referenceabstract

Abstract base class for widgets that display raw packet byte data. More...

#include <base_data_source_view.h>

Inheritance diagram for BaseDataSourceView:
HexDataSourceView JsonDataSourceView

Public Slots

virtual void setMonospaceFont (const QFont &mono_font)=0
 Update the monospace font used to render byte values.
 
virtual void detachData ()
 Detach the internal QByteArray from any shared copy.
 
virtual void markProtocol (int start, int length)=0
 Highlight the byte range belonging to the enclosing protocol layer.
 
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 void markAppendix (int start, int length)=0
 Highlight the appendix byte range for the selected field.
 
virtual void unmarkField ()=0
 Clear all field and appendix highlights.
 

Signals

void byteHovered (int pos)
 Emitted when the cursor moves over a byte in the view.
 
void byteSelected (int pos)
 Emitted when the user clicks a byte in the view.
 

Public Member Functions

 BaseDataSourceView (const QByteArray &data, QWidget *parent=nullptr)
 Construct a BaseDataSourceView.
 
virtual QSize minimumSizeHint () const
 Return the minimum size hint for the view.
 
virtual bool isEmpty () const
 Return whether the view contains no displayable data.
 
struct tvbufftvb () const
 Return the tvbuff associated with this data source.
 
void setTvb (struct tvbuff *tvb)
 Associate a Wireshark tvbuff with this data source.
 
int tabIndex () const
 Return the tab index of this view within the byte-view panel.
 
void setTabIndex (int tab_index)
 Set the tab index for this view.
 

Protected Attributes

QByteArray data_
 The raw packet bytes displayed by this view.
 

Detailed Description

Abstract base class for widgets that display raw packet byte data.

Constructor & Destructor Documentation

◆ BaseDataSourceView()

BaseDataSourceView::BaseDataSourceView ( const QByteArray &  data,
QWidget *  parent = nullptr 
)
inlineexplicit

Construct a BaseDataSourceView.

Parameters
dataThe raw packet bytes to display. The data is held by value; call detachData() before modifying the source array if copy-on-write sharing is undesirable.
parentThe parent widget; may be nullptr.

Member Function Documentation

◆ byteHovered

void BaseDataSourceView::byteHovered ( int  pos)
signal

Emitted when the cursor moves over a byte in the view.

Parameters
posZero-based byte offset within data_, or -1 when the cursor leaves the data area.

◆ byteSelected

void BaseDataSourceView::byteSelected ( int  pos)
signal

Emitted when the user clicks a byte in the view.

Parameters
posZero-based byte offset within data_ of the selected byte.

◆ isEmpty()

virtual bool BaseDataSourceView::isEmpty ( ) const
inlinevirtual

Return whether the view contains no displayable data.

Returns
true if data_ is empty; false if there are bytes to show.

◆ markAppendix

virtual void BaseDataSourceView::markAppendix ( int  start,
int  length 
)
pure virtualslot

Highlight the appendix byte range for the selected field.

Parameters
startZero-based byte offset of the first appendix byte.
lengthNumber of bytes in the appendix.

◆ markField

virtual void BaseDataSourceView::markField ( int  start,
int  length,
bool  scroll_to = true,
bool  hover = false 
)
pure virtualslot

Highlight the byte range for a specific dissected field.

Parameters
startZero-based byte offset of the first byte in the field.
lengthNumber of bytes in the field.
scroll_totrue to scroll the field into view (default); false to update the highlight without scrolling.
hovertrue to apply the hover colour; false (default) to apply the selection colour.

◆ markProtocol

virtual void BaseDataSourceView::markProtocol ( int  start,
int  length 
)
pure virtualslot

Highlight the byte range belonging to the enclosing protocol layer.

Parameters
startZero-based byte offset of the first byte in the protocol span.
lengthNumber of bytes in the protocol span.

◆ minimumSizeHint()

virtual QSize BaseDataSourceView::minimumSizeHint ( ) const
inlinevirtual

Return the minimum size hint for the view.

Returns
An empty QSize().

◆ setMonospaceFont

virtual void BaseDataSourceView::setMonospaceFont ( const QFont &  mono_font)
pure virtualslot

Update the monospace font used to render byte values.

Parameters
mono_fontThe new monospace QFont to apply.

◆ setTabIndex()

void BaseDataSourceView::setTabIndex ( int  tab_index)
inline

Set the tab index for this view.

Parameters
tab_indexThe zero-based tab index assigned by the parent panel.

◆ setTvb()

void BaseDataSourceView::setTvb ( struct tvbuff tvb)
inline

Associate a Wireshark tvbuff with this data source.

Parameters
tvbPointer to the tvbuff for the current packet.

◆ tabIndex()

int BaseDataSourceView::tabIndex ( ) const
inline

Return the tab index of this view within the byte-view panel.

Returns
The zero-based tab index.

◆ tvb()

struct tvbuff * BaseDataSourceView::tvb ( ) const
inline

Return the tvbuff associated with this data source.

Returns
A pointer to the associated tvbuff, or nullptr if none has been set.

The documentation for this class was generated from the following file: