|
Wireshark 4.7.2
The Wireshark network protocol analyzer
|
GUI-thread coordinator for local interface enumeration and statistics. More...
#include <interface_list_manager.h>
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. | |
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:
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.
|
explicit |
Constructs an idle manager.
| parent | Optional parent QObject. |
| QStringList InterfaceListManager::currentInterfaceNames | ( | ) | const |
Interface names from the most recent completed scan.
|
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.
|
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().
|
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.
|
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.
| userInitiated | true if a user explicitly asked to refresh; this additionally resets the statistics' activity so a now-quiet interface can be re-evaluated. |
|
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.
| active | true if a capture is currently running. |
| InterfaceStatistics * InterfaceListManager::statistics | ( | ) | const |
Returns the live interface statistics owned by this manager.