Vidalia 0.2.10
Public Types | Public Member Functions | Private Member Functions | Private Attributes

RouterStatus Class Reference

#include <RouterStatus.h>

List of all members.

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

Detailed Description

Definition at line 26 of file RouterStatus.h.


Member Enumeration Documentation

Possible router status flags.

Enumerator:
Unknown 
Authority 
BadExit 
BadDirectory 
Exit 
Fast 
Guard 
HSDir 
Named 
Stable 
Running 
Valid 
V2Dir 
V3Dir 

Definition at line 30 of file RouterStatus.h.


Constructor & Destructor Documentation

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 37 of file RouterStatus.cpp.

References _digest, _dirPort, _flags, _id, _ipAddress, _name, _orPort, _published, _valid, base16_encode(), flags(), flagValue(), and TIME_FORMAT.


Member Function Documentation

QString RouterStatus::descriptorDigest ( ) const [inline]

Returns the hexadecimal-encoded digest of the router's most recent descriptor.

Definition at line 57 of file RouterStatus.h.

References _digest.

quint16 RouterStatus::dirPort ( ) const [inline]

Returns the router's directory port number.

Definition at line 65 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 68 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 94 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 52 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 59 of file RouterStatus.h.

References _ipAddress.

bool RouterStatus::isRunning ( ) const [inline]

Returns true if this router is currently listed as Running.

Definition at line 70 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 75 of file RouterStatus.h.

References _valid.

Referenced by TorControl::getNetworkStatus(), and RouterInfoDialog::setRouterInfo().

QString RouterStatus::name ( ) const [inline]

Returns the router's nickname.

Definition at line 54 of file RouterStatus.h.

References _name.

quint16 RouterStatus::orPort ( ) const [inline]

Returns the router's OR port number.

Definition at line 63 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 61 of file RouterStatus.h.

References _published.


Member Data Documentation

QString RouterStatus::_digest [private]

Hexadecimal-encoded hash of the router's most recent descriptor.

Definition at line 85 of file RouterStatus.h.

Referenced by descriptorDigest(), and RouterStatus().

quint16 RouterStatus::_dirPort [private]

Current directory port.

Definition at line 91 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 92 of file RouterStatus.h.

Referenced by flags(), and RouterStatus().

QString RouterStatus::_id [private]

Hexadecimal-encoded router identity digest.

Definition at line 84 of file RouterStatus.h.

Referenced by id(), and RouterStatus().

QHostAddress RouterStatus::_ipAddress [private]

Current IP address.

Definition at line 89 of file RouterStatus.h.

Referenced by ipAddress(), and RouterStatus().

QString RouterStatus::_name [private]

Router nickname.

Definition at line 83 of file RouterStatus.h.

Referenced by name(), and RouterStatus().

quint16 RouterStatus::_orPort [private]

Current OR port.

Definition at line 90 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 87 of file RouterStatus.h.

Referenced by published(), and RouterStatus().

bool RouterStatus::_valid [private]

True if this object is a valid RouterStatus.

Definition at line 82 of file RouterStatus.h.

Referenced by isValid(), and RouterStatus().


The documentation for this class was generated from the following files: