| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
DecodeAsModel Class Reference

Table model backing the Decode As dialog. More...

`#include <decode_as_model.h>`

Inheritance diagram for DecodeAsModel:

## Classes
struct | UIntEntry
| A pending change to a uint-keyed dissector table entry. More...

## Public Types
enum | DecodeAsColumn { colTable = 0 , colSelector , colType , colDefault , colProtocol , colDecodeAsMax }
| Column indices for the Decode As table. More...

## Public Member Functions
| DecodeAsModel (QObject *parent, capture_file *cf=NULL)
| Construct a DecodeAsModel.
virtual | ~DecodeAsModel ()
| Destroy the DecodeAsModel.
Qt::ItemFlags | flags (const QModelIndex &index) const override
| Return the item flags for the given index.
QVariant | data (const QModelIndex &index, int role) const override
| Return data for the given index and role.
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
| Return header data for the given section, orientation, and role.
int | rowCount (const QModelIndex &parent=QModelIndex()) const override
| Return the number of rows in the model.
int | columnCount (const QModelIndex &parent=QModelIndex()) const override
| Return the number of columns in the model.
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
| Set data for the given index and role.
void | fillTable ()
| Populate the model from the current decode-as configuration.
void | setDissectorHandle (const QModelIndex &index, dissector_handle_t dissector_handle)
| Set the dissector handle for the entry at the given index.
bool | insertRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
| Insert rows into the model.
bool | removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
| Remove rows from the model.
void | clearAll ()
| Remove all decode-as entries from the model.
bool | copyRow (int dst_row, int src_row)
| Copy a row within the model.
bool | copyFromProfile (QString filename, const char **err)
| Import decode-as entries from a Wireshark profile file.
void | applyChanges ()
| Apply all pending decode-as changes to the dissector tables.

## Static Public Member Functions
static QString | entryString (const char *table_name, const void *value)
| Return a human-readable string describing a dissector table entry.

## Static Protected Member Functions
static void | buildChangedList (const char *table_name, ftenum_t selector_type, void *key, void *value, void *user_data)
| Callback to record a changed uint or string dissector table entry.
static void | buildDceRpcChangedList (void *data, void *user_data)
| Callback to record a changed DCE/RPC dissector table entry.
static void | gatherChangedEntries (const char *table_name, ftenum_t selector_type, void *key, void *value, void *user_data)
| Callback to collect entries that differ from their defaults.
static prefs_set_pref_e | readDecodeAsEntry (char *key, const char *value, void *user_data, bool)
| Callback to parse and apply a single decode-as preference entry.

## Detailed Description

Table model backing the Decode As dialog.

Manages the list of `DecodeAsItem` entries that map dissector table selectors to user-chosen dissectors, and provides methods to apply, import, and reset those mappings.

## Member Enumeration Documentation

## ◆ DecodeAsColumn

enum DecodeAsModel::DecodeAsColumn

Column indices for the Decode As table.

Enumerator
colTable | The dissector table (aka "Field", e.g. "TCP Port").
colSelector | The selector value (e.g., port number 80).
colType | The field type (e.g. "Integer, base 16").
colDefault | The initial protocol chosen by Wireshark.
colProtocol | The current protocol selected by the user.
colDecodeAsMax | Sentinel value; not used as a column.

## Constructor & Destructor Documentation

## ◆ DecodeAsModel()

DecodeAsModel::DecodeAsModel | ( | QObject * | parent,
|  | capture_file * | cf = NULL )

Construct a DecodeAsModel.

Parameters

  parent | The parent object.
  cf | The capture file, or NULL if none is open.

## Member Function Documentation

## ◆ buildChangedList()

void DecodeAsModel::buildChangedList | ( | const char * | table_name,
|  | ftenum_t | selector_type,
|  | void * | key,
|  | void * | value,
|  | void * | user_data )
| static protected

Callback to record a changed uint or string dissector table entry.

Parameters

  table_name | The dissector table name.
  selector_type | The field type of the selector.
  key | The selector key.
  value | The dissector handle value.
  user_data | Pointer to the `DecodeAsModel` instance.

## ◆ buildDceRpcChangedList()

void DecodeAsModel::buildDceRpcChangedList | ( | void * | data,
|  | void * | user_data )
| static protected

Callback to record a changed DCE/RPC dissector table entry.

Parameters

  data | The DCE/RPC bind values.
  user_data | Pointer to the `DecodeAsModel` instance.

## ◆ columnCount()

int DecodeAsModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const
| override

Return the number of columns in the model.

Parameters

  parent | Unused; present for API compatibility.

Returns
  The number of columns.

## ◆ copyFromProfile()

bool DecodeAsModel::copyFromProfile | ( | QString | filename,
|  | const char ** | err )

Import decode-as entries from a Wireshark profile file.

Parameters

  filename | The path to the profile file.
  err | Output pointer for an error message on failure.

Returns
  true if the import succeeded, false otherwise.

## ◆ copyRow()

bool DecodeAsModel::copyRow | ( | int | dst_row,
|  | int | src_row )

Copy a row within the model.

Parameters

  dst_row | The destination row index.
  src_row | The source row index.

Returns
  true if the row was copied successfully.

## ◆ data()

QVariant DecodeAsModel::data | ( | const QModelIndex & | index,
|  | int | role ) const
| override

Return data for the given index and role.

Parameters

  index | The model index to query.
  role | The data role.

Returns
  The data, or an invalid `QVariant` if unsupported.

## ◆ entryString()

QString DecodeAsModel::entryString | ( | const char * | table_name,
|  | const void * | value )
| static

Return a human-readable string describing a dissector table entry.

Parameters

  table_name | The dissector table name.
  value | The selector value.

Returns
  A display string for the entry.

## ◆ flags()

Qt::ItemFlags DecodeAsModel::flags | ( | const QModelIndex & | index | ) | const
| override

Return the item flags for the given index.

Parameters

  index | The model index to query.

Returns
  The item flags.

## ◆ gatherChangedEntries()

void DecodeAsModel::gatherChangedEntries | ( | const char * | table_name,
|  | ftenum_t | selector_type,
|  | void * | key,
|  | void * | value,
|  | void * | user_data )
| static protected

Callback to collect entries that differ from their defaults.

Parameters

  table_name | The dissector table name.
  selector_type | The field type of the selector.
  key | The selector key.
  value | The dissector handle value.
  user_data | Pointer to the `DecodeAsModel` instance.

## ◆ headerData()

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

Return header data for the given section, orientation, and role.

Parameters

  section | The section index.
  orientation | The header orientation.
  role | The data role.

Returns
  The header data, or an invalid `QVariant` if unsupported.

## ◆ insertRows()

bool DecodeAsModel::insertRows | ( | int | row,
|  | int | count,
|  | const QModelIndex & | parent = QModelIndex() )
| override

Insert rows into the model.

Parameters

  row | The row before which to insert.
  count | The number of rows to insert.
  parent | Unused; present for API compatibility.

Returns
  true if the rows were inserted successfully.

## ◆ readDecodeAsEntry()

prefs_set_pref_e DecodeAsModel::readDecodeAsEntry | ( | char * | key,
|  | const char * | value,
|  | void * | user_data,
|  | bool | )
| static protected

Callback to parse and apply a single decode-as preference entry.

Parameters

  key | The preference key string.
  value | The preference value string.
  user_data | Pointer to the `DecodeAsModel` instance.

Returns
  The result of the preference set operation.

## ◆ removeRows()

bool DecodeAsModel::removeRows | ( | int | row,
|  | int | count,
|  | const QModelIndex & | parent = QModelIndex() )
| override

Remove rows from the model.

Parameters

  row | The first row to remove.
  count | The number of rows to remove.
  parent | Unused; present for API compatibility.

Returns
  true if the rows were removed successfully.

## ◆ rowCount()

int DecodeAsModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const
| override

Return the number of rows in the model.

Parameters

  parent | Unused; present for API compatibility.

Returns
  The number of decode-as entries.

## ◆ setData()

bool DecodeAsModel::setData | ( | const QModelIndex & | index,
|  | const QVariant & | value,
|  | int | role = Qt::EditRole )
| override

Set data for the given index and role.

Parameters

  index | The model index to update.
  value | The new value.
  role | The data role.

Returns
  true if the data was set successfully, false otherwise.

## ◆ setDissectorHandle()

void DecodeAsModel::setDissectorHandle | ( | const QModelIndex & | index,
|  | dissector_handle_t | dissector_handle )

Set the dissector handle for the entry at the given index.

Parameters

  index | The model index of the entry to update.
  dissector_handle | The dissector handle to assign.

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

- /builds/wireshark/wireshark/ui/qt/models/decode_as_model.h
- /builds/wireshark/wireshark/ui/qt/models/decode_as_model.cpp