Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
ATapDataModel Class Referenceabstract

DataModel for tap user data. More...

#include <atap_data_model.h>

Inheritance diagram for ATapDataModel:
ConversationDataModel EndpointDataModel

Public Types

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...

Signals

void tapListenerChanged (bool enable)
 Signal emitted when the tap listener state changes.

Public Member Functions

 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 override
 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.).
virtual int columnCount (const QModelIndex &parent=QModelIndex()) const override=0
 Return the number of columns in the model.
virtual QVariant headerData (int section, Qt::Orientation orientation=Qt::Horizontal, int role=Qt::DisplayRole) const override=0
 Return the header data for the specified section and orientation.
virtual QVariant data (const QModelIndex &idx, int role=Qt::DisplayRole) const override=0
 Return the data for the specified index and role.
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.
virtual void setResolveNames (bool resolve)=0
 Enable or disable if names should be resolved.
bool allowsNameResolution () const
 Does the model allow names to be resolved.
virtual void useAbsoluteTime (bool absolute)=0
 Use absolute time for any column supporting it.
virtual void useNanosecondTimestamps (bool nanoseconds)=0
 Use nanosecond timestamps if requested.
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.

Public Attributes

conv_hash_t hash_

Protected Member Functions

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

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

dataModelType _type
GArray * storage_
QString _filter
bool _absoluteTime
bool _nanoseconds
bool _resolveNames
bool _machineReadable
bool _disableTap
double _minRelStartTime
double _maxRelStopTime
unsigned _tapFlags

Detailed Description

DataModel for tap user data.

This datamodel provides the management for all tap data for the conversation and endpoint dialogs. It predominantly is implemented to work with conversation tap data. The management of displaying and correctly presenting the information is done in the corresponding type classes

See also
EndpointDataModel
ConversationDataModel

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Qt model data roles for endpoint and conversation table items.

Enumerator
DISPLAY_FILTER 

Display filter string constructed from this row's address/port data

UNFORMATTED_DISPLAYDATA 

Raw, unformatted cell value used for sorting and clipboard export

TIMELINE_DATA 

Timing data used to render the traffic timeline bar in the row

ENDPOINT_DATATYPE 

Endpoint address type tag (e.g. IPv4, IPv6, Ethernet)

PROTO_ID 

Protocol ID (proto_id) associated with this endpoint or conversation

CONVERSATION_ID 

Unique conversation identifier for this row

ROW_IS_FILTERED 

True if this row is currently hidden by the active display filter

DATA_ADDRESS_TYPE 

Address type enum value (address_type) for the primary address

DATA_IPV4_INTEGER 

IPv4 address as a packed 32-bit integer, used for numeric sorting

DATA_IPV6_LIST 

IPv6 address as a byte list, used for numeric sorting

◆ dataModelType

Identifies which statistical data model is active in the endpoint/conversation dialog.

Enumerator
DATAMODEL_ENDPOINT 

Model is displaying per-endpoint traffic statistics

DATAMODEL_CONVERSATION 

Model is displaying per-conversation traffic statistics

DATAMODEL_UNKNOWN 

Model type has not been initialised or is unrecognised

Constructor & Destructor Documentation

◆ ATapDataModel()

ATapDataModel::ATapDataModel ( dataModelType type,
int protoId,
QString filter,
QObject * parent = nullptr )
explicit

Construct a new ATapDataModel object.

The tap will not be created automatically, but must be enabled by calling enableTap

Parameters
typean element of dataModelType. Either DATAMODEL_ENDPOINT or DATAMODEL_CONVERSATION are supported at this time
protoIdthe protocol id for which the tap is created
filtera potential filter to be used for the tap
parentthe parent for the class
See also
enableTap

Member Function Documentation

◆ allowsNameResolution()

bool ATapDataModel::allowsNameResolution ( ) const

Does the model allow names to be resolved.

Returns
true yes, names may be resolved (set via setResolveNames)
false no, they won't be resolved
See also
setResolveNames
resolveNames

◆ columnCount()

virtual int ATapDataModel::columnCount ( const QModelIndex & parent = QModelIndex()) const
overridepure virtual

Return the number of columns in the model.

Parameters
parentindex of parent, QModelIndex() for the root
Returns
int the number of columns under the parent

Implemented in ConversationDataModel, and EndpointDataModel.

◆ conversationPacketHandler()

tap_packet_cb ATapDataModel::conversationPacketHandler ( )
protectedvirtual

Retrieves the callback function used to handle conversation packets.

Returns
The tap packet callback function.

◆ data()

virtual QVariant ATapDataModel::data ( const QModelIndex & idx,
int role = Qt::DisplayRole ) const
overridepure virtual

Return the data for the specified index and role.

Parameters
idxThe model index.
roleThe data role.
Returns
QVariant The data for the specified index and role.

Implemented in ConversationDataModel, and EndpointDataModel.

◆ enableTap()

bool ATapDataModel::enableTap ( )

Enable tapping in this model.

This will register the tap listener with the corresponding packet function.

Note
if the tap has not been disabled, this method will do nothing
Returns
true the tap has been enabled
false the tap has not been enabled

◆ filter()

QString ATapDataModel::filter ( ) const

Return a filter set for the model.

Returns
QString the filter string for the model

◆ hash()

conv_hash_t * ATapDataModel::hash ( )

Return the conversation hash table for this model.

Returns
conv_hash_t * pointer to the hash table

◆ headerData()

virtual QVariant ATapDataModel::headerData ( int section,
Qt::Orientation orientation = Qt::Horizontal,
int role = Qt::DisplayRole ) const
overridepure virtual

Return the header data for the specified section and orientation.

Parameters
sectionThe column or row index.
orientationThe orientation of the header.
roleThe data role.
Returns
QVariant The header data.

Implemented in ConversationDataModel, and EndpointDataModel.

◆ isFilterApplied()

bool ATapDataModel::isFilterApplied ( ) const

Checks if a display filter has to be applied.

Controls which columns to display, and in some cases their content

Returns
true a display filter has to be applied
false no display filter has to be applied

◆ limitToDisplayFilter()

void ATapDataModel::limitToDisplayFilter ( bool limit)

Limits the data model to the currently active display filter.

Parameters
limitTrue to apply the display filter limit, false otherwise.

◆ modelType()

ATapDataModel::dataModelType ATapDataModel::modelType ( ) const

Return the model type.

Returns
dataModelType

◆ portsAreHidden()

bool ATapDataModel::portsAreHidden ( ) const

Are ports hidden for this model.

Returns
true the ports are hidden
false the ports are not hidden

◆ protoId()

int ATapDataModel::protoId ( ) const

The protocol id for the tap.

Returns
int the id given in the constructor

◆ registerTable()

register_ct_t * ATapDataModel::registerTable ( ) const
protected

Gets the conversation registration table for this tap.

Returns
Pointer to the register_ct_t table.

◆ resolveNames()

bool ATapDataModel::resolveNames ( ) const

Is the model set to resolve names in address and ports columns.

Returns
true yes, names will be resolved
false no they won't

◆ rowCount()

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

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.).

Parameters
parentindex of parent, QModelIndex() for the root
Returns
int the number of rows under the parent

◆ setFilter()

void ATapDataModel::setFilter ( QString filter)

Set the filter string.

A set filter can be reset by providing an empty string

Parameters
filterthe filter for the tap

◆ setMachineReadable()

void ATapDataModel::setMachineReadable ( bool machineReadable)

Sets whether the data should be presented in a machine-readable format.

Parameters
machineReadableTrue to enable machine-readable format, false otherwise.

◆ setResolveNames()

virtual void ATapDataModel::setResolveNames ( bool resolve)
pure virtual

Enable or disable if names should be resolved.

Parameters
resolvetrue if names should be resolved

Implemented in ConversationDataModel, and EndpointDataModel.

◆ tap()

QString ATapDataModel::tap ( ) const

Returns the name for the tap being used.

Returns
QString the tap name, normally identical with the protocol name

◆ tapDraw()

void ATapDataModel::tapDraw ( void * tap_data)
staticprotected

Callback to draw or update the tap data.

Parameters
tap_dataPointer to the tap data to draw.

◆ tapListenerChanged

void ATapDataModel::tapListenerChanged ( bool enable)
signal

Signal emitted when the tap listener state changes.

Parameters
enableTrue to enable the listener, false to disable.

◆ tapReset()

void ATapDataModel::tapReset ( void * tapdata)
staticprotected

Callback to reset the tap data.

Parameters
tapdataPointer to the tap data to reset.

◆ updateData()

void ATapDataModel::updateData ( GArray * data)
protected

Updates the model with new data.

Parameters
dataPointer to a GArray containing the new data.

◆ useAbsoluteTime()

virtual void ATapDataModel::useAbsoluteTime ( bool absolute)
pure virtual

Use absolute time for any column supporting it.

Parameters
absolutetrue to use absolute time values

Implemented in ConversationDataModel, and EndpointDataModel.

◆ useNanosecondTimestamps()

virtual void ATapDataModel::useNanosecondTimestamps ( bool nanoseconds)
pure virtual

Use nanosecond timestamps if requested.

Otherwise, microsecond time resolution will be displayed

Parameters
nanosecondsuse nanosecond timestamps if required and requested

Implemented in ConversationDataModel, and EndpointDataModel.

Member Data Documentation

◆ _absoluteTime

bool ATapDataModel::_absoluteTime
protected

Flag indicating whether to use absolute time formats.

◆ _disableTap

bool ATapDataModel::_disableTap
protected

Flag indicating whether the underlying tap is disabled.

◆ _filter

QString ATapDataModel::_filter
protected

The display filter applied to the tap.

◆ _machineReadable

bool ATapDataModel::_machineReadable
protected

Flag indicating whether data is formatted for machine readability.

◆ _maxRelStopTime

double ATapDataModel::_maxRelStopTime
protected

The maximum relative stop time of the processed packets.

◆ _minRelStartTime

double ATapDataModel::_minRelStartTime
protected

The minimum relative start time of the processed packets.

◆ _nanoseconds

bool ATapDataModel::_nanoseconds
protected

Flag indicating whether to use nanosecond precision.

◆ _resolveNames

bool ATapDataModel::_resolveNames
protected

Flag indicating whether name resolution is enabled.

◆ _tapFlags

unsigned ATapDataModel::_tapFlags
protected

Bitmask of flags configuring the tap behavior.

◆ _type

dataModelType ATapDataModel::_type
protected

The specific type of the data model.

◆ hash_

conv_hash_t ATapDataModel::hash_

Hash table mapping address/port tuples to their conversation or endpoint entries

◆ storage_

GArray* ATapDataModel::storage_
protected

Internal storage for the tap data records.


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