Vidalia
0.3.1
Main Page
Namespaces
Classes
Files
File List
File Members
src
vidalia
network
NetViewer.h
Go to the documentation of this file.
1
/*
2
** This file is part of Vidalia, and is subject to the license terms in the
3
** LICENSE file, found in the top level directory of this distribution. If you
4
** did not receive the LICENSE file with this file, you may obtain it from the
5
** Vidalia source package distributed by the Vidalia Project at
6
** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7
** including this file, may be copied, modified, propagated, or distributed
8
** except according to the terms described in the LICENSE file.
9
*/
10
11
/*
12
** \file NetViewer.h
13
** \brief Displays a map of the Tor network and the user's circuits
14
*/
15
16
#ifndef _NETVIEWER_H
17
#define _NETVIEWER_H
18
19
#include "
config.h
"
20
#include "ui_NetViewer.h"
21
#include "
VidaliaTab.h
"
22
#include "
GeoIpResolver.h
"
23
24
#if defined(USE_MARBLE)
25
#include "
TorMapWidget.h
"
26
#else
27
#include "
TorMapImageView.h
"
28
#endif
29
30
#include "
TorControl.h
"
31
32
#include <QMainWindow>
33
#include <QStringList>
34
#include <QEvent>
35
#include <QTimer>
36
#include <QHash>
37
38
class
QDateTime;
39
40
41
class
NetViewer
:
public
VidaliaTab
42
{
43
Q_OBJECT
44
45
public
:
46
/** Default constructor */
47
NetViewer
(QWidget* parent = 0);
48
49
public
slots:
50
/** Displays the network map window. */
51
// void showWindow();
52
/** Loads a list of current circuits and streams. */
53
void
loadConnections
();
54
/** Adds <b>circuit</b> to the list and the map */
55
void
addCircuit
(
const
Circuit
&circuit);
56
/** Adds <b>stream</b> to the list of circuits, under the appropriate
57
* circuit. */
58
void
addStream
(
const
Stream
&stream);
59
60
/** Called when a NEWDESC event arrives. Retrieves new router descriptors
61
* for the router identities given in <b>ids</b> and updates the router list
62
* and network map.
63
*/
64
void
newDescriptors
(
const
QStringList &ids);
65
66
/** Called when Tor has mapped the address <b>from</b> to the address
67
* <b>to</b>. <b>expires</b> indicates the time at which when the address
68
* mapping will no longer be considered valid.
69
*/
70
void
addressMapped
(
const
QString &from,
const
QString &to,
71
const
QDateTime &expires);
72
73
/** Clears all known information */
74
void
clear
();
75
76
protected
:
77
/** Called when the user changes the UI translation. */
78
void
retranslateUi
();
79
80
private
slots:
81
/** Called when the user selects the "Help" action on the toolbar. */
82
void
help
();
83
/** Called when the user selects the "Refresh" action on the toolbar */
84
void
refresh
();
85
/** Called when the user selects a circuit on the circuit list */
86
void
circuitSelected
(
const
Circuit
&circuit);
87
/** Called when the user selects one or more routers in the list. */
88
void
routerSelected
(
const
QList<RouterDescriptor> &routers);
89
/** Handles when we get connected to Tor network */
90
void
onAuthenticated
();
91
/** Handles when we get disconnected from Tor network */
92
void
onDisconnected
();
93
/** Called when the user selects a router on the network map. Displays a
94
* dialog with detailed information for the router specified by
95
* <b>id</b>.*/
96
void
displayRouterInfo
(
const
QString &
id
);
97
/** Called when the user clicks the "Zoom In" button. */
98
void
zoomIn
();
99
/** Called when the user clicks the "Zoom Out" button. */
100
void
zoomOut
();
101
/** Called when the user clicks "Full Screen" or presses Escape on the map.
102
* Toggles the map between normal and a full screen viewing modes. */
103
void
toggleFullScreen
();
104
/** Called when the search of a router is triggered by the signal
105
* returnPressed from the search field. */
106
void
onRouterSearch
();
107
108
private
:
109
/** */
110
void
setupGeoIpResolver
();
111
/** Retrieves a list of all running routers from Tor and their descriptors,
112
* and adds them to the RouterListWidget. */
113
void
loadNetworkStatus
();
114
/** Loads a list of address mappings from Tor. */
115
void
loadAddressMap
();
116
/** Adds a router to our list of servers and retrieves geographic location
117
* information for the server. */
118
void
addRouter
(
const
RouterDescriptor
&rd);
119
120
/** TorControl object used to talk to Tor. */
121
TorControl
*
_torControl
;
122
/** Timer that fires once an hour to update the router list. */
123
QTimer
_refreshTimer
;
124
/** GeoIpResolver used to geolocate routers by IP address. */
125
GeoIpResolver
_geoip
;
126
/** Stores a list of address mappings from Tor. */
127
AddressMap
_addressMap
;
128
129
/** Widget that displays the Tor network map. */
130
#if defined(USE_MARBLE)
131
TorMapWidget
*
_map
;
132
#else
133
TorMapImageView
*
_map
;
134
#endif
135
136
/** Qt Designer generated object **/
137
Ui::NetViewer
ui
;
138
};
139
140
#endif
141
Generated on Mon Jan 14 2013 08:44:27 for Vidalia by
1.8.3