Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Types | Public Slots | Signals | Public Member Functions | List of all members
PacketListModel Class Reference

A Qt item model representing the list of packets in a capture file. More...

#include <packet_list_model.h>

Inheritance diagram for PacketListModel:

Public Types

enum  { HEADER_CAN_DISPLAY_STRINGS = Qt::UserRole , HEADER_CAN_DISPLAY_DETAILS }
 Custom roles used for header data. More...
 

Public Slots

void sort (int column, Qt::SortOrder order=Qt::AscendingOrder) override
 Sorts the model based on the specified column.
 
void stopSorting ()
 Stops an ongoing sorting operation.
 
void flushVisibleRows ()
 Flushes the newly visible rows into the main visible rows view.
 
void dissectIdle (bool reset=false)
 Performs dissection work during application idle time.
 

Signals

void packetAppended (capture_file *cap_file, frame_data *fdata, qsizetype row)
 Signal emitted when a packet is successfully appended.
 
void goToPacket (int packet_num)
 Signal emitted to navigate the view to a specific packet number.
 
void bgColorizationProgress (int first, int last)
 Signal emitted to report background colorization progress.
 

Public Member Functions

 PacketListModel (QObject *parent=0, capture_file *cf=NULL)
 Constructs a new PacketListModel.
 
 ~PacketListModel ()
 Destroys the PacketListModel.
 
void setCaptureFile (capture_file *cf)
 Sets the capture file for the model.
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 Returns the index of the item in the model.
 
QModelIndex parent (const QModelIndex &) const override
 Returns the parent of the model item.
 
int packetNumberToRow (int packet_num) const
 Converts a packet number to a row index.
 
unsigned recreateVisibleRows ()
 Recreates the list of visible rows based on filters and state.
 
void needRecreateVisibleRows ()
 Flags the model as needing to recreate its visible rows.
 
void clear ()
 Clears the model data.
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of rows under the given parent.
 
int columnCount (const QModelIndex &=QModelIndex()) const override
 Returns the number of columns.
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 Returns the item flags for the given index.
 
QVariant data (const QModelIndex &d_index, int role) const override
 Returns the data stored under the given role for the specified index.
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 Returns the data for the given role and section in the header.
 
int appendPacket (frame_data *fdata)
 Appends a packet to the model.
 
frame_datagetRowFdata (QModelIndex idx) const
 Retrieves the frame data for a given model index.
 
frame_datagetRowFdata (int row) const
 Retrieves the frame data for a given row.
 
void ensureRowColorized (int row)
 Ensures that a specific row has been colorized.
 
int visibleIndexOf (const frame_data *fdata) const
 Returns the visible index of the given frame data.
 
void invalidateAllColumnStrings ()
 Invalidate any cached column strings.
 
void resetColumns ()
 Rebuild columns from settings.
 
void resetColorized ()
 Resets the colorized state for all rows.
 
void toggleFrameMark (const QModelIndexList &indeces)
 Toggles the mark state for the specified frames.
 
void setDisplayedFrameMark (bool set)
 Sets the mark state for all currently displayed frames.
 
void toggleFrameIgnore (const QModelIndexList &indeces)
 Toggles the ignore state for the specified frames.
 
void setDisplayedFrameIgnore (bool set)
 Sets the ignore state for all currently displayed frames.
 
void toggleFrameRefTime (const QModelIndex &rt_index)
 Toggles the reference time state for a specified frame.
 
void unsetAllFrameRefTime ()
 Unsets the reference time state for all frames.
 
void addFrameComment (const QModelIndexList &indices, const QByteArray &comment)
 Adds a comment to the specified frames.
 
void setFrameComment (const QModelIndex &index, const QByteArray &comment, unsigned c_number)
 Sets a specific comment on a frame.
 
void deleteFrameComments (const QModelIndexList &indices)
 Deletes comments from the specified frames.
 
void deleteAllFrameComments ()
 Deletes all frame comments from all frames.
 

Detailed Description

A Qt item model representing the list of packets in a capture file.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Custom roles used for header data.

Enumerator
HEADER_CAN_DISPLAY_STRINGS 

Role indicating if the header can display strings.

HEADER_CAN_DISPLAY_DETAILS 

Role indicating if the header can display details.

Constructor & Destructor Documentation

◆ PacketListModel()

PacketListModel::PacketListModel ( QObject *  parent = 0,
capture_file cf = NULL 
)
explicit

Constructs a new PacketListModel.

Parameters
parentThe parent QObject, defaults to 0.
cfThe capture file associated with the model, defaults to NULL.

Member Function Documentation

◆ addFrameComment()

void PacketListModel::addFrameComment ( const QModelIndexList &  indices,
const QByteArray &  comment 
)

Adds a comment to the specified frames.

Parameters
indicesList of model indices to comment on.
commentThe comment text as a byte array.

◆ appendPacket()

int PacketListModel::appendPacket ( frame_data fdata)

Appends a packet to the model.

Parameters
fdataPointer to the frame data.
Returns
The row index where the packet was appended.

◆ bgColorizationProgress

void PacketListModel::bgColorizationProgress ( int  first,
int  last 
)
signal

Signal emitted to report background colorization progress.

Parameters
firstThe first row processed.
lastThe last row processed.

◆ columnCount()

int PacketListModel::columnCount ( const QModelIndex &  = QModelIndex()) const
override

Returns the number of columns.

Returns
The number of columns.

◆ data()

QVariant PacketListModel::data ( const QModelIndex &  d_index,
int  role 
) const
override

Returns the data stored under the given role for the specified index.

Parameters
d_indexThe model index.
roleThe display role.
Returns
The requested data as a QVariant.

◆ deleteFrameComments()

void PacketListModel::deleteFrameComments ( const QModelIndexList &  indices)

Deletes comments from the specified frames.

Parameters
indicesList of model indices to remove comments from.

◆ dissectIdle

void PacketListModel::dissectIdle ( bool  reset = false)
slot

Performs dissection work during application idle time.

Parameters
resetTrue to reset the idle dissection state.

◆ ensureRowColorized()

void PacketListModel::ensureRowColorized ( int  row)

Ensures that a specific row has been colorized.

Parameters
rowThe row index to colorize.

◆ flags()

Qt::ItemFlags PacketListModel::flags ( const QModelIndex &  index) const
override

Returns the item flags for the given index.

Parameters
indexThe model index.
Returns
The item flags.

◆ getRowFdata() [1/2]

frame_data * PacketListModel::getRowFdata ( int  row) const

Retrieves the frame data for a given row.

Parameters
rowThe row index.
Returns
Pointer to the frame data.

◆ getRowFdata() [2/2]

frame_data * PacketListModel::getRowFdata ( QModelIndex  idx) const

Retrieves the frame data for a given model index.

Parameters
idxThe model index.
Returns
Pointer to the frame data.

◆ goToPacket

void PacketListModel::goToPacket ( int  packet_num)
signal

Signal emitted to navigate the view to a specific packet number.

Parameters
packet_numThe target packet number.

◆ headerData()

QVariant PacketListModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

Returns the data for the given role and section in the header.

Parameters
sectionThe header section.
orientationThe header orientation.
roleThe display role.
Returns
The header data as a QVariant.

◆ index()

QModelIndex PacketListModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
override

Returns the index of the item in the model.

Parameters
rowThe row of the item.
columnThe column of the item.
parentThe parent index, defaults to QModelIndex().
Returns
The model index of the specified item.

◆ packetAppended

void PacketListModel::packetAppended ( capture_file cap_file,
frame_data fdata,
qsizetype  row 
)
signal

Signal emitted when a packet is successfully appended.

Parameters
cap_filePointer to the capture file.
fdataPointer to the frame data.
rowThe row index where the packet was added.

◆ packetNumberToRow()

int PacketListModel::packetNumberToRow ( int  packet_num) const

Converts a packet number to a row index.

Parameters
packet_numThe packet number.
Returns
The corresponding row index.

◆ parent()

QModelIndex PacketListModel::parent ( const QModelIndex &  ) const
override

Returns the parent of the model item.

Returns
The parent model index.

◆ recreateVisibleRows()

unsigned PacketListModel::recreateVisibleRows ( )

Recreates the list of visible rows based on filters and state.

Returns
The number of visible rows.

◆ rowCount()

int PacketListModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Returns the number of rows under the given parent.

Parameters
parentThe parent model index.
Returns
The number of rows.

◆ setCaptureFile()

void PacketListModel::setCaptureFile ( capture_file cf)

Sets the capture file for the model.

Parameters
cfPointer to the capture file.

◆ setDisplayedFrameIgnore()

void PacketListModel::setDisplayedFrameIgnore ( bool  set)

Sets the ignore state for all currently displayed frames.

Parameters
setTrue to ignore, false to un-ignore.

◆ setDisplayedFrameMark()

void PacketListModel::setDisplayedFrameMark ( bool  set)

Sets the mark state for all currently displayed frames.

Parameters
setTrue to mark, false to unmark.

◆ setFrameComment()

void PacketListModel::setFrameComment ( const QModelIndex &  index,
const QByteArray &  comment,
unsigned  c_number 
)

Sets a specific comment on a frame.

Parameters
indexThe model index of the frame.
commentThe comment text.
c_numberThe comment number index.

◆ sort

void PacketListModel::sort ( int  column,
Qt::SortOrder  order = Qt::AscendingOrder 
)
overrideslot

Sorts the model based on the specified column.

Parameters
columnThe column index to sort by.
orderThe sort order (ascending or descending).

◆ toggleFrameIgnore()

void PacketListModel::toggleFrameIgnore ( const QModelIndexList &  indeces)

Toggles the ignore state for the specified frames.

Parameters
indecesList of model indices to toggle.

◆ toggleFrameMark()

void PacketListModel::toggleFrameMark ( const QModelIndexList &  indeces)

Toggles the mark state for the specified frames.

Parameters
indecesList of model indices to toggle.

◆ toggleFrameRefTime()

void PacketListModel::toggleFrameRefTime ( const QModelIndex &  rt_index)

Toggles the reference time state for a specified frame.

Parameters
rt_indexThe model index of the frame.

◆ visibleIndexOf()

int PacketListModel::visibleIndexOf ( const frame_data fdata) const

Returns the visible index of the given frame data.

Parameters
fdataPointer to the frame data.
Returns
The visible index.

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