| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | List of all members
InterfaceListManager Class Reference

GUI-thread coordinator for local interface enumeration and statistics. More...

`#include <interface_list_manager.h>`

Inheritance diagram for InterfaceListManager:

## Public Slots
void | requestRefresh (bool userInitiated=false)
| Requests a (coalesced, deferred-if-capturing) interface rescan.
void | refreshNow ()
| Performs an interface rescan synchronously, before returning.
void | notifyListChanged ()
| Announces that the interface list changed without re-enumerating.
void | reapplyInterfacePreferences ()
| Re-derives interface display attributes from preferences, in place.
void | setCaptureActive (bool active)
| Tells the manager whether a capture is active.

## Signals
void | interfaceListChanged ()
| Emitted once after a scan, when the interface list is stable.

## Public Member Functions
| InterfaceListManager (QObject *parent=nullptr)
| Constructs an idle manager.
QStringList | currentInterfaceNames () const
| Interface names from the most recent completed scan.
bool | isScanning () const
| Whether a scan is currently in progress.
InterfaceStatistics * | statistics () const
| Returns the live interface statistics owned by this manager.

## Detailed Description

GUI-thread coordinator for local interface enumeration and statistics.

Replaces the scattered MainApplication::refreshLocalInterfaces / scanLocalInterfaces path (and its eight ad-hoc callers) with one well-defined entry point, requestRefresh(), that:

- never runs the scan inline in the caller's stack (it is posted to the event loop), so callers cannot re-enter the scan or read a half-updated list;
- coalesces a burst of requests into a single scan;
- defers scanning while a capture is active and runs the pending request once the capture finishes;
- serializes scans (one at a time).

The enumeration itself runs on the GUI thread because it repopulates the process-global global_capture_opts.all_ifaces that the rest of the GUI reads directly. It omits the event-loop-pumping update callback (re-entrancy is impossible); moving enumeration off the GUI thread is a future step (blocked on all_ifaces being GUI-global) and is noted at the call site.

The manager owns the live InterfaceStatistics, analogous to a view's default model: a statistics object is always paired with a manager. The manager creates it and hands out the reference via statistics(); it also drives it directly (pruning removed interfaces, resetting activity on a user refresh, and pausing sampling while a capture is active), so consumers and the window never wire the manager to the statistics themselves. The only outward signal is interfaceListChanged(), a UI notification that the list is stable.

## Constructor & Destructor Documentation

## ◆ InterfaceListManager()

InterfaceListManager::InterfaceListManager | ( | QObject * | parent = nullptr | ) |
| explicit

Constructs an idle manager.

Parameters

  parent | Optional parent QObject.

## Member Function Documentation

## ◆ currentInterfaceNames()

QStringList InterfaceListManager::currentInterfaceNames | ( |  | ) | const

Interface names from the most recent completed scan.

Returns
  The current interface names.

## ◆ notifyListChanged

void InterfaceListManager::notifyListChanged | ( |  | ) |
| slot

Announces that the interface list changed without re-enumerating.

For edits to already-enumerated interfaces (hide/comment/add/remove a pipe or extcap, or a profile switch that only changes display attributes) where a full rescan is unwanted - just emits interfaceListChanged() so subscribers re-read global_capture_opts.all_ifaces.

## ◆ reapplyInterfacePreferences

void InterfaceListManager::reapplyInterfacePreferences | ( |  | ) |
| slot

Re-derives interface display attributes from preferences, in place.

Re-applies the per-interface display name, hidden flag and link type from the current preferences over the existing global_capture_opts.all_ifaces, without re-enumerating via dumpcap. Runs synchronously (see the implementation comment): it is the profile-switch reapply that must finish before MainApplication::setConfigurationProfile() emits preferencesChanged(). Everywhere else prefer the asynchronous requestRefresh().

## ◆ refreshNow

void InterfaceListManager::refreshNow | ( |  | ) |
| slot

Performs an interface rescan synchronously, before returning.

For the few contexts that need global_capture_opts.all_ifaces populated immediately rather than on the next event-loop turn - notably startup commandline resolution (-i / capture_device) which runs before the Qt event loop starts. Honors the capture-active guard (no scan while capturing). Prefer requestRefresh() everywhere else.

## ◆ requestRefresh

void InterfaceListManager::requestRefresh | ( | bool | userInitiated = false | ) |
| slot

Requests a (coalesced, deferred-if-capturing) interface rescan.

Safe to call from anywhere and as often as needed; the scan runs once, asynchronously, off the caller's stack.

Parameters

  userInitiated | true if a user explicitly asked to refresh; this additionally resets the statistics' activity so a now-quiet interface can be re-evaluated.

## ◆ setCaptureActive

void InterfaceListManager::setCaptureActive | ( | bool | active | ) |
| slot

Tells the manager whether a capture is active.

While active, refresh requests are deferred and the statistics' sampling is paused; on the transition back to inactive sampling resumes and any pending request is serviced.

Parameters

  active | true if a capture is currently running.

## ◆ statistics()

InterfaceStatistics * InterfaceListManager::statistics | ( |  | ) | const

Returns the live interface statistics owned by this manager.

Returns
  Pointer to the InterfaceStatistics (never null).

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

- /builds/wireshark/wireshark/ui/qt/manager/interface_list_manager.h
- /builds/wireshark/wireshark/ui/qt/manager/interface_list_manager.cpp