Vidalia 0.2.12
|
#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 |
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 |
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 _digest, _dirPort, _flags, _id, _ipAddress, _name, _orPort, _published, _valid, base16_encode(), flags(), flagValue(), and TIME_FORMAT.
QString RouterStatus::descriptorDigest | ( | ) | const [inline] |
Returns the hexadecimal-encoded digest of the router's most recent descriptor.
Definition at line 56 of file RouterStatus.h.
References _digest.
quint16 RouterStatus::dirPort | ( | ) | const [inline] |
Returns the router's directory port number.
Definition at line 64 of file RouterStatus.h.
References _dirPort.
Flags RouterStatus::flags | ( | ) | const [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().
RouterStatus::Flag RouterStatus::flagValue | ( | const QString & | flag | ) | [private] |
Returns a Flags enum value for the given router status flag. If flag is not recognized, then Unknown is returned.
Definition at line 93 of file RouterStatus.cpp.
References Authority, BadDirectory, BadExit, Exit, Fast, Guard, HSDir, Named, Running, Stable, Unknown, V2Dir, V3Dir, and Valid.
Referenced by RouterStatus().
QString RouterStatus::id | ( | ) | const [inline] |
Returns the router's hexadecimal-encoded router identity key digest.
Definition at line 51 of file RouterStatus.h.
References _id.
Referenced by NetViewer::loadNetworkStatus().
QHostAddress RouterStatus::ipAddress | ( | ) | const [inline] |
Returns the router's most recent IP address.
Definition at line 58 of file RouterStatus.h.
References _ipAddress.
bool RouterStatus::isRunning | ( | ) | const [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().
bool RouterStatus::isValid | ( | ) | const [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 74 of file RouterStatus.h.
References _valid.
Referenced by TorControl::getNetworkStatus(), and RouterInfoDialog::setRouterInfo().
QString RouterStatus::name | ( | ) | const [inline] |
quint16 RouterStatus::orPort | ( | ) | const [inline] |
Returns the router's OR port number.
Definition at line 62 of file RouterStatus.h.
References _orPort.
QDateTime RouterStatus::published | ( | ) | const [inline] |
Returns the publication time of the router's most recent descriptor.
Definition at line 60 of file RouterStatus.h.
References _published.
QString RouterStatus::_digest [private] |
Hexadecimal-encoded hash of the router's most recent descriptor.
Definition at line 84 of file RouterStatus.h.
Referenced by descriptorDigest(), and RouterStatus().
quint16 RouterStatus::_dirPort [private] |
Current directory port.
Definition at line 90 of file RouterStatus.h.
Referenced by dirPort(), and RouterStatus().
Flags RouterStatus::_flags [private] |
OR-ed field of the router's current status flags.
Definition at line 91 of file RouterStatus.h.
Referenced by flags(), and RouterStatus().
QString RouterStatus::_id [private] |
Hexadecimal-encoded router identity digest.
Definition at line 83 of file RouterStatus.h.
Referenced by id(), and RouterStatus().
QHostAddress RouterStatus::_ipAddress [private] |
Current IP address.
Definition at line 88 of file RouterStatus.h.
Referenced by ipAddress(), and RouterStatus().
QString RouterStatus::_name [private] |
Router nickname.
Definition at line 82 of file RouterStatus.h.
Referenced by name(), and RouterStatus().
quint16 RouterStatus::_orPort [private] |
Current OR port.
Definition at line 89 of file RouterStatus.h.
Referenced by orPort(), and RouterStatus().
QDateTime RouterStatus::_published [private] |
The publication time of the router's most recent descriptor.
Definition at line 86 of file RouterStatus.h.
Referenced by published(), and RouterStatus().
bool RouterStatus::_valid [private] |
True if this object is a valid RouterStatus.
Definition at line 81 of file RouterStatus.h.
Referenced by isValid(), and RouterStatus().