Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
ColoringRuleUtils Class Reference

Coloring rule lookups for the Qt views. More...

#include <coloring_rule_utils.h>

Static Public Member Functions

static bool entryForNode (const ProtoNode *node, ColoringRuleEntry *entry)
 Resolves the coloring rule entry a Frame tree item belongs to.
static bool isDisabledEntryItem (const ProtoNode *node)
 Tells whether a Frame tree item belongs to a disabled rule's entry.
static bool setRuleEnabled (const ColoringRuleEntry &entry, bool enabled, QString *err)
 Enables or disables the rule of an entry and saves the rule list.
static QList< ColoringRuleColors > matchColors (const PacketListRecord *record)
 Colors a packet list record is drawn with.

Detailed Description

Coloring rule lookups for the Qt views.

Views and models ask here instead of reading color_filter_t, the Frame dissector's coloring rule fields or the rule list themselves.

Member Function Documentation

◆ entryForNode()

bool ColoringRuleUtils::entryForNode ( const ProtoNode * node,
ColoringRuleEntry * entry )
static

Resolves the coloring rule entry a Frame tree item belongs to.

Handles both shapes the Frame dissector produces: one entry as flat name / string / disabled items, several entries as name items holding their string and disabled items as children.

Parameters
nodeTree item of the packet details model; may be nullptr.
entryFilled when the item belongs to an entry.
Returns
true if node is a name, string or disabled item of an entry.

◆ isDisabledEntryItem()

bool ColoringRuleUtils::isDisabledEntryItem ( const ProtoNode * node)
static

Tells whether a Frame tree item belongs to a disabled rule's entry.

Parameters
nodeTree item of the packet details model; may be nullptr.
Returns
true if the item's entry has a frame.coloring_rule.disabled item.

◆ matchColors()

QList< ColoringRuleColors > ColoringRuleUtils::matchColors ( const PacketListRecord * record)
static

Colors a packet list record is drawn with.

One entry per matching rule in match order; the first is the rule that colors the packet. A packet colored by a conversation rule gets that rule alone, because conversation colors take precedence over multiple colors. Without a match list (multi-color mode and multi-color details both off) only the rule that colors the packet is known.

Parameters
recordRecord; may be nullptr.
Returns
The colors; empty if the packet is not colored.

◆ setRuleEnabled()

bool ColoringRuleUtils::setRuleEnabled ( const ColoringRuleEntry & entry,
bool enabled,
QString * err )
static

Enables or disables the rule of an entry and saves the rule list.

Rules are matched by name, and by filter text when the entry has one, because names are not unique. The state is set, not toggled.

Parameters
entryEntry from entryForNode().
enabledNew state.
errSet to the error text when saving fails.
Returns
true if at least one rule matched (and saving was attempted).

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