NetViewer Class Reference

#include <netviewer.h>

Inheritance diagram for NetViewer:

VidaliaWindow

List of all members.

Public Slots

void showWindow ()
void loadConnections ()
void addCircuit (Circuit circuit)
void addStream (Stream stream)
void clear ()

Public Member Functions

 NetViewer (QWidget *parent=0)

Protected Member Functions

void customEvent (QEvent *event)

Private Slots

void help ()
void refresh ()
void circuitSelected (Circuit circuit)
void resolved (int id, QList< GeoIp > geoips)
void routerSelected (RouterDescriptor router)
void onAuthenticated ()
void onDisconnected ()
void resolve ()

Private Member Functions

void addToResolveQueue (QHostAddress ip, QString id)
void loadDescriptors (QStringList ids)
void loadAddressMap ()
void addRouter (RouterDescriptor rd)
Circuit circuitPathIDs (Circuit circ)
Circuit circuitPathNames (Circuit circ)

Private Attributes

TorControl_torControl
QTimer _refreshTimer
TorMapWidget_map
GeoIpResolver _geoip
QList< QHostAddress > _resolveQueue
QHash< QString, QString > _resolveMap
AddressMap _addressMap
QTimer _minResolveQueueTimer
QTimer _maxResolveQueueTimer
Ui::NetViewer ui


Detailed Description

Definition at line 44 of file netviewer.h.


Constructor & Destructor Documentation

NetViewer::NetViewer ( QWidget *  parent = 0  ) 

Default constructor

Constructor. Loads settings from VidaliaSettings.

Parameters:
parent The parent widget of this NetViewer object.\

Definition at line 50 of file netviewer.cpp.

References _geoip, _map, _maxResolveQueueTimer, _minResolveQueueTimer, _refreshTimer, _torControl, TorEvents::AddressMap, circuitSelected(), TorEvents::CircuitStatus, CircuitListWidget::ConnectionColumn, RouterListWidget::CountryColumn, help(), TorEvents::NewDescriptor, onAuthenticated(), onDisconnected(), refresh(), resolve(), resolved(), routerSelected(), TorControl::setEvent(), RouterListWidget::StatusColumn, TorEvents::StreamStatus, Vidalia::torControl(), and ui.


Member Function Documentation

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 130 of file netviewer.cpp.

References _maxResolveQueueTimer, _minResolveQueueTimer, _resolveQueue, MAX_RESOLVE_QUEUE_DELAY, MIN_RESOLVE_QUEUE_DELAY, and VidaliaWindow::showWindow().

void NetViewer::loadConnections (  )  [slot]

Loads a list of current circuits and streams.

Loads a list of all current circuits and streams.

Definition at line 238 of file netviewer.cpp.

References _map, _torControl, addCircuit(), addStream(), TorControl::getCircuits(), and TorControl::getStreams().

Referenced by refresh().

void NetViewer::addCircuit ( Circuit  circuit  )  [slot]

Adds circuit to the list and the map

Adds circuit to the map and the list

Definition at line 257 of file netviewer.cpp.

References _map, TorMapWidget::addCircuit(), circuitPathIDs(), circuitPathNames(), Circuit::hops(), Circuit::id(), Circuit::path(), and ui.

Referenced by customEvent(), and loadConnections().

void NetViewer::addStream ( 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 270 of file netviewer.cpp.

References _addressMap, Stream::circuitId(), Stream::id(), AddressMap::isMapped(), AddressMap::mappedTo(), Stream::status(), Stream::targetAddress(), Stream::targetPort(), and ui.

Referenced by customEvent(), and loadConnections().

void NetViewer::clear (  )  [slot]

Clears all known information

Clears the lists and the map

Definition at line 211 of file netviewer.cpp.

References _addressMap, _map, _resolveMap, _resolveQueue, TorMapWidget::clear(), and ui.

Referenced by onDisconnected(), and refresh().

void NetViewer::customEvent ( QEvent *  event  )  [protected]

Called to deliver a NEWDESC event from Tor.

Custom event handler. Catches the new descriptor events.

Definition at line 161 of file netviewer.cpp.

References _addressMap, _map, AddressMap::add(), addCircuit(), CustomEventType::AddressMapEvent, addStream(), CircuitEvent::circuit(), CustomEventType::CircuitEvent, NewDescriptorEvent::descriptorIDs(), AddressMapEvent::expires(), AddressMapEvent::from(), loadDescriptors(), CustomEventType::NewDescriptorEvent, StreamEvent::stream(), CustomEventType::StreamEvent, and AddressMapEvent::to().

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 288 of file netviewer.cpp.

References Vidalia::help().

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 190 of file netviewer.cpp.

References _torControl, clear(), TorControl::getRouterIDList(), loadAddressMap(), loadConnections(), loadDescriptors(), and ui.

Referenced by NetViewer(), and onAuthenticated().

void NetViewer::circuitSelected ( 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 352 of file netviewer.cpp.

References _map, RouterListItem::descriptor(), TorMapWidget::deselectAll(), Circuit::hops(), Circuit::id(), TorMapWidget::selectCircuit(), and ui.

Referenced by NetViewer().

void NetViewer::resolved ( int  id,
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 411 of file netviewer.cpp.

References _map, _resolveMap, TorMapWidget::addCircuit(), TorMapWidget::addRouter(), circuitPathIDs(), Circuit::hops(), Circuit::id(), RouterListItem::id(), GeoIp::ip(), GeoIp::isUnknown(), GeoIp::latitude(), GeoIp::longitude(), RouterListItem::setLocation(), and ui.

Referenced by NetViewer().

void NetViewer::routerSelected ( RouterDescriptor  router  )  [private, slot]

Called when the user selects a router in the list.

Called when the user selects a router from the router list.

Definition at line 379 of file netviewer.cpp.

References _map, TorMapWidget::deselectAll(), RouterDescriptor::id(), TorMapWidget::selectRouter(), and ui.

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 141 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 152 of file netviewer.cpp.

References _refreshTimer, clear(), and ui.

Referenced by NetViewer().

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 389 of file netviewer.cpp.

References _geoip, _maxResolveQueueTimer, _minResolveQueueTimer, _resolveQueue, GeoIpResolver::resolve(), ui, and vInfo.

Referenced by NetViewer().

void NetViewer::addToResolveQueue ( QHostAddress  ip,
QString  id 
) [private]

Adds an IP address to the resolve queue and updates the queue timers.

Definition at line 324 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::loadDescriptors ( QStringList  ids  )  [private]

Loads a list of router descriptors from the list of IDs.

Loads a list of new descriptors from the given IDs.

Definition at line 295 of file netviewer.cpp.

References _torControl, addRouter(), TorControl::getDescriptorListById(), RouterDescriptor::isEmpty(), and vInfo.

Referenced by customEvent(), and refresh().

void NetViewer::loadAddressMap (  )  [private]

Loads a list of address mappings from Tor.

Loads a list of all current address mappings.

Definition at line 229 of file netviewer.cpp.

References _addressMap, _torControl, TorControl::getAddressMap(), and AddressMap::reverse().

Referenced by refresh().

void NetViewer::addRouter ( RouterDescriptor  rd  )  [private]

Adds a router to our list of servers and retrieves geographic location information for the server.

Definition at line 313 of file netviewer.cpp.

References addToResolveQueue(), RouterDescriptor::id(), RouterDescriptor::ip(), and ui.

Referenced by circuitPathIDs(), circuitPathNames(), and loadDescriptors().

Circuit NetViewer::circuitPathIDs ( Circuit  circ  )  [private]

Convert all hops in circ's path to server identities. circ's status and circuit ID will be preserved.

Convert all hops in circ's path to server identities. circ's status and circuit ID will be preserved. If no ID can be found for a router name, the name will be left in the circuit's path.

Definition at line 451 of file netviewer.cpp.

References _torControl, addRouter(), RouterListItem::descriptor(), TorControl::getDescriptorByName(), TorControl::getTorVersion(), Circuit::hops(), Circuit::id(), RouterDescriptor::id(), RouterDescriptor::isEmpty(), Circuit::status(), and ui.

Referenced by addCircuit(), and resolved().

Circuit NetViewer::circuitPathNames ( Circuit  circ  )  [private]

Convert all hops in circ's path to server names. circ's status and circuit ID will be preserved.

Convert all hops in circ's path to server names. circ's status and circuit ID will be preserved. If no name can be found for a server identity, the ID will be left in the circuit's path.

Definition at line 497 of file netviewer.cpp.

References _torControl, addRouter(), RouterListItem::descriptor(), TorControl::getDescriptorById(), Circuit::hops(), Circuit::id(), RouterDescriptor::isEmpty(), RouterDescriptor::name(), Circuit::status(), and ui.

Referenced by addCircuit().


Member Data Documentation

TorControl* NetViewer::_torControl [private]

TorControl object used to talk to Tor.

Definition at line 105 of file netviewer.h.

Referenced by circuitPathIDs(), circuitPathNames(), loadAddressMap(), loadConnections(), loadDescriptors(), NetViewer(), onAuthenticated(), and refresh().

QTimer NetViewer::_refreshTimer [private]

Timer that fires once an hour to update the router list.

Definition at line 107 of file netviewer.h.

Referenced by NetViewer(), onAuthenticated(), and onDisconnected().

TorMapWidget* NetViewer::_map [private]

TorMapWidget that displays the map.

Definition at line 109 of file netviewer.h.

Referenced by addCircuit(), circuitSelected(), clear(), customEvent(), loadConnections(), NetViewer(), resolved(), and routerSelected().

GeoIpResolver NetViewer::_geoip [private]

GeoIpResolver used to geolocate routers by IP address.

Definition at line 111 of file netviewer.h.

Referenced by addToResolveQueue(), NetViewer(), onAuthenticated(), and resolve().

QList<QHostAddress> NetViewer::_resolveQueue [private]

Queue for IPs pending resolution to geographic information.

Definition at line 113 of file netviewer.h.

Referenced by addToResolveQueue(), clear(), resolve(), and showWindow().

QHash<QString, QString> NetViewer::_resolveMap [private]

Maps pending GeoIP requests to server IDs.

Definition at line 115 of file netviewer.h.

Referenced by addToResolveQueue(), clear(), and resolved().

AddressMap NetViewer::_addressMap [private]

Stores a list of address mappings from Tor.

Definition at line 117 of file netviewer.h.

Referenced by addStream(), clear(), customEvent(), and loadAddressMap().

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 120 of file netviewer.h.

Referenced by addToResolveQueue(), NetViewer(), resolve(), and showWindow().

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 124 of file netviewer.h.

Referenced by addToResolveQueue(), NetViewer(), resolve(), and showWindow().

Ui::NetViewer NetViewer::ui [private]

Qt Designer generated object

Definition at line 127 of file netviewer.h.

Referenced by addCircuit(), addRouter(), addStream(), circuitPathIDs(), circuitPathNames(), circuitSelected(), clear(), NetViewer(), onAuthenticated(), onDisconnected(), refresh(), resolve(), resolved(), and routerSelected().


The documentation for this class was generated from the following files:
Generated on Wed Sep 5 15:49:29 2007 for Vidalia by  doxygen 1.5.3