#include <NetworkPage.hpp>
Classes | |
| struct | Pin |
| struct | Columns |
Public Member Functions | |
| NetworkPage () | |
| ~NetworkPage () override | |
| void | noteConnection (const ConnectionInfo &info) |
| void | clear () |
| void | saveLog () const |
| void | loadLog () |
| void | drawConnectionArcs (cairo_t *cr, int width, int height) |
Static Public Member Functions | |
| static std::string | logPath () |
Private Member Functions | |
| void | buildUI () |
| void | buildMapWidget () |
| void | rebuildMapMarkers () |
| GtkWidget * | createMarkerWidget (const Pin &pin) |
| GtkWidget * | createSelfMarkerWidget () |
| GtkWidget * | createHoverCard () |
| void | showHoverCard (const std::string &country_code, const std::string &country_name, const std::string &city, const std::string &ip, const std::string &host, const std::string &app_name, const std::string &isp, uint32_t hits) |
| void | hideHoverCard () |
| void | maybeRecenterMap (const std::vector< Pin > &pins) |
| void | onGeoResolved () |
| void | updateSummary () |
| void | updateRow (const Pin &pin) |
| void | noteUserViewportInteraction () |
| bool | shouldHoldUserViewport () const |
| void | requestSelfLocation () |
| void | triggerFxRedraw () |
Private Attributes | |
| Columns | m_columns |
| Glib::RefPtr< Gtk::ListStore > | m_store |
| Gtk::TreeView | m_treeView |
| Gtk::ScrolledWindow | m_scroll |
| Gtk::Box | m_mapHost {Gtk::Orientation::VERTICAL, 0} |
| Gtk::Label | m_headerLabel |
| Gtk::Label | m_summaryLabel |
| Gtk::Button | m_clearBtn |
| GtkWidget * | m_simpleMap {nullptr} |
| ShumateViewport * | m_viewport {nullptr} |
| ShumateMarkerLayer * | m_markerLayer {nullptr} |
| GtkWidget * | m_mapOverlay {nullptr} |
| GtkWidget * | m_hoverCard {nullptr} |
| GtkWidget * | m_hoverCardTitle {nullptr} |
| GtkWidget * | m_hoverCardBody {nullptr} |
| guint | m_hoverHideSource {0} |
| std::chrono::steady_clock::time_point | m_lastUserViewportInteraction {} |
| double | m_selfLat {0.0} |
| double | m_selfLon {0.0} |
| bool | m_selfResolved {false} |
| GtkWidget * | m_mapFxArea {nullptr} |
| guint | m_pulseTimerId {0} |
| int | m_pulseFrame {0} |
| std::mutex | m_mu |
| std::unordered_map< std::string, Pin > | m_pins |
| std::unordered_map< std::string, Gtk::TreeModel::iterator > | m_rows |
| Glib::Dispatcher | m_geoDispatcher |
| std::mutex | m_pendingMu |
| std::vector< std::pair< std::string, bsc::ui_util::GeoEntry > > | m_pendingGeo |
Static Private Attributes | |
| static constexpr int64_t | kRetentionSeconds = 7 * 24 * 3600 |
Pagina Rete.
Mostra una mappa reale basata su libshumate/OpenStreetMap con un marker per ogni IP contattato. La geolocalizzazione arriva da GeoResolver, mentre il rendering geografico e l'allineamento li gestisce libshumate.
Definition at line 28 of file NetworkPage.hpp.
| NetworkPage::NetworkPage | ( | ) |
Definition at line 177 of file NetworkPage.cpp.
References buildUI(), bsc::ui_util::GeoResolver::instance(), m_geoDispatcher, m_pendingGeo, m_pendingMu, m_pulseTimerId, NetworkPage(), bsc::ui_util::GeoResolver::on_resolved(), onGeoResolved(), and requestSelfLocation().
Referenced by buildMapWidget(), createMarkerWidget(), and NetworkPage().
|
override |
Definition at line 216 of file NetworkPage.cpp.
References m_hoverCard, m_hoverCardBody, m_hoverCardTitle, m_hoverHideSource, m_mapFxArea, m_mapOverlay, m_markerLayer, m_pulseTimerId, m_simpleMap, and m_viewport.
|
private |
Definition at line 397 of file NetworkPage.cpp.
References createHoverCard(), m_hoverCard, m_mapFxArea, m_mapHost, m_mapOverlay, m_markerLayer, m_simpleMap, m_viewport, and NetworkPage().
Referenced by buildUI().
|
private |
Definition at line 238 of file NetworkPage.cpp.
References _, buildMapWidget(), clear(), NetworkPage::Columns::col_app, NetworkPage::Columns::col_city, NetworkPage::Columns::col_country, NetworkPage::Columns::col_hits, NetworkPage::Columns::col_host, NetworkPage::Columns::col_ip, NetworkPage::Columns::col_isp, m_clearBtn, m_columns, m_headerLabel, m_mapHost, m_scroll, m_store, m_summaryLabel, m_treeView, and updateSummary().
Referenced by NetworkPage().
| void NetworkPage::clear | ( | ) |
Pulisci la visualizzazione.
Definition at line 1105 of file NetworkPage.cpp.
References logPath(), m_mu, m_pins, m_rows, m_store, rebuildMapMarkers(), and updateSummary().
Referenced by buildUI().
|
private |
Definition at line 308 of file NetworkPage.cpp.
References m_hoverCardBody, and m_hoverCardTitle.
Referenced by buildMapWidget().
|
private |
Definition at line 487 of file NetworkPage.cpp.
References NetworkPage::Pin::app_name, NetworkPage::Pin::city, NetworkPage::Pin::country_code, NetworkPage::Pin::country_name, hideHoverCard(), NetworkPage::Pin::hits, NetworkPage::Pin::host, NetworkPage::Pin::ip, NetworkPage::Pin::isp, NetworkPage::Pin::lat, NetworkPage::Pin::lon, and NetworkPage().
Referenced by rebuildMapMarkers().
|
private |
Definition at line 932 of file NetworkPage.cpp.
References m_selfLat, and m_selfLon.
Referenced by rebuildMapMarkers().
| void NetworkPage::drawConnectionArcs | ( | cairo_t * | cr, |
| int | width, | ||
| int | height ) |
Disegna gli archi attivi dalla posizione locale verso ogni pin attualmente aperto, piu' il puntino lampeggiante sul marker destinazione. Chiamato dall'overlay DrawingArea — pubblico perche' deve essere invocabile da una free function C-callback.
Definition at line 997 of file NetworkPage.cpp.
References m_mu, m_pins, m_selfLat, m_selfLon, m_selfResolved, m_simpleMap, and m_viewport.
Referenced by anonymous_namespace{NetworkPage.cpp}::map_fx_draw().
|
private |
Definition at line 374 of file NetworkPage.cpp.
References m_hoverCard, and m_hoverHideSource.
Referenced by createMarkerWidget(), and rebuildMapMarkers().
| void NetworkPage::loadLog | ( | ) |
Carica i pin da disco, scartando quelli piu' vecchi di 7 giorni.
Definition at line 1231 of file NetworkPage.cpp.
References NetworkPage::Pin::app_name, NetworkPage::Pin::city, NetworkPage::Pin::country_code, NetworkPage::Pin::country_name, NetworkPage::Pin::geo_resolved, NetworkPage::Pin::hits, NetworkPage::Pin::host, NetworkPage::Pin::ip, NetworkPage::Pin::isp, kRetentionSeconds, NetworkPage::Pin::last_seen, NetworkPage::Pin::last_seen_epoch, NetworkPage::Pin::lat, logPath(), NetworkPage::Pin::lon, m_mu, m_pins, rebuildMapMarkers(), updateRow(), and updateSummary().
|
static |
Path del file persistente (JSONL).
Definition at line 1129 of file NetworkPage.cpp.
|
private |
Definition at line 591 of file NetworkPage.cpp.
References m_selfLat, m_selfLon, m_selfResolved, m_viewport, and shouldHoldUserViewport().
Referenced by rebuildMapMarkers().
| void NetworkPage::noteConnection | ( | const ConnectionInfo & | info | ) |
Registra una connessione per la mappa.
Definition at line 724 of file NetworkPage.cpp.
References ConnectionInfo::app_args, ConnectionInfo::app_comm, ConnectionInfo::app_path, bsc::ui_util::best_connection_display_name(), ConnectionInfo::dest_host, ConnectionInfo::dest_ip, bsc::ui_util::GeoResolver::instance(), bsc::ui_util::is_safe_local_connection(), m_mu, m_pins, rebuildMapMarkers(), saveLog(), ConnectionInfo::src_ip, updateRow(), and updateSummary().
Referenced by MainWindow::onDaemonAlert(), MainWindow::onNewConnection(), and MainWindow::onVerdict().
|
private |
Definition at line 713 of file NetworkPage.cpp.
References m_lastUserViewportInteraction.
|
private |
Definition at line 804 of file NetworkPage.cpp.
References m_mu, m_pendingGeo, m_pendingMu, m_pins, m_selfLat, m_selfLon, m_selfResolved, rebuildMapMarkers(), triggerFxRedraw(), updateRow(), and updateSummary().
Referenced by NetworkPage().
|
private |
Definition at line 668 of file NetworkPage.cpp.
References _, createMarkerWidget(), createSelfMarkerWidget(), hideHoverCard(), m_markerLayer, m_mu, m_pins, m_selfResolved, and maybeRecenterMap().
Referenced by clear(), loadLog(), noteConnection(), onGeoResolved(), and requestSelfLocation().
|
private |
Definition at line 917 of file NetworkPage.cpp.
References bsc::ui_util::GeoResolver::instance(), m_selfLat, m_selfLon, m_selfResolved, and rebuildMapMarkers().
Referenced by NetworkPage().
| void NetworkPage::saveLog | ( | ) | const |
Salva i pin su disco per retention 7 giorni.
Definition at line 1195 of file NetworkPage.cpp.
References logPath(), m_mu, and m_pins.
Referenced by noteConnection(), and MainWindow::~MainWindow().
|
private |
Definition at line 718 of file NetworkPage.cpp.
References m_lastUserViewportInteraction.
Referenced by maybeRecenterMap().
|
private |
Definition at line 336 of file NetworkPage.cpp.
References m_hoverCard, m_hoverCardBody, m_hoverCardTitle, and m_hoverHideSource.
|
private |
Definition at line 1100 of file NetworkPage.cpp.
References m_mapFxArea.
Referenced by onGeoResolved().
|
private |
Definition at line 849 of file NetworkPage.cpp.
References NetworkPage::Pin::app_name, NetworkPage::Pin::city, NetworkPage::Columns::col_app, NetworkPage::Columns::col_city, NetworkPage::Columns::col_country, NetworkPage::Columns::col_hits, NetworkPage::Columns::col_host, NetworkPage::Columns::col_ip, NetworkPage::Columns::col_isp, NetworkPage::Pin::country_code, NetworkPage::Pin::country_name, NetworkPage::Pin::hits, NetworkPage::Pin::host, NetworkPage::Pin::ip, NetworkPage::Pin::isp, m_columns, m_rows, and m_store.
Referenced by loadLog(), noteConnection(), and onGeoResolved().
|
private |
Definition at line 886 of file NetworkPage.cpp.
References _, m_mu, m_pins, and m_summaryLabel.
Referenced by buildUI(), clear(), loadLog(), noteConnection(), and onGeoResolved().
|
staticconstexprprivate |
Definition at line 141 of file NetworkPage.hpp.
Referenced by loadLog().
|
private |
Definition at line 104 of file NetworkPage.hpp.
Referenced by buildUI().
|
private |
Definition at line 97 of file NetworkPage.hpp.
Referenced by buildUI(), and updateRow().
|
private |
Definition at line 149 of file NetworkPage.hpp.
Referenced by NetworkPage().
|
private |
Definition at line 102 of file NetworkPage.hpp.
Referenced by buildUI().
|
private |
Definition at line 113 of file NetworkPage.hpp.
Referenced by buildMapWidget(), hideHoverCard(), showHoverCard(), and ~NetworkPage().
|
private |
Definition at line 115 of file NetworkPage.hpp.
Referenced by createHoverCard(), showHoverCard(), and ~NetworkPage().
|
private |
Definition at line 114 of file NetworkPage.hpp.
Referenced by createHoverCard(), showHoverCard(), and ~NetworkPage().
|
private |
Definition at line 116 of file NetworkPage.hpp.
Referenced by hideHoverCard(), showHoverCard(), and ~NetworkPage().
|
private |
Definition at line 117 of file NetworkPage.hpp.
Referenced by noteUserViewportInteraction(), and shouldHoldUserViewport().
|
private |
Definition at line 127 of file NetworkPage.hpp.
Referenced by buildMapWidget(), triggerFxRedraw(), and ~NetworkPage().
|
private |
Definition at line 101 of file NetworkPage.hpp.
Referenced by buildMapWidget(), and buildUI().
|
private |
Definition at line 112 of file NetworkPage.hpp.
Referenced by buildMapWidget(), and ~NetworkPage().
|
private |
Definition at line 109 of file NetworkPage.hpp.
Referenced by buildMapWidget(), rebuildMapMarkers(), and ~NetworkPage().
|
mutableprivate |
Definition at line 144 of file NetworkPage.hpp.
Referenced by clear(), drawConnectionArcs(), loadLog(), noteConnection(), onGeoResolved(), rebuildMapMarkers(), saveLog(), and updateSummary().
|
private |
Definition at line 151 of file NetworkPage.hpp.
Referenced by NetworkPage(), and onGeoResolved().
|
private |
Definition at line 150 of file NetworkPage.hpp.
Referenced by NetworkPage(), and onGeoResolved().
|
private |
Definition at line 145 of file NetworkPage.hpp.
Referenced by clear(), drawConnectionArcs(), loadLog(), noteConnection(), onGeoResolved(), rebuildMapMarkers(), saveLog(), and updateSummary().
|
private |
Definition at line 132 of file NetworkPage.hpp.
|
private |
Definition at line 131 of file NetworkPage.hpp.
Referenced by NetworkPage(), and ~NetworkPage().
|
private |
Definition at line 146 of file NetworkPage.hpp.
Referenced by clear(), and updateRow().
|
private |
Definition at line 100 of file NetworkPage.hpp.
Referenced by buildUI().
|
private |
Definition at line 124 of file NetworkPage.hpp.
Referenced by createSelfMarkerWidget(), drawConnectionArcs(), maybeRecenterMap(), onGeoResolved(), and requestSelfLocation().
|
private |
Definition at line 125 of file NetworkPage.hpp.
Referenced by createSelfMarkerWidget(), drawConnectionArcs(), maybeRecenterMap(), onGeoResolved(), and requestSelfLocation().
|
private |
Definition at line 126 of file NetworkPage.hpp.
Referenced by drawConnectionArcs(), maybeRecenterMap(), onGeoResolved(), rebuildMapMarkers(), and requestSelfLocation().
|
private |
Definition at line 107 of file NetworkPage.hpp.
Referenced by buildMapWidget(), drawConnectionArcs(), and ~NetworkPage().
|
private |
Definition at line 98 of file NetworkPage.hpp.
Referenced by buildUI(), clear(), and updateRow().
|
private |
Definition at line 103 of file NetworkPage.hpp.
Referenced by buildUI(), and updateSummary().
|
private |
Definition at line 99 of file NetworkPage.hpp.
Referenced by buildUI().
|
private |
Definition at line 108 of file NetworkPage.hpp.
Referenced by buildMapWidget(), drawConnectionArcs(), maybeRecenterMap(), and ~NetworkPage().