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

Tap data model for the Conversations statistics dialog. More...

#include <atap_data_model.h>

Inheritance diagram for ConversationDataModel:
ATapDataModel

Public Types

enum  conversation_column_type_e {
  CONV_COLUMN_SRC_ADDR , CONV_COLUMN_SRC_PORT , CONV_COLUMN_DST_ADDR , CONV_COLUMN_DST_PORT ,
  CONV_COLUMN_PACKETS , CONV_COLUMN_BYTES , CONV_COLUMN_CONV_ID , CONV_COLUMN_PACKETS_TOTAL ,
  CONV_COLUMN_BYTES_TOTAL , CONV_COLUMN_PKT_AB , CONV_COLUMN_BYTES_AB , CONV_COLUMN_PKT_BA ,
  CONV_COLUMN_BYTES_BA , CONV_COLUMN_START , CONV_COLUMN_DURATION , CONV_COLUMN_BPS_AB ,
  CONV_COLUMN_BPS_BA , CONV_NUM_COLUMNS , CONV_INDEX_COLUMN = CONV_NUM_COLUMNS
}
 Column indices for the standard conversation statistics table. More...
 
enum  conversation_tcp_ext_column_type_e { CONV_TCP_EXT_COLUMN_A = CONV_INDEX_COLUMN , CONV_TCP_EXT_NUM_COLUMNS , CONV_TCP_EXT_INDEX_COLUMN = CONV_TCP_EXT_NUM_COLUMNS }
 Additional column indices for the TCP extended column block. More...
 
- Public Types inherited from ATapDataModel
enum  {
  DISPLAY_FILTER = Qt::UserRole , UNFORMATTED_DISPLAYDATA , TIMELINE_DATA , ENDPOINT_DATATYPE ,
  PROTO_ID , CONVERSATION_ID , ROW_IS_FILTERED , DATA_ADDRESS_TYPE ,
  DATA_IPV4_INTEGER , DATA_IPV6_LIST
}
 Qt model data roles for endpoint and conversation table items. More...
 
enum  dataModelType { DATAMODEL_ENDPOINT , DATAMODEL_CONVERSATION , DATAMODEL_UNKNOWN }
 Identifies which statistical data model is active in the endpoint/conversation dialog. More...
 

Public Member Functions

 ConversationDataModel (int protoId, QString filter, QObject *parent=nullptr)
 Construct a ConversationDataModel for a given protocol and filter.
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 Return the number of columns, including any TCP extended columns.
 
QVariant headerData (int section, Qt::Orientation orientation=Qt::Horizontal, int role=Qt::DisplayRole) const override
 Return header data for the conversation table.
 
QVariant data (const QModelIndex &idx, int role=Qt::DisplayRole) const override
 Return data for a cell in the conversation table.
 
void doDataUpdate ()
 Recalculate derived values (throughput, duration) after a tap update.
 
conv_item_titemForRow (int row)
 Return the raw conv_item_t for a given table row.
 
bool showConversationId (int row=0) const
 Return whether a conversation ID column should be shown.
 
void setResolveNames (bool resolve) override
 Enable or disable address name resolution for all address cells.
 
void useAbsoluteTime (bool absolute) override
 Switch timestamp display between absolute and relative time.
 
void useNanosecondTimestamps (bool nanoseconds) override
 Enable or disable nanosecond precision in timestamp display.
 
- Public Member Functions inherited from ATapDataModel
 ATapDataModel (dataModelType type, int protoId, QString filter, QObject *parent=nullptr)
 Construct a new ATapDataModel object.
 
virtual ~ATapDataModel ()
 Destructor.
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 Number of rows under the given parent in this model, which is the total number of rows for the empty QModelIndex, and 0 for any valid parent index (as no row has children; this is a flat table.)
 
QString tap () const
 Returns the name for the tap being used.
 
int protoId () const
 The protocol id for the tap.
 
void setFilter (QString filter)
 Set the filter string.
 
QString filter () const
 Return a filter set for the model.
 
bool resolveNames () const
 Is the model set to resolve names in address and ports columns.
 
bool allowsNameResolution () const
 Does the model allow names to be resolved.
 
void setMachineReadable (bool machineReadable)
 Sets whether the data should be presented in a machine-readable format.
 
void limitToDisplayFilter (bool limit)
 Limits the data model to the currently active display filter.
 
bool portsAreHidden () const
 Are ports hidden for this model.
 
bool isFilterApplied () const
 Checks if a display filter has to be applied.
 
bool enableTap ()
 Enable tapping in this model.
 
void disableTap ()
 Disable the tapping for this model.
 
dataModelType modelType () const
 Return the model type.
 
conv_hash_thash ()
 Return the conversation hash table for this model.
 
void updateFlags (unsigned flag)
 Update the flags.
 

Additional Inherited Members

- Signals inherited from ATapDataModel
void tapListenerChanged (bool enable)
 Signal emitted when the tap listener state changes.
 
- Public Attributes inherited from ATapDataModel
conv_hash_t hash_
 
- Protected Member Functions inherited from ATapDataModel
virtual tap_packet_cb conversationPacketHandler ()
 Retrieves the callback function used to handle conversation packets.
 
void resetData ()
 Resets the internal model data.
 
void updateData (GArray *data)
 Updates the model with new data.
 
register_ct_tregisterTable () const
 Gets the conversation registration table for this tap.
 
- Static Protected Member Functions inherited from ATapDataModel
static void tapReset (void *tapdata)
 Callback to reset the tap data.
 
static void tapDraw (void *tap_data)
 Callback to draw or update the tap data.
 
- Protected Attributes inherited from ATapDataModel
dataModelType _type
 
GArray * storage_
 
QString _filter
 
bool _absoluteTime
 
bool _nanoseconds
 
bool _resolveNames
 
bool _machineReadable
 
bool _disableTap
 
double _minRelStartTime
 
double _maxRelStopTime
 
unsigned _tapFlags
 

Detailed Description

Tap data model for the Conversations statistics dialog.

Collects per-conversation traffic statistics via the ATapDataModel tap infrastructure and exposes them as a table with address, port, packet count, byte count, timing, and throughput columns. An optional extended TCP column block is appended when the selected protocol is TCP.

Member Enumeration Documentation

◆ conversation_column_type_e

Column indices for the standard conversation statistics table.

CONV_INDEX_COLUMN is a virtual column (equal to CONV_NUM_COLUMNS) used to store the internal conversation index and is never displayed.

Enumerator
CONV_COLUMN_SRC_ADDR 

Source address.

CONV_COLUMN_SRC_PORT 

Source port (transport protocols only).

CONV_COLUMN_DST_ADDR 

Destination address.

CONV_COLUMN_DST_PORT 

Destination port (transport protocols only).

CONV_COLUMN_PACKETS 

Total packets in the filtered set.

CONV_COLUMN_BYTES 

Total bytes in the filtered set.

CONV_COLUMN_CONV_ID 

Protocol-assigned conversation identifier.

CONV_COLUMN_PACKETS_TOTAL 

Total packets across all traffic.

CONV_COLUMN_BYTES_TOTAL 

Total bytes across all traffic.

CONV_COLUMN_PKT_AB 

Packets from source to destination.

CONV_COLUMN_BYTES_AB 

Bytes from source to destination.

CONV_COLUMN_PKT_BA 

Packets from destination to source.

CONV_COLUMN_BYTES_BA 

Bytes from destination to source.

CONV_COLUMN_START 

Timestamp of the first packet in the conversation.

CONV_COLUMN_DURATION 

Duration of the conversation.

CONV_COLUMN_BPS_AB 

Throughput (bits/s) from source to destination.

CONV_COLUMN_BPS_BA 

Throughput (bits/s) from destination to source.

CONV_NUM_COLUMNS 

Total number of standard columns.

CONV_INDEX_COLUMN 

Virtual index column (not displayed).

◆ conversation_tcp_ext_column_type_e

Additional column indices for the TCP extended column block.

These columns are appended after CONV_INDEX_COLUMN when the selected protocol is TCP.

Enumerator
CONV_TCP_EXT_COLUMN_A 

First TCP extended column.

CONV_TCP_EXT_NUM_COLUMNS 

Total columns including TCP extensions.

CONV_TCP_EXT_INDEX_COLUMN 

Virtual index for TCP ext block.

Constructor & Destructor Documentation

◆ ConversationDataModel()

ConversationDataModel::ConversationDataModel ( int  protoId,
QString  filter,
QObject *  parent = nullptr 
)
explicit

Construct a ConversationDataModel for a given protocol and filter.

Parameters
protoIdThe protocol ID whose conversation tap should be registered.
filterOptional display filter string; empty means no filter.
parentThe parent QObject.

Member Function Documentation

◆ columnCount()

int ConversationDataModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
overridevirtual

Return the number of columns, including any TCP extended columns.

Parameters
parentUnused; present for API compatibility.
Returns
The total column count for the active protocol.

Implements ATapDataModel.

◆ data()

QVariant ConversationDataModel::data ( const QModelIndex &  idx,
int  role = Qt::DisplayRole 
) const
overridevirtual

Return data for a cell in the conversation table.

Parameters
idxThe model index of the cell to query.
roleThe data role (Qt::DisplayRole, Qt::UserRole, etc.).
Returns
The cell data, or an invalid QVariant if unavailable.

Implements ATapDataModel.

◆ doDataUpdate()

void ConversationDataModel::doDataUpdate ( )

Recalculate derived values (throughput, duration) after a tap update.

Called after the tap has finished processing a batch of packets to update computed columns such as CONV_COLUMN_BPS_AB and CONV_COLUMN_DURATION.

◆ headerData()

QVariant ConversationDataModel::headerData ( int  section,
Qt::Orientation  orientation = Qt::Horizontal,
int  role = Qt::DisplayRole 
) const
overridevirtual

Return header data for the conversation table.

Parameters
sectionColumn index.
orientationMust be Qt::Horizontal.
roleThe data role; typically Qt::DisplayRole.
Returns
The column header label, or an invalid QVariant if unavailable.

Implements ATapDataModel.

◆ itemForRow()

conv_item_t * ConversationDataModel::itemForRow ( int  row)

Return the raw conv_item_t for a given table row.

Parameters
rowZero-based row index.
Returns
A pointer to the conv_item_t for row, or nullptr if row is out of range.

◆ setResolveNames()

void ConversationDataModel::setResolveNames ( bool  resolve)
overridevirtual

Enable or disable address name resolution for all address cells.

Parameters
resolvetrue to resolve addresses to hostnames; false to show raw addresses.

Implements ATapDataModel.

◆ showConversationId()

bool ConversationDataModel::showConversationId ( int  row = 0) const

Return whether a conversation ID column should be shown.

The conversation ID column is only meaningful for protocols that assign explicit conversation identifiers (e.g. stream index for TCP).

Parameters
rowZero-based row index used to probe the data; defaults to 0.
Returns
true if a valid conversation ID is available for row.

◆ useAbsoluteTime()

void ConversationDataModel::useAbsoluteTime ( bool  absolute)
overridevirtual

Switch timestamp display between absolute and relative time.

Parameters
absolutetrue for absolute (wall-clock) timestamps; false for relative timestamps.

Implements ATapDataModel.

◆ useNanosecondTimestamps()

void ConversationDataModel::useNanosecondTimestamps ( bool  nanoseconds)
overridevirtual

Enable or disable nanosecond precision in timestamp display.

Parameters
nanosecondstrue to show nanosecond-resolution timestamps; false for microsecond resolution.

Implements ATapDataModel.


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