#include <NetViewer.h>
Public Slots | |
void | showWindow () |
void | loadConnections () |
void | addCircuit (const Circuit &circuit) |
void | addStream (const Stream &stream) |
void | newDescriptors (const QStringList &ids) |
void | addressMapped (const QString &from, const QString &to, const QDateTime &expires) |
void | clear () |
Public Member Functions | |
NetViewer (QWidget *parent=0) | |
Protected Member Functions | |
void | retranslateUi () |
Private Slots | |
void | help () |
void | refresh () |
void | circuitSelected (const Circuit &circuit) |
void | resolved (int id, const QList< GeoIp > &geoips) |
void | routerSelected (const QList< RouterDescriptor > &routers) |
void | onAuthenticated () |
void | onDisconnected () |
void | resolve () |
void | displayRouterInfo (const QString &id) |
void | zoomIn () |
void | zoomOut () |
void | toggleFullScreen () |
Private Member Functions | |
void | addToResolveQueue (const QHostAddress &ip, const QString &id) |
void | loadNetworkStatus () |
void | loadAddressMap () |
void | addRouter (const RouterDescriptor &rd) |
Private Attributes | |
TorControl * | _torControl |
QTimer | _refreshTimer |
GeoIpResolver | _geoip |
QList< QHostAddress > | _resolveQueue |
QHash< QString, QString > | _resolveMap |
AddressMap | _addressMap |
QTimer | _minResolveQueueTimer |
QTimer | _maxResolveQueueTimer |
TorMapImageView * | _map |
Ui::NetViewer | ui |
Definition at line 42 of file NetViewer.h.
NetViewer::NetViewer | ( | QWidget * | parent = 0 |
) |
Default constructor
Constructor. Loads settings from VidaliaSettings.
parent | The parent widget of this NetViewer object.\ |
Definition at line 42 of file NetViewer.cpp.
References _geoip, _map, _maxResolveQueueTimer, _minResolveQueueTimer, _refreshTimer, _torControl, addCircuit(), TorEvents::AddressMap, addressMapped(), addStream(), circuitSelected(), TorEvents::CircuitStatus, CircuitListWidget::ConnectionColumn, RouterListWidget::CountryColumn, Vidalia::createShortcut(), displayRouterInfo(), help(), TorEvents::NewDescriptor, newDescriptors(), onAuthenticated(), onDisconnected(), refresh(), resolve(), resolved(), routerSelected(), TorControl::setEvent(), RouterListWidget::StatusColumn, TorEvents::StreamStatus, toggleFullScreen(), Vidalia::torControl(), ui, zoomIn(), and zoomOut().
void NetViewer::addCircuit | ( | const Circuit & | circuit | ) | [slot] |
Adds circuit to the list and the map
Adds circuit to the map and the list
Definition at line 272 of file NetViewer.cpp.
References _map, TorMapImageView::addCircuit(), Circuit::id(), Circuit::routerIDs(), and ui.
Referenced by loadConnections(), and NetViewer().
void NetViewer::addressMapped | ( | const QString & | from, | |
const QString & | to, | |||
const QDateTime & | expires | |||
) | [slot] |
Called when Tor has mapped the address from to the address to. expires indicates the time at which when the address mapping will no longer be considered valid.
Definition at line 301 of file NetViewer.cpp.
References _addressMap, and AddressMap::add().
Referenced by NetViewer().
void NetViewer::addRouter | ( | const RouterDescriptor & | rd | ) | [private] |
Adds a router to our list of servers and retrieves geographic location information for the server.
Definition at line 333 of file NetViewer.cpp.
References _torControl, addToResolveQueue(), TorControl::getDescriptorAnnotations(), TorControl::getTorVersion(), RouterDescriptor::id(), RouterDescriptor::ip(), and ui.
Referenced by loadNetworkStatus(), and newDescriptors().
void NetViewer::addStream | ( | const Stream & | stream | ) | [slot] |
Adds stream to the list of circuits, under the appropriate circuit.
Adds stream to its associated circuit on the list of all circuits.
Definition at line 282 of file NetViewer.cpp.
References _addressMap, Stream::circuitId(), Stream::id(), AddressMap::isMapped(), AddressMap::mappedTo(), Stream::status(), Stream::targetAddress(), Stream::targetPort(), and ui.
Referenced by loadConnections(), and NetViewer().
void NetViewer::addToResolveQueue | ( | const QHostAddress & | ip, | |
const QString & | id | |||
) | [private] |
Adds an IP address to the resolve queue and updates the queue timers.
Definition at line 366 of file NetViewer.cpp.
References _geoip, _maxResolveQueueTimer, _minResolveQueueTimer, _resolveMap, _resolveQueue, MAX_RESOLVE_QUEUE_DELAY, MIN_RESOLVE_QUEUE_DELAY, and GeoIpResolver::resolveFromCache().
Referenced by addRouter().
void NetViewer::circuitSelected | ( | const Circuit & | circuit | ) | [private, slot] |
Called when the user selects a circuit on the circuit list
Called when the user selects a circuit from the circuit and streams list.
Definition at line 394 of file NetViewer.cpp.
References _map, RouterListItem::descriptor(), TorMapImageView::deselectAll(), Circuit::id(), Circuit::routerIDs(), TorMapImageView::selectCircuit(), and ui.
Referenced by NetViewer().
void NetViewer::clear | ( | ) | [slot] |
Clears all known information
Clears the lists and the map
Definition at line 226 of file NetViewer.cpp.
References _addressMap, _map, _resolveMap, _resolveQueue, TorMapImageView::clear(), and ui.
Referenced by onDisconnected(), and refresh().
void NetViewer::displayRouterInfo | ( | const QString & | id | ) | [private, slot] |
Called when the user selects a router on the network map. Displays a dialog with detailed information for the router specified by id.
Definition at line 495 of file NetViewer.cpp.
References _map, _torControl, TorControl::getRouterDescriptorText(), TorControl::getRouterStatus(), RouterListItem::location(), VMessageBox::Ok, ui, and VMessageBox::warning().
Referenced by NetViewer().
void NetViewer::help | ( | ) | [private, slot] |
Called when the user selects the "Help" action on the toolbar.
Called when the user selects the "Help" action from the toolbar.
Definition at line 309 of file NetViewer.cpp.
References VidaliaWindow::helpRequested().
Referenced by NetViewer().
void NetViewer::loadAddressMap | ( | ) | [private] |
Loads a list of address mappings from Tor.
Loads a list of all current address mappings.
Definition at line 244 of file NetViewer.cpp.
References _addressMap, _torControl, TorControl::getAddressMap(), and AddressMap::reverse().
Referenced by refresh().
void NetViewer::loadConnections | ( | ) | [slot] |
Loads a list of current circuits and streams.
Loads a list of all current circuits and streams.
Definition at line 253 of file NetViewer.cpp.
References _map, _torControl, addCircuit(), addStream(), TorControl::getCircuits(), and TorControl::getStreams().
Referenced by refresh().
void NetViewer::loadNetworkStatus | ( | ) | [private] |
Retrieves a list of all running routers from Tor and their descriptors, and adds them to the RouterListWidget.
Definition at line 317 of file NetViewer.cpp.
References _torControl, addRouter(), TorControl::getNetworkStatus(), TorControl::getRouterDescriptor(), RouterStatus::id(), RouterDescriptor::isEmpty(), and RouterStatus::isRunning().
Referenced by refresh().
void NetViewer::newDescriptors | ( | const QStringList & | ids | ) | [slot] |
Called when a NEWDESC event arrives. Retrieves new router descriptors for the router identities given in ids and updates the router list and network map.
Definition at line 355 of file NetViewer.cpp.
References _torControl, addRouter(), TorControl::getRouterDescriptor(), and RouterDescriptor::isEmpty().
Referenced by NetViewer().
void NetViewer::onAuthenticated | ( | ) | [private, slot] |
Handles when we get connected to Tor network
Loads data into map, lists and starts timer when we get connected
Definition at line 185 of file NetViewer.cpp.
References _geoip, _refreshTimer, _torControl, TorControl::getSocksAddress(), TorControl::getSocksPort(), refresh(), GeoIpResolver::setSocksHost(), and ui.
Referenced by NetViewer().
void NetViewer::onDisconnected | ( | ) | [private, slot] |
Handles when we get disconnected from Tor network
Clears map, lists and stops timer when we get disconnected
Definition at line 196 of file NetViewer.cpp.
References _refreshTimer, clear(), and ui.
Referenced by NetViewer().
void NetViewer::refresh | ( | ) | [private, slot] |
Called when the user selects the "Refresh" action on the toolbar
Reloads the lists of routers, circuits that Tor knows about
Definition at line 205 of file NetViewer.cpp.
References clear(), loadAddressMap(), loadConnections(), loadNetworkStatus(), and ui.
Referenced by NetViewer(), and onAuthenticated().
void NetViewer::resolve | ( | ) | [private, slot] |
Resolves IP addresses in the resolve queue to geographic information.
If there are any IPs in the resolve queue, do the request now.
Definition at line 434 of file NetViewer.cpp.
References _geoip, _maxResolveQueueTimer, _minResolveQueueTimer, _resolveQueue, GeoIpResolver::resolve(), ui, and vInfo.
Referenced by NetViewer().
void NetViewer::resolved | ( | int | id, | |
const QList< GeoIp > & | geoips | |||
) | [private, slot] |
Called when an IP has been resolved to geographic information.
Called when a list of GeoIp information has been resolved.
Definition at line 456 of file NetViewer.cpp.
References _map, _resolveMap, TorMapImageView::addCircuit(), TorMapImageView::addRouter(), RouterListItem::descriptor(), Circuit::id(), GeoIp::ip(), Circuit::routerIDs(), RouterListItem::setLocation(), and ui.
Referenced by NetViewer().
void NetViewer::retranslateUi | ( | ) | [protected, virtual] |
Called when the user changes the UI translation.
Reimplemented from VidaliaWindow.
Definition at line 146 of file NetViewer.cpp.
References RouterListItem::descriptor(), Circuit::routerIDs(), and ui.
void NetViewer::routerSelected | ( | const QList< RouterDescriptor > & | routers | ) | [private, slot] |
Called when the user selects one or more routers in the list.
Called when the user selects one or more routers from the router list.
Definition at line 418 of file NetViewer.cpp.
References _map, TorMapImageView::deselectAll(), TorMapImageView::selectRouter(), and ui.
Referenced by NetViewer().
void NetViewer::showWindow | ( | ) | [virtual, slot] |
Displays the network map window.
Display the network map window. If there are geoip requests waiting in the queue, start the queue timers now.
Reimplemented from VidaliaWindow.
Definition at line 174 of file NetViewer.cpp.
References _maxResolveQueueTimer, _minResolveQueueTimer, _resolveQueue, MAX_RESOLVE_QUEUE_DELAY, and MIN_RESOLVE_QUEUE_DELAY.
void NetViewer::toggleFullScreen | ( | ) | [private, slot] |
Called when the user clicks "Full Screen" or presses Escape on the map. Toggles the map between normal and a full screen viewing modes.
Definition at line 556 of file NetViewer.cpp.
Referenced by NetViewer().
void NetViewer::zoomIn | ( | ) | [private, slot] |
Called when the user clicks the "Zoom In" button.
Definition at line 533 of file NetViewer.cpp.
References _map, and ZImageView::zoomIn().
Referenced by NetViewer().
void NetViewer::zoomOut | ( | ) | [private, slot] |
Called when the user clicks the "Zoom Out" button.
Definition at line 544 of file NetViewer.cpp.
References _map, and ZImageView::zoomOut().
Referenced by NetViewer().
AddressMap NetViewer::_addressMap [private] |
Stores a list of address mappings from Tor.
Definition at line 133 of file NetViewer.h.
Referenced by addressMapped(), addStream(), clear(), and loadAddressMap().
GeoIpResolver NetViewer::_geoip [private] |
GeoIpResolver used to geolocate routers by IP address.
Definition at line 127 of file NetViewer.h.
Referenced by addToResolveQueue(), NetViewer(), onAuthenticated(), and resolve().
TorMapImageView* NetViewer::_map [private] |
Widget that displays the Tor network map.
Definition at line 146 of file NetViewer.h.
Referenced by addCircuit(), circuitSelected(), clear(), displayRouterInfo(), loadConnections(), NetViewer(), resolved(), routerSelected(), toggleFullScreen(), zoomIn(), and zoomOut().
QTimer NetViewer::_maxResolveQueueTimer [private] |
Timer used to limit the delay of GeoIP requests to MAX_RESOLVE_QUEUE_DELAY milliseconds after inserting the first item into the queue.
Definition at line 140 of file NetViewer.h.
Referenced by addToResolveQueue(), NetViewer(), resolve(), and showWindow().
QTimer NetViewer::_minResolveQueueTimer [private] |
Timer used to delay GeoIP requests for MIN_RESOLVE_QUEUE_DELAY milliseconds after we've inserted the last item into the queue.
Definition at line 136 of file NetViewer.h.
Referenced by addToResolveQueue(), NetViewer(), resolve(), and showWindow().
QTimer NetViewer::_refreshTimer [private] |
Timer that fires once an hour to update the router list.
Definition at line 125 of file NetViewer.h.
Referenced by NetViewer(), onAuthenticated(), and onDisconnected().
QHash<QString, QString> NetViewer::_resolveMap [private] |
Maps pending GeoIP requests to server IDs.
Definition at line 131 of file NetViewer.h.
Referenced by addToResolveQueue(), clear(), and resolved().
QList<QHostAddress> NetViewer::_resolveQueue [private] |
Queue for IPs pending resolution to geographic information.
Definition at line 129 of file NetViewer.h.
Referenced by addToResolveQueue(), clear(), resolve(), and showWindow().
TorControl* NetViewer::_torControl [private] |
TorControl object used to talk to Tor.
Definition at line 123 of file NetViewer.h.
Referenced by addRouter(), displayRouterInfo(), loadAddressMap(), loadConnections(), loadNetworkStatus(), NetViewer(), newDescriptors(), and onAuthenticated().
Ui::NetViewer NetViewer::ui [private] |
Qt Designer generated object
Definition at line 150 of file NetViewer.h.
Referenced by addCircuit(), addRouter(), addStream(), circuitSelected(), clear(), displayRouterInfo(), NetViewer(), onAuthenticated(), onDisconnected(), refresh(), resolve(), resolved(), retranslateUi(), routerSelected(), and toggleFullScreen().