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

The main packet list view for displaying captured packets. More...

#include <packet_list.h>

Inheritance diagram for PacketList:

Public Types

enum  SummaryCopyType { CopyAsText , CopyAsCSV , CopyAsYAML , CopyAsHTML }
 Types of formats available for copying packet summaries. More...
 

Public Slots

void setCaptureFile (capture_file *cf)
 Sets the active capture file.
 
void setMonospaceFont (const QFont &mono_font)
 Sets the monospace font used in the list.
 
void setRegularFont (const QFont &regular_font)
 Sets the regular font used in the list.
 
void goNextPacket ()
 Navigates to the next packet.
 
void goPreviousPacket ()
 Navigates to the previous packet.
 
void goFirstPacket ()
 Navigates to the very first packet.
 
void goLastPacket ()
 Navigates to the very last packet.
 
void goToPacket (int packet, int hf_id=-1)
 Jumps directly to a specific packet number.
 
void goNextHistoryPacket ()
 Navigates to the next packet in the selection history.
 
void goPreviousHistoryPacket ()
 Navigates to the previous packet in the selection history.
 
void markFrame ()
 Toggles the mark on the currently selected frame.
 
void markAllDisplayedFrames (bool set)
 Marks or unmarks all displayed frames.
 
void ignoreFrame ()
 Toggles the ignore status of the currently selected frame.
 
void ignoreAllDisplayedFrames (bool set)
 Ignores or un-ignores all displayed frames.
 
void setTimeReference ()
 Toggles the time reference status on the currently selected frame.
 
void unsetAllTimeReferences ()
 Unsets all time reference flags on all frames.
 
void applyTimeShift ()
 Applies a time shift to the capture packets.
 
void recolorPackets ()
 Recolors the displayed packets based on rules.
 
void redrawVisiblePackets ()
 Fully redraws all visible packets.
 
void redrawVisiblePacketsDontSelectCurrent ()
 Redraws all visible packets without modifying the current selection.
 
void colorsChanged ()
 Slot triggered when global color configurations change.
 
void columnsChanged ()
 Slot triggered when the column configuration changes.
 
void fieldsChanged (capture_file *cf)
 Slot triggered when global fields configuration changes.
 
void preferencesChanged ()
 Slot triggered when global preferences have changed.
 
void freezePacketList (bool changing_profile)
 Slot to trigger freezing the packet list state.
 

Signals

void packetDissectionChanged ()
 Signal emitted when packet dissection data changes.
 
void showColumnPreferences (QString pane_name)
 Signal emitted to show preferences for a specific pane.
 
void editColumn (int column)
 Signal emitted to trigger editing for a specific column.
 
void packetListScrolled (bool at_end)
 Signal emitted when the packet list has been scrolled.
 
void showProtocolPreferences (const QString module_name)
 Signal emitted to show protocol specific preferences.
 
void editProtocolPreference (pref_t *pref, module_t *module)
 Signal emitted to edit a specific protocol preference.
 
void framesSelected (QList< int > frames)
 Signal emitted when multiple frames are selected.
 
void fieldSelected (FieldInformation *finfo)
 Signal emitted when a specific field is selected.
 

Public Member Functions

 PacketList (QWidget *parent=0)
 Constructs a new PacketList object.
 
 ~PacketList ()
 Destroys the PacketList object.
 
virtual void scrollTo (const QModelIndex &index, QAbstractItemView::ScrollHint hint=EnsureVisible) override
 Scrolls the view to the given index.
 
QMenu * conversationMenu ()
 Retrieves the conversation menu.
 
QMenu * colorizeMenu ()
 Retrieves the colorize menu.
 
void setProtoTree (ProtoTree *proto_tree)
 Sets the protocol tree.
 
bool freeze (bool keep_current_frame=false)
 Disable and clear the packet list.
 
bool thaw (bool restore_selection=false)
 Enable and restore the packet list.
 
void clear ()
 Clears the packet list.
 
void writeRecent (FILE *rf)
 Writes recent configuration to a file.
 
bool contextMenuActive ()
 Checks if the context menu is currently active.
 
QString getFilterFromRowAndColumn (QModelIndex idx)
 Retrieves the filter string based on a given row and column.
 
void resetColorized ()
 Resets the colorized state of the packets.
 
QString getPacketComment (unsigned c_number)
 Retrieves the comment for a specific packet.
 
void addPacketComment (QString new_comment)
 Adds a new comment to the currently selected packet.
 
void setPacketComment (unsigned c_number, QString new_comment)
 Sets the comment for a specific packet.
 
QString allPacketComments ()
 Retrieves all packet comments in the capture.
 
void deleteCommentsFromPackets ()
 Deletes comments from the selected packets.
 
void deleteAllPacketComments ()
 Deletes all packet comments in the capture.
 
void setVerticalAutoScroll (bool enabled=true)
 Enables or disables vertical auto-scrolling.
 
void setCaptureInProgress (bool in_progress=false, bool auto_scroll=true)
 Sets the capture in progress state.
 
void captureFileReadFinished ()
 Handles the event when the capture file has finished reading.
 
void setColumnDelegate ()
 Sets the column delegate for the view.
 
void resetColumns ()
 Resets the columns to their default state.
 
bool haveNextHistory (bool update_cur=false)
 Checks if there is a next packet in the selection history.
 
bool havePreviousHistory (bool update_cur=false)
 Checks if there is a previous packet in the selection history.
 
void setProfileSwitcher (ProfileSwitcher *profile_switcher)
 Sets the profile switcher for the packet list.
 
frame_datagetFDataForRow (int row) const
 Retrieves the frame data for a specific row.
 
bool uniqueSelectActive ()
 Checks if a single unique selection is currently active.
 
bool multiSelectActive ()
 Checks if multiple selections are currently active.
 
QList< int > selectedRows (bool useFrameNum=false)
 Retrieves a list of selected row numbers.
 
QString createSummaryText (QModelIndex idx, SummaryCopyType type)
 Creates a summary text for a specific index.
 
QString createHeaderSummaryText (SummaryCopyType type)
 Creates the header summary text.
 
QStringList createHeaderPartsForAligned ()
 Creates string parts for aligned headers.
 
QList< int > createAlignmentPartsForAligned ()
 Creates alignment parts for formatting.
 
QList< int > createSizePartsForAligned (bool useHeader, QStringList hdr_parts, QList< int > rows)
 Creates size parts for aligned formatting.
 
QString createHeaderSummaryForAligned (QStringList hdr_parts, QList< int > align_parts, QList< int > size_parts)
 Creates an aligned header summary.
 
QString createSummaryForAligned (QModelIndex idx, QList< int > align_parts, QList< int > size_parts)
 Creates an aligned summary for a specific index.
 
QString createDefaultStyleForHtml ()
 Retrieves the default CSS style for HTML summaries.
 
QString createOpeningTagForHtml ()
 Creates the opening tag block for HTML summaries.
 
QString createHeaderSummaryForHtml ()
 Creates the HTML header summary.
 
QString createSummaryForHtml (QModelIndex idx)
 Creates an HTML summary for a specific index.
 
QString createClosingTagForHtml ()
 Creates the closing tag block for HTML summaries.
 
void resizeAllColumns (bool onlyTimeFormatted=false)
 Resizes all columns to fit their content.
 

Protected Slots

void rowsInserted (const QModelIndex &parent, int start, int end) override
 Slot triggered when rows are inserted into the model.
 
virtual void drawRow (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Custom drawing logic for a row.
 

Protected Member Functions

void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected) override
 Handles selection change events.
 
virtual void contextMenuEvent (QContextMenuEvent *event) override
 Handles context menu events.
 
void timerEvent (QTimerEvent *event) override
 Handles timer events.
 
void paintEvent (QPaintEvent *event) override
 Handles paint events.
 
virtual void mousePressEvent (QMouseEvent *event) override
 Handles mouse press events.
 
virtual void mouseReleaseEvent (QMouseEvent *event) override
 Handles mouse release events.
 
virtual void mouseMoveEvent (QMouseEvent *event) override
 Handles mouse move events.
 
virtual void resizeEvent (QResizeEvent *event) override
 Handles resize events.
 
virtual void keyPressEvent (QKeyEvent *event) override
 Handles key press events.
 
virtual void focusInEvent (QFocusEvent *event) override
 Handles focus in events.
 

Detailed Description

The main packet list view for displaying captured packets.

Member Enumeration Documentation

◆ SummaryCopyType

Types of formats available for copying packet summaries.

Enumerator
CopyAsText 

Copy summary as plain text.

CopyAsCSV 

Copy summary as Comma-Separated Values (CSV).

CopyAsYAML 

Copy summary as YAML format.

CopyAsHTML 

Copy summary as HTML format.

Constructor & Destructor Documentation

◆ PacketList()

PacketList::PacketList ( QWidget *  parent = 0)
explicit

Constructs a new PacketList object.

Parameters
parentThe parent widget.

Member Function Documentation

◆ addPacketComment()

void PacketList::addPacketComment ( QString  new_comment)

Adds a new comment to the currently selected packet.

Parameters
new_commentThe comment text to add.

◆ allPacketComments()

QString PacketList::allPacketComments ( )

Retrieves all packet comments in the capture.

Returns
A QString containing all comments.

◆ colorizeMenu()

QMenu * PacketList::colorizeMenu ( )
inline

Retrieves the colorize menu.

Returns
A pointer to the colorize QMenu.

◆ contextMenuActive()

bool PacketList::contextMenuActive ( )

Checks if the context menu is currently active.

Returns
True if active, false otherwise.

◆ contextMenuEvent()

void PacketList::contextMenuEvent ( QContextMenuEvent *  event)
overrideprotectedvirtual

Handles context menu events.

Parameters
eventThe context menu event.

◆ conversationMenu()

QMenu * PacketList::conversationMenu ( )
inline

Retrieves the conversation menu.

Returns
A pointer to the conversation QMenu.

◆ createAlignmentPartsForAligned()

QList< int > PacketList::createAlignmentPartsForAligned ( )

Creates alignment parts for formatting.

Returns
A list of alignment sizes.

◆ createClosingTagForHtml()

QString PacketList::createClosingTagForHtml ( )

Creates the closing tag block for HTML summaries.

Returns
A QString containing HTML closing tags.

◆ createDefaultStyleForHtml()

QString PacketList::createDefaultStyleForHtml ( )

Retrieves the default CSS style for HTML summaries.

Returns
A QString containing the style string.

◆ createHeaderPartsForAligned()

QStringList PacketList::createHeaderPartsForAligned ( )

Creates string parts for aligned headers.

Returns
A QStringList of header parts.

◆ createHeaderSummaryForAligned()

QString PacketList::createHeaderSummaryForAligned ( QStringList  hdr_parts,
QList< int >  align_parts,
QList< int >  size_parts 
)

Creates an aligned header summary.

Parameters
hdr_partsThe header parts.
align_partsThe alignment parts.
size_partsThe size parts.
Returns
A QString containing the aligned header summary.

◆ createHeaderSummaryForHtml()

QString PacketList::createHeaderSummaryForHtml ( )

Creates the HTML header summary.

Returns
A QString containing the HTML header row.

◆ createHeaderSummaryText()

QString PacketList::createHeaderSummaryText ( SummaryCopyType  type)

Creates the header summary text.

Parameters
typeThe format type for the summary.
Returns
A QString containing the formatted header.

◆ createOpeningTagForHtml()

QString PacketList::createOpeningTagForHtml ( )

Creates the opening tag block for HTML summaries.

Returns
A QString containing HTML opening tags.

◆ createSizePartsForAligned()

QList< int > PacketList::createSizePartsForAligned ( bool  useHeader,
QStringList  hdr_parts,
QList< int >  rows 
)

Creates size parts for aligned formatting.

Parameters
useHeaderTrue to include the header in size calculation.
hdr_partsThe header parts.
rowsThe list of rows to evaluate.
Returns
A list of sizes.

◆ createSummaryForAligned()

QString PacketList::createSummaryForAligned ( QModelIndex  idx,
QList< int >  align_parts,
QList< int >  size_parts 
)

Creates an aligned summary for a specific index.

Parameters
idxThe model index.
align_partsThe alignment parts.
size_partsThe size parts.
Returns
A QString containing the aligned summary.

◆ createSummaryForHtml()

QString PacketList::createSummaryForHtml ( QModelIndex  idx)

Creates an HTML summary for a specific index.

Parameters
idxThe model index.
Returns
A QString containing the HTML summary row.

◆ createSummaryText()

QString PacketList::createSummaryText ( QModelIndex  idx,
SummaryCopyType  type 
)

Creates a summary text for a specific index.

Parameters
idxThe model index.
typeThe format type for the summary.
Returns
A QString containing the formatted summary.

◆ drawRow

void PacketList::drawRow ( QPainter *  painter,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
overrideprotectedvirtualslot

Custom drawing logic for a row.

Parameters
painterThe painter object.
optionThe style option.
indexThe model index.

◆ editColumn

void PacketList::editColumn ( int  column)
signal

Signal emitted to trigger editing for a specific column.

Parameters
columnThe column index to edit.

◆ editProtocolPreference

void PacketList::editProtocolPreference ( pref_t pref,
module_t module 
)
signal

Signal emitted to edit a specific protocol preference.

Parameters
prefPointer to the preference to edit.
modulePointer to the related module.

◆ fieldsChanged

void PacketList::fieldsChanged ( capture_file cf)
slot

Slot triggered when global fields configuration changes.

Parameters
cfPointer to the capture file.

◆ fieldSelected

void PacketList::fieldSelected ( FieldInformation finfo)
signal

Signal emitted when a specific field is selected.

Parameters
finfoPointer to the selected field information.

◆ focusInEvent()

void PacketList::focusInEvent ( QFocusEvent *  event)
overrideprotectedvirtual

Handles focus in events.

Parameters
eventThe focus event.

◆ framesSelected

void PacketList::framesSelected ( QList< int >  frames)
signal

Signal emitted when multiple frames are selected.

Parameters
framesList of selected frame numbers.

◆ freeze()

bool PacketList::freeze ( bool  keep_current_frame = false)

Disable and clear the packet list.

Parameters
keep_current_frameIf true, keep the selected frame. Disable packet list widget updates, clear the detail and byte views, and disconnect the model.
Returns
True if successfully frozen, false otherwise.

◆ freezePacketList

void PacketList::freezePacketList ( bool  changing_profile)
slot

Slot to trigger freezing the packet list state.

Parameters
changing_profileTrue if the freeze is due to a profile change.

◆ getFDataForRow()

frame_data * PacketList::getFDataForRow ( int  row) const

Retrieves the frame data for a specific row.

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

◆ getFilterFromRowAndColumn()

QString PacketList::getFilterFromRowAndColumn ( QModelIndex  idx)

Retrieves the filter string based on a given row and column.

Parameters
idxThe model index indicating the row and column.
Returns
A QString containing the filter.

◆ getPacketComment()

QString PacketList::getPacketComment ( unsigned  c_number)

Retrieves the comment for a specific packet.

Parameters
c_numberThe frame number of the packet.
Returns
A QString containing the packet's comment.

◆ goToPacket

void PacketList::goToPacket ( int  packet,
int  hf_id = -1 
)
slot

Jumps directly to a specific packet number.

Parameters
packetThe packet number to go to.
hf_idOptional header field id to highlight.

◆ haveNextHistory()

bool PacketList::haveNextHistory ( bool  update_cur = false)

Checks if there is a next packet in the selection history.

Parameters
update_curTrue to update the current history pointer.
Returns
True if a next history item exists, false otherwise.

◆ havePreviousHistory()

bool PacketList::havePreviousHistory ( bool  update_cur = false)

Checks if there is a previous packet in the selection history.

Parameters
update_curTrue to update the current history pointer.
Returns
True if a previous history item exists, false otherwise.

◆ ignoreAllDisplayedFrames

void PacketList::ignoreAllDisplayedFrames ( bool  set)
slot

Ignores or un-ignores all displayed frames.

Parameters
setTrue to ignore all, false to un-ignore all.

◆ keyPressEvent()

void PacketList::keyPressEvent ( QKeyEvent *  event)
overrideprotectedvirtual

Handles key press events.

Parameters
eventThe key event.

◆ markAllDisplayedFrames

void PacketList::markAllDisplayedFrames ( bool  set)
slot

Marks or unmarks all displayed frames.

Parameters
setTrue to mark all, false to unmark all.

◆ mouseMoveEvent()

void PacketList::mouseMoveEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Handles mouse move events.

Parameters
eventThe mouse event.

◆ mousePressEvent()

void PacketList::mousePressEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Handles mouse press events.

Parameters
eventThe mouse event.

◆ mouseReleaseEvent()

void PacketList::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Handles mouse release events.

Parameters
eventThe mouse event.

◆ multiSelectActive()

bool PacketList::multiSelectActive ( )

Checks if multiple selections are currently active.

Returns
True if more than one item is selected.

◆ packetListScrolled

void PacketList::packetListScrolled ( bool  at_end)
signal

Signal emitted when the packet list has been scrolled.

Parameters
at_endTrue if the scroll position is at the very bottom.

◆ paintEvent()

void PacketList::paintEvent ( QPaintEvent *  event)
overrideprotected

Handles paint events.

Parameters
eventThe paint event.

◆ resizeAllColumns()

void PacketList::resizeAllColumns ( bool  onlyTimeFormatted = false)

Resizes all columns to fit their content.

Parameters
onlyTimeFormattedTrue to only resize time-formatted columns.

◆ resizeEvent()

void PacketList::resizeEvent ( QResizeEvent *  event)
overrideprotectedvirtual

Handles resize events.

Parameters
eventThe resize event.

◆ rowsInserted

void PacketList::rowsInserted ( const QModelIndex &  parent,
int  start,
int  end 
)
overrideprotectedslot

Slot triggered when rows are inserted into the model.

Parameters
parentThe parent model index.
startThe starting row index.
endThe ending row index.

◆ scrollTo()

void PacketList::scrollTo ( const QModelIndex &  index,
QAbstractItemView::ScrollHint  hint = EnsureVisible 
)
overridevirtual

Scrolls the view to the given index.

Parameters
indexThe model index to scroll to.
hintThe scroll hint to use.

◆ selectedRows()

QList< int > PacketList::selectedRows ( bool  useFrameNum = false)

Retrieves a list of selected row numbers.

Parameters
useFrameNumTrue to return frame numbers instead of row indices.
Returns
A list of integer row or frame numbers.

◆ selectionChanged()

void PacketList::selectionChanged ( const QItemSelection &  selected,
const QItemSelection &  deselected 
)
overrideprotected

Handles selection change events.

Parameters
selectedThe newly selected items.
deselectedThe newly deselected items.

◆ setCaptureFile

void PacketList::setCaptureFile ( capture_file cf)
slot

Sets the active capture file.

Parameters
cfPointer to the capture file.

◆ setCaptureInProgress()

void PacketList::setCaptureInProgress ( bool  in_progress = false,
bool  auto_scroll = true 
)
inline

Sets the capture in progress state.

Parameters
in_progressTrue if a capture is running, false otherwise.
auto_scrollTrue to enable auto-scrolling during capture.

◆ setMonospaceFont

void PacketList::setMonospaceFont ( const QFont &  mono_font)
slot

Sets the monospace font used in the list.

Parameters
mono_fontThe chosen monospace font.

◆ setPacketComment()

void PacketList::setPacketComment ( unsigned  c_number,
QString  new_comment 
)

Sets the comment for a specific packet.

Parameters
c_numberThe frame number of the packet.
new_commentThe comment text to set.

◆ setProfileSwitcher()

void PacketList::setProfileSwitcher ( ProfileSwitcher profile_switcher)

Sets the profile switcher for the packet list.

Parameters
profile_switcherPointer to the profile switcher.

◆ setProtoTree()

void PacketList::setProtoTree ( ProtoTree proto_tree)

Sets the protocol tree.

Parameters
proto_treePointer to the protocol tree.

◆ setRegularFont

void PacketList::setRegularFont ( const QFont &  regular_font)
slot

Sets the regular font used in the list.

Parameters
regular_fontThe chosen regular font.

◆ setVerticalAutoScroll()

void PacketList::setVerticalAutoScroll ( bool  enabled = true)

Enables or disables vertical auto-scrolling.

Parameters
enabledTrue to enable auto-scrolling, false to disable.

◆ showColumnPreferences

void PacketList::showColumnPreferences ( QString  pane_name)
signal

Signal emitted to show preferences for a specific pane.

Parameters
pane_nameThe name of the preferences pane.

◆ showProtocolPreferences

void PacketList::showProtocolPreferences ( const QString  module_name)
signal

Signal emitted to show protocol specific preferences.

Parameters
module_nameThe protocol module name.

◆ thaw()

bool PacketList::thaw ( bool  restore_selection = false)

Enable and restore the packet list.

Enable packet list widget updates and reconnect the model.

Parameters
restore_selectionIf true, redissect the previously selected packet. This includes filling in the detail and byte views.
Returns
True if successfully thawed, false otherwise.

◆ timerEvent()

void PacketList::timerEvent ( QTimerEvent *  event)
overrideprotected

Handles timer events.

Parameters
eventThe timer event.

◆ uniqueSelectActive()

bool PacketList::uniqueSelectActive ( )

Checks if a single unique selection is currently active.

Returns
True if exactly one item is selected.

◆ writeRecent()

void PacketList::writeRecent ( FILE *  rf)

Writes recent configuration to a file.

Parameters
rfThe file pointer to write to.

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