Vidalia
0.3.1
|
#include <TorEvents.h>
Public Types | |
enum | Event { Unknown = 0, Bandwidth = (1u << 0), LogDebug = (1u << 1), LogInfo = (1u << 2), LogNotice = (1u << 3), LogWarn = (1u << 4), LogError = (1u << 5), CircuitStatus = (1u << 6), StreamStatus = (1u << 7), OrConnStatus = (1u << 8), NewDescriptor = (1u << 9), AddressMap = (1u << 10), GeneralStatus = (1u << 11), ClientStatus = (1u << 12), ServerStatus = (1u << 13) } |
Signals | |
void | logMessage (tc::Severity level, const QString &msg) |
void | bandwidthUpdate (quint64 bytesReceived, quint64 bytesSent) |
void | streamStatusChanged (const Stream &stream) |
void | circuitStatusChanged (const Circuit &circuit) |
void | addressMapped (const QString &from, const QString &to, const QDateTime &expires) |
void | newDescriptors (const QStringList &ids) |
void | circuitEstablished () |
void | dangerousTorVersion (tc::TorVersionStatus reason, const QString &version, const QStringList &recommended) |
void | bootstrapStatusChanged (const BootstrapStatus &status) |
void | dangerousPort (quint16 port, bool rejected) |
void | socksError (tc::SocksError error, const QString &destination) |
void | bug (const QString &reason) |
void | externalAddressChanged (const QHostAddress &ip, const QString &hostname) |
void | clockSkewed (int skew, const QString &source) |
void | dnsHijacked () |
void | dnsUseless () |
void | checkingOrPortReachability (const QHostAddress &ip, quint16 port) |
void | orPortReachabilityFinished (const QHostAddress &ip, quint16 port, bool reachable) |
void | checkingDirPortReachability (const QHostAddress &ip, quint16 port) |
void | dirPortReachabilityFinished (const QHostAddress &ip, quint16 port, bool reachable) |
void | serverDescriptorRejected (const QHostAddress &ip, quint16 port, const QString &reason) |
void | serverDescriptorAccepted (const QHostAddress &ip, quint16 port) |
void | serverDescriptorAccepted () |
Public Member Functions | |
Q_DECLARE_FLAGS (Events, Event) | |
TorEvents (QObject *parent=0) | |
void | handleEvent (const ControlReply &reply) |
Static Public Member Functions | |
static QString | toString (TorEvents::Event e) |
Static Public Attributes | |
static const Event | EVENT_MIN = TorEvents::Bandwidth |
static const Event | EVENT_MAX = TorEvents::ServerStatus |
Private Member Functions | |
void | handleBandwidthUpdate (const ReplyLine &line) |
void | handleCircuitStatus (const ReplyLine &line) |
void | handleStreamStatus (const ReplyLine &line) |
void | handleLogMessage (const ReplyLine &line) |
void | handleOrConnStatus (const ReplyLine &line) |
void | handleNewDescriptor (const ReplyLine &line) |
void | handleAddressMap (const ReplyLine &line) |
void | handleStatusEvent (Event type, const ReplyLine &line) |
void | handleGeneralStatusEvent (tc::Severity severity, const QString &action, const QHash< QString, QString > &args) |
void | handleClientStatusEvent (tc::Severity severity, const QString &action, const QHash< QString, QString > &args) |
void | handleServerStatusEvent (tc::Severity severity, const QString &action, const QHash< QString, QString > &args) |
Static Private Member Functions | |
static Event | parseEventType (const ReplyLine &line) |
static Event | toTorEvent (const QString &event) |
static QPair< QHostAddress, quint16 > | splitAddress (const QString &address) |
Definition at line 37 of file TorEvents.h.
enum TorEvents::Event |
Asynchronous events sent from Tor to the controller
Enumerator | |
---|---|
Unknown | |
Bandwidth | |
LogDebug | |
LogInfo | |
LogNotice | |
LogWarn | |
LogError | |
CircuitStatus | |
StreamStatus | |
OrConnStatus | |
NewDescriptor | |
AddressMap | |
GeneralStatus | |
ClientStatus | |
ServerStatus |
Definition at line 43 of file TorEvents.h.
TorEvents::TorEvents | ( | QObject * | parent = 0 | ) |
|
signal |
Emitted when Tor has mapped the address from to the address to. expires indicates the time at which when the address mapping will no longer be considered valid.
Referenced by handleAddressMap().
|
signal |
Emitted when Tor sends a bandwidth usage update (roughly once every second). bytesReceived is the number of bytes read by Tor over the previous second and bytesWritten is the number of bytes sent over the same interval.
Referenced by handleBandwidthUpdate().
|
signal |
Emitted during Tor's startup process to indicate how far in its bootstrapping process it has progressed. status may indicate the current bootstrapping stage or an error during bootstrapping.
Referenced by handleClientStatusEvent().
|
signal |
Emitted when Tor has encountered an internal bug. reason is Tor's description of the bug.
Referenced by handleGeneralStatusEvent().
|
signal |
Indicates Tor has started testing the reachability of its directory port using the IP address ip and port port.
Referenced by handleServerStatusEvent().
|
signal |
Indicates Tor has started testing the reachability of its OR port using the IP address ip and port port.
Referenced by handleServerStatusEvent().
|
signal |
Indicates Tor has been able to successfully establish one or more circuits.
Referenced by handleClientStatusEvent().
Emitted when the circuit status of circuit has changed.
Referenced by handleCircuitStatus().
|
signal |
Indicates that Tor has determined the client's clock is potentially skewed by skew seconds relative to source.
Referenced by handleGeneralStatusEvent().
Emitted when the user attempts to establish a connection to some destination on port port, which is a port known to use plaintext connections (as determined by Tor's WarnPlaintextPorts and RejectPlaintextPorts torrc options). rejected indicates whether Tor rejected the connection or permitted it to connect anyway.
Referenced by handleClientStatusEvent().
|
signal |
Indicates that Tor has decided the user's Tor software version is no longer recommended for some reason. recommended is a list of Tor software versions that are considered current.
Referenced by handleGeneralStatusEvent().
|
signal |
Tor has completed testing the reachability of its directory port using the IP address ip and port port. If the user's directory port was reachable, reachable will be set to true.
Referenced by handleServerStatusEvent().
|
signal |
Emitted when Tor determines that the user's DNS provider is providing an address for non-existent domains when it should really be saying "NXDOMAIN".
Referenced by handleServerStatusEvent().
|
signal |
Emitted when Tor determines that the user's DNS provider is providing a hijacked address even for well-known websites.
Referenced by handleServerStatusEvent().
|
signal |
Emitted when Tor decides the client's external IP address has changed to ip. If hostname is non-empty, Tor obtained the new value for ip by resolving hostname.
Referenced by handleServerStatusEvent().
Handles a new or updated address map event.
Handles a new or updated address mapping event. The format for event messages of this type is:
"650" SP "ADDRMAP" SP Address SP Address SP Expiry Expiry = DQUOTE ISOTime DQUOTE / "NEVER"
Expiry is expressed as the local time (rather than GMT).
Definition at line 266 of file TorEvents.cpp.
References addressMapped(), DATE_FMT, and ReplyLine::getMessage().
Referenced by handleEvent().
Handle a bandwidth update event
Handle a bandwidth update event, to inform the controller of the bandwidth used in the last second. The format of this message is:
"650" SP "BW" SP BytesRead SP BytesWritten BytesRead = 1*DIGIT BytesWritten = 1*DIGIT
Definition at line 160 of file TorEvents.cpp.
References bandwidthUpdate(), and ReplyLine::getMessage().
Referenced by handleEvent().
Handle a circuit status event
Handle a circuit status event. The format of this message is:
"650" SP "CIRC" SP CircuitID SP CircStatus SP Path CircStatus = "LAUNCHED" / ; circuit ID assigned to new circuit "BUILT" / ; all hops finished, can now accept streams "EXTENDED" / ; one more hop has been completed "FAILED" / ; circuit closed (was not built) "CLOSED" ; circuit closed (was built) Path = ServerID *("," ServerID)
Definition at line 184 of file TorEvents.cpp.
References circuitStatusChanged(), ReplyLine::getMessage(), i(), and Circuit::isValid().
Referenced by handleEvent().
|
private |
Parses and posts a Tor client status event.
Parses and emits a Tor client status event.
Definition at line 353 of file TorEvents.cpp.
References BootstrapStatus::actionFromString(), tc::BadSocksHostnameError, bootstrapStatusChanged(), circuitEstablished(), tc::connectionStatusReasonFromString(), dangerousPort(), tc::DangerousSocksTypeError, socksError(), BootstrapStatus::statusFromString(), and tc::UnknownSocksProtocolError.
Referenced by handleStatusEvent().
void TorEvents::handleEvent | ( | const ControlReply & | reply | ) |
Parses an event message and emits the proper signal
Handles an event message from Tor. An event message can potentially have more than one line, so we will iterate through them all and dispatch the necessary events.
Definition at line 124 of file TorEvents.cpp.
References AddressMap, Bandwidth, CircuitStatus, ClientStatus, GeneralStatus, ControlReply::getLines(), handleAddressMap(), handleBandwidthUpdate(), handleCircuitStatus(), handleLogMessage(), handleNewDescriptor(), handleStatusEvent(), handleStreamStatus(), LogDebug, LogError, LogInfo, LogNotice, LogWarn, NewDescriptor, parseEventType(), ServerStatus, and StreamStatus.
Referenced by ControlConnection::onReadyRead().
|
private |
Parses and posts a general Tor status event.
Parses and emits a general Tor status event.
Definition at line 321 of file TorEvents.cpp.
References bug(), clockSkewed(), dangerousTorVersion(), tc::NewTorVersion, tc::ObsoleteTorVersion, and tc::UnrecommendedTorVersion.
Referenced by handleStatusEvent().
Handle a log message event
Handle a log message event. The format of this message is: The syntax is:
"650" SP Severity SP ReplyText or "650+" Severity CRLF Data Severity = "DEBUG" / "INFO" / "NOTICE" / "WARN"/ "ERR"
Definition at line 233 of file TorEvents.cpp.
References ReplyLine::getData(), ReplyLine::getMessage(), i(), logMessage(), and tc::severityFromString().
Referenced by handleEvent().
Handles a new list of descriptors event.
Handles a new descriptor event. The format for event messages of this type is:
"650" SP "NEWDESC" 1*(SP ServerID)
Definition at line 250 of file TorEvents.cpp.
References ReplyLine::getMessage(), and newDescriptors().
Referenced by handleEvent().
Handle an OR connection status event.
|
private |
Parses and posts a Tor server status event.
Parses and emits a Tor server status event.
Definition at line 384 of file TorEvents.cpp.
References checkingDirPortReachability(), checkingOrPortReachability(), dirPortReachabilityFinished(), dnsHijacked(), dnsUseless(), externalAddressChanged(), orPortReachabilityFinished(), serverDescriptorAccepted(), serverDescriptorRejected(), and splitAddress().
Referenced by handleStatusEvent().
Handles a Tor status event.
Handles a Tor status event. The format for event messages of this type is:
"650" SP StatusType SP StatusSeverity SP StatusAction [SP StatusArguments] CRLF
StatusType = "STATUS_GENERAL" / "STATUS_CLIENT" / "STATUS_SERVER" StatusSeverity = "NOTICE" / "WARN" / "ERR" StatusAction = 1*ALPHA StatusArguments = StatusArgument *(SP StatusArgument) StatusArgument = StatusKeyword '=' StatusValue StatusKeyword = 1*(ALNUM / "_") StatusValue = 1*(ALNUM / '_') / QuotedString
Definition at line 291 of file TorEvents.cpp.
References ClientStatus, GeneralStatus, ReplyLine::getMessage(), handleClientStatusEvent(), handleGeneralStatusEvent(), handleServerStatusEvent(), ServerStatus, tc::severityFromString(), and string_parse_keyvals().
Referenced by handleEvent().
Handle a stream status event
Handle a stream status event. The format of this message is:
"650" SP "STREAM" SP StreamID SP StreamStatus SP CircID SP Target SP StreamStatus = "NEW" / ; New request to connect "NEWRESOLVE" / ; New request to resolve an address "SENTCONNECT" / ; Sent a connect cell along a circuit "SENTRESOLVE" / ; Sent a resolve cell along a circuit "SUCCEEDED" / ; Received a reply; stream established "FAILED" / ; Stream failed and not retriable. "CLOSED" / ; Stream closed "DETACHED" ; Detached from circuit; still retriable. Target = Address ":" Port
If the circuit ID is 0, then the stream is unattached.
Definition at line 213 of file TorEvents.cpp.
References Stream::fromString(), ReplyLine::getMessage(), i(), Stream::isValid(), and streamStatusChanged().
Referenced by handleEvent().
|
signal |
Emitted when Tor writes the message msg to the control port with message severity level.
Referenced by handleLogMessage().
|
signal |
Emitted when Tor has received one or more new router descriptors. ids contains a list of digests of the new descriptors.
Referenced by handleNewDescriptor().
|
signal |
Tor has completed testing the reachability of its OR port using the IP address ip and port port. If the user's OR port was reachable, reachable will be set to true.
Referenced by handleServerStatusEvent().
|
staticprivate |
Parses the event type from the event message
Parse the event type out of a message line and return the corresponding Event enum value
Definition at line 113 of file TorEvents.cpp.
References ReplyLine::getMessage(), i(), and toTorEvent().
Referenced by handleEvent().
TorEvents::Q_DECLARE_FLAGS | ( | Events | , |
Event | |||
) |
|
signal |
Emitted when at least one directory authority has accepted the user's server descriptor.
Referenced by handleServerStatusEvent().
|
signal |
Emitted when the directory authority with IP address ip and port port accepted the user's server descriptor.
|
signal |
Emitted when the directory authority with IP address ip and port port rejected the user's server descriptor. reason describes why the descriptor was rejected (e.g., malformed, skewed clock, etc.).
Referenced by handleServerStatusEvent().
|
signal |
Emitted when Tor detects a problem with a SOCKS connection from the user, such as a bad hostname, dangerous SOCKS protocol type, or a bad hostname. type indicates the type of error encountered and destination (if non-empty) specifies the attempted connection destination address or hostname.
Referenced by handleClientStatusEvent().
|
staticprivate |
Splits a string in the form "IP:PORT" into a QHostAddress and quint16 pair. If either portion is invalid, a default-constructed QPair() is returned.
Definition at line 443 of file TorEvents.cpp.
Referenced by handleServerStatusEvent().
Emitted when the stream status of stream has changed.
Referenced by handleStreamStatus().
|
static |
Converts an Event to a string
Converts an event type to a string Tor understands
Definition at line 51 of file TorEvents.cpp.
References AddressMap, Bandwidth, CircuitStatus, ClientStatus, GeneralStatus, LogDebug, LogError, LogInfo, LogNotice, LogWarn, NewDescriptor, ServerStatus, and StreamStatus.
Referenced by TorControl::setEvents().
|
staticprivate |
Converts a string to an Event
Converts an event in the string form sent by Tor to its enum value
Definition at line 75 of file TorEvents.cpp.
References AddressMap, Bandwidth, CircuitStatus, ClientStatus, GeneralStatus, LogDebug, LogError, LogInfo, LogNotice, LogWarn, NewDescriptor, ServerStatus, StreamStatus, and Unknown.
Referenced by parseEventType().
|
static |
Definition at line 61 of file TorEvents.h.
Referenced by TorControl::setEvents().
|
static |
Definition at line 60 of file TorEvents.h.
Referenced by TorControl::setEvents().