Vidalia
0.2.21
|
#include <RouterStatus.h>
Public Types | |
enum | Flag { Unknown = 0x0000, Authority = 0x0001, BadExit = 0x0002, BadDirectory = 0x0004, Exit = 0x0008, Fast = 0x0010, Guard = 0x0020, HSDir = 0x0040, Named = 0x0080, Stable = 0x0100, Running = 0x0200, Valid = 0x0400, V2Dir = 0x0800, V3Dir = 0x1000 } |
Public Member Functions | |
RouterStatus (const QStringList &status) | |
QString | id () const |
QString | name () const |
QString | descriptorDigest () const |
QHostAddress | ipAddress () const |
QDateTime | published () const |
quint16 | orPort () const |
quint16 | dirPort () const |
Flags | flags () const |
bool | isRunning () const |
quint64 | bandwidth () const |
bool | isValid () const |
Private Member Functions | |
Flag | flagValue (const QString &flag) |
Private Attributes | |
bool | _valid |
QString | _name |
QString | _id |
QString | _digest |
QDateTime | _published |
QHostAddress | _ipAddress |
quint16 | _orPort |
quint16 | _dirPort |
Flags | _flags |
quint64 | _bandwidth |
Definition at line 25 of file RouterStatus.h.
enum RouterStatus::Flag |
Possible router status flags.
Unknown | |
Authority | |
BadExit | |
BadDirectory | |
Exit | |
Fast | |
Guard | |
HSDir | |
Named | |
Stable | |
Running | |
Valid | |
V2Dir | |
V3Dir |
Definition at line 29 of file RouterStatus.h.
RouterStatus::RouterStatus | ( | const QStringList & | status | ) |
Constructor.
Constructor. Parses status for router status information. The given string should match the router status entry format from Tor's dir-spec.txt. The currently recognized lines are:
"r" SP nickname SP identity SP digest SP publication SP IP SP ORPort SP DirPort NL "s" SP Flags NL
Unrecognized lines are currently ignored.
Definition at line 36 of file RouterStatus.cpp.
References _bandwidth, _digest, _dirPort, _flags, _id, _ipAddress, _name, _orPort, _published, _valid, base16_encode(), flags(), flagValue(), and TIME_FORMAT.
|
inline |
Returns the consensus bandwidth
Definition at line 71 of file RouterStatus.h.
References _bandwidth.
Referenced by RouterDescriptor::appendRouterStatusInfo().
|
inline |
Returns the hexadecimal-encoded digest of the router's most recent descriptor.
Definition at line 56 of file RouterStatus.h.
References _digest.
|
inline |
Returns the router's directory port number.
Definition at line 64 of file RouterStatus.h.
References _dirPort.
Referenced by RouterDescriptor::appendRouterStatusInfo().
|
inline |
Returns an OR-ed field of the router's current status flags.
Definition at line 67 of file RouterStatus.h.
References _flags.
Referenced by isRunning(), RouterStatus(), and RouterInfoDialog::setRouterInfo().
|
private |
Returns a Flags enum value for the given router status flag. If flag is not recognized, then Unknown is returned.
Definition at line 106 of file RouterStatus.cpp.
References Authority, BadDirectory, BadExit, Exit, Fast, Guard, HSDir, Named, Running, Stable, Unknown, V2Dir, V3Dir, and Valid.
Referenced by RouterStatus().
|
inline |
Returns the router's hexadecimal-encoded router identity key digest.
Definition at line 51 of file RouterStatus.h.
References _id.
Referenced by RouterDescriptor::appendRouterStatusInfo(), and NetViewer::loadNetworkStatus().
|
inline |
Returns the router's most recent IP address.
Definition at line 58 of file RouterStatus.h.
References _ipAddress.
Referenced by RouterDescriptor::appendRouterStatusInfo().
|
inline |
Returns true if this router is currently listed as Running.
Definition at line 69 of file RouterStatus.h.
References flags(), and Running.
Referenced by NetViewer::loadNetworkStatus().
|
inline |
Returns true if this router status object is valid. This method should be called to verify that the QStringList given in this object's constructor contained properly formatted router status lines.
Definition at line 76 of file RouterStatus.h.
References _valid.
Referenced by TorControl::getNetworkStatus(), and RouterInfoDialog::setRouterInfo().
|
inline |
Returns the router's nickname.
Definition at line 53 of file RouterStatus.h.
References _name.
Referenced by RouterDescriptor::appendRouterStatusInfo().
|
inline |
Returns the router's OR port number.
Definition at line 62 of file RouterStatus.h.
References _orPort.
Referenced by RouterDescriptor::appendRouterStatusInfo().
|
inline |
Returns the publication time of the router's most recent descriptor.
Definition at line 60 of file RouterStatus.h.
References _published.
Referenced by RouterDescriptor::appendRouterStatusInfo().
|
private |
Consensus bandwidth
Definition at line 94 of file RouterStatus.h.
Referenced by bandwidth(), and RouterStatus().
|
private |
Hexadecimal-encoded hash of the router's most recent descriptor.
Definition at line 86 of file RouterStatus.h.
Referenced by descriptorDigest(), and RouterStatus().
|
private |
Current directory port.
Definition at line 92 of file RouterStatus.h.
Referenced by dirPort(), and RouterStatus().
|
private |
OR-ed field of the router's current status flags.
Definition at line 93 of file RouterStatus.h.
Referenced by flags(), and RouterStatus().
|
private |
Hexadecimal-encoded router identity digest.
Definition at line 85 of file RouterStatus.h.
Referenced by id(), and RouterStatus().
|
private |
Current IP address.
Definition at line 90 of file RouterStatus.h.
Referenced by ipAddress(), and RouterStatus().
|
private |
Router nickname.
Definition at line 84 of file RouterStatus.h.
Referenced by name(), and RouterStatus().
|
private |
Current OR port.
Definition at line 91 of file RouterStatus.h.
Referenced by orPort(), and RouterStatus().
|
private |
The publication time of the router's most recent descriptor.
Definition at line 88 of file RouterStatus.h.
Referenced by published(), and RouterStatus().
|
private |
True if this object is a valid RouterStatus.
Definition at line 83 of file RouterStatus.h.
Referenced by isValid(), and RouterStatus().