Vidalia
0.3.1
|
#include <TorControlPrototype.h>
Public Slots | |
bool | closeCircuit (const CircuitId &circId, bool ifUnused=false, QString *errmsg=0) |
bool | closeStream (const StreamId &streamId, QString *errmsg=0) |
Signals | |
void | started () |
void | startFailed (QString errmsg) |
void | stopped (int exitCode, QProcess::ExitStatus exitStatus) |
void | stopped () |
void | connected () |
void | connectFailed (QString errmsg) |
void | disconnected () |
void | authenticated () |
void | authenticationFailed (QString errmsg) |
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 type, const QString &destination) |
void | externalAddressChanged (const QHostAddress &ip, const QString &hostname) |
void | clockSkewed (int skew, const QString &source) |
void | bug (const QString &reason) |
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 | |
TorControlPrototype () | |
Q_INVOKABLE void | start (const QString &tor, const QStringList &args) |
Q_INVOKABLE QVariant | stop () |
Q_INVOKABLE bool | isRunning () |
Q_INVOKABLE bool | isVidaliaRunningTor () |
Q_INVOKABLE void | closeTorStdout () |
Q_INVOKABLE void | connect (const QHostAddress &address, quint16 port) |
Q_INVOKABLE void | connect (const QString &path) |
Q_INVOKABLE void | disconnect () |
Q_INVOKABLE bool | isConnected () |
Q_INVOKABLE QVariant | authenticate (const QByteArray cookie) |
Q_INVOKABLE QVariant | authenticate (const QString &password=QString()) |
Q_INVOKABLE bool | isCircuitEstablished () |
Q_INVOKABLE QVariant | getInfo (QHash< QString, QString > &map) |
Q_INVOKABLE QVariant | getInfo (const QString &key) |
Q_INVOKABLE QVariant | signal (TorSignal::Signal sig) |
Q_INVOKABLE QStringList | getSocksAddressList (QString *errmsg=0) |
Q_INVOKABLE QVariant | getSocksPort () |
Q_INVOKABLE QList< quint16 > | getSocksPortList (QString *errmsg=0) |
Q_INVOKABLE QString | getTorVersionString () |
Q_INVOKABLE quint32 | getTorVersion () |
Q_INVOKABLE QVariant | setEvent (TorEvents::Event e, bool add=true, bool set=true) |
Q_INVOKABLE QVariant | setEvents () |
Q_INVOKABLE QVariant | setConf (QHash< QString, QString > map) |
Q_INVOKABLE QVariant | setConf (QString key, QString value) |
Q_INVOKABLE QVariant | setConf (QString keyAndValue) |
Q_INVOKABLE bool | getConf (QHash< QString, QString > &map, QString *errmsg) |
Q_INVOKABLE bool | getConf (QHash< QString, QStringList > &map, QString *errmsg=0) |
Q_INVOKABLE QVariant | getConf (QString key) |
Q_INVOKABLE bool | getConf (QString key, QStringList &value, QString *errmsg=0) |
Q_INVOKABLE QVariantMap | getConf (const QStringList &keys, QString *errmsg=0) |
Q_INVOKABLE QVariant | getHiddenServiceConf (const QString &key) |
Q_INVOKABLE QVariant | saveConf () |
Q_INVOKABLE bool | resetConf (QStringList keys, QString *errmsg=0) |
Q_INVOKABLE QVariant | resetConf (QString key) |
Q_INVOKABLE QStringList | getRouterDescriptorText (const QString &id, QString *errmsg=0) |
Q_INVOKABLE RouterDescriptor | getRouterDescriptor (const QString &id, QString *errmsg=0) |
Q_INVOKABLE RouterStatus | getRouterStatus (const QString &id, QString *errmsg=0) |
Q_INVOKABLE NetworkStatus | getNetworkStatus (QString *errmsg=0) |
Q_INVOKABLE DescriptorAnnotations | getDescriptorAnnotations (const QString &id, QString *errmsg=0) |
Q_INVOKABLE CircuitList | getCircuits (QString *errmsg=0) |
Q_INVOKABLE StreamList | getStreams (QString *errmsg=0) |
Q_INVOKABLE AddressMap | getAddressMap (AddressMap::AddressMapType type=AddressMap::AddressMapAll, QString *errmsg=0) |
Q_INVOKABLE QVariant | ipToCountry (const QHostAddress &ip) |
Static Public Member Functions | |
static int | metaTypeId () |
static QString | name () |
Definition at line 25 of file TorControlPrototype.h.
TorControlPrototype::TorControlPrototype | ( | ) |
Definition at line 68 of file TorControlPrototype.cpp.
|
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.
Q_INVOKABLE QVariant TorControlPrototype::authenticate | ( | const QByteArray | cookie | ) |
Sends an authentication cookie to Tor.
Q_INVOKABLE QVariant TorControlPrototype::authenticate | ( | const QString & | password = QString() | ) |
Sends an authentication password to Tor.
|
signal |
Emitted when the control socket is connected and authenticated.
|
signal |
Emitted when Tor rejects our authentication attempt.
|
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.
|
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.
|
signal |
Emitted when Tor has encountered an internal bug. reason is Tor's description of the bug.
|
signal |
Indicates Tor has started testing the reachability of its directory port using the IP address ip and port port.
|
signal |
Indicates Tor has started testing the reachability of its OR port using the IP address ip and port port.
|
signal |
Indicates Tor has been able to successfully establish one or more circuits.
Emitted when the circuit status of circuit has changed.
|
signal |
Indicates that Tor has determined the client's clock is potentially skewed by skew seconds relative to source.
|
slot |
Closes the circuit specified by circId. If ifUnused is true, then the circuit will not be closed unless it is unused.
Closes the stream specified by streamId.
Definition at line 422 of file TorControlPrototype.cpp.
References TorControl::closeStream().
Q_INVOKABLE void TorControlPrototype::closeTorStdout | ( | ) |
Stops reading log messages from the Tor process's stdout. This has no effect if isVidaliaRunningTor() is false.
Q_INVOKABLE void TorControlPrototype::connect | ( | const QHostAddress & | address, |
quint16 | port | ||
) |
Connect to Tor's control socket
Q_INVOKABLE void TorControlPrototype::connect | ( | const QString & | path | ) |
|
signal |
Emitted when the controller has connected to Tor
|
signal |
Emitted when the controller failed to connect to Tor.
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.
|
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.
|
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.
Q_INVOKABLE void TorControlPrototype::disconnect | ( | ) |
Disconnect from Tor's control socket
|
signal |
Emitted when the controller has disconnected from Tor
|
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".
|
signal |
Emitted when Tor determines that the user's DNS provider is providing a hijacked address even for well-known websites.
|
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.
AddressMap TorControlPrototype::getAddressMap | ( | AddressMap::AddressMapType | type = AddressMap::AddressMapAll , |
QString * | errmsg = 0 |
||
) |
Gets a list of address mappings of the type specified by type (defaults to AddressMapAll.
Definition at line 398 of file TorControlPrototype.cpp.
References TorControl::getAddressMap().
CircuitList TorControlPrototype::getCircuits | ( | QString * | errmsg = 0 | ) |
Gets a list of current circuits.
Definition at line 378 of file TorControlPrototype.cpp.
References TorControl::getCircuits().
Q_INVOKABLE bool TorControlPrototype::getConf | ( | QHash< QString, QString > & | map, |
QString * | errmsg | ||
) |
Gets values for a set of configuration keys, each of which has a single value.
bool TorControlPrototype::getConf | ( | QHash< QString, QStringList > & | map, |
QString * | errmsg = 0 |
||
) |
Gets a set of configuration keyvalues and stores them in map.
Definition at line 262 of file TorControlPrototype.cpp.
References TorControl::getConf().
Q_INVOKABLE QVariant TorControlPrototype::getConf | ( | QString | key | ) |
Gets a single configuration value for key.
Q_INVOKABLE bool TorControlPrototype::getConf | ( | QString | key, |
QStringList & | value, | ||
QString * | errmsg = 0 |
||
) |
Gets a list of configuration values for key.
QVariantMap TorControlPrototype::getConf | ( | const QStringList & | keys, |
QString * | errmsg = 0 |
||
) |
Sends a GETCONF message to Tor using the given list of keys and returns a QVariantMap containing the specified keys and their values as returned by Tor. Returns a default constructed QVariantMap on failure.
Definition at line 286 of file TorControlPrototype.cpp.
References DEF_TYPE1, TorControl::getConf(), getHiddenServiceConf(), and saveConf().
DescriptorAnnotations TorControlPrototype::getDescriptorAnnotations | ( | const QString & | id, |
QString * | errmsg = 0 |
||
) |
Returns the annotations for the router whose fingerprint matches id. If id is invalid or the router's descriptor cannot be parsed, then an empty DescriptorAnnotations is returned and errmsg is set if it's not NULL. (Tor >= 0.2.0.13-alpha only)
Definition at line 368 of file TorControlPrototype.cpp.
References TorControl::getDescriptorAnnotations().
Q_INVOKABLE QVariant TorControlPrototype::getHiddenServiceConf | ( | const QString & | key | ) |
Sends a GETCONF message to Tor with a single key and returns a QVariant containing the value returned by Tor. Returns a default constructed QVariant on failure. Sends a GETCONF message to Tor with the single key and returns a QString containing the value returned by Tor
Referenced by getConf().
Q_INVOKABLE QVariant TorControlPrototype::getInfo | ( | QHash< QString, QString > & | map | ) |
Sends a GETINFO message to Tor based on the given keys
Q_INVOKABLE QVariant TorControlPrototype::getInfo | ( | const QString & | key | ) |
Sends a GETINFO message for a single info value to Tor Sends a GETINFO message to Tor using the given list of keys and returns a QVariantMap containing the specified keys and their values as returned by Tor. Returns a default constructed QVariantMap on failure. Sends a GETINFO message to Tor with a single key and returns a QVariant containing the value returned by Tor. Returns a default constructed QVariant on failure.
NetworkStatus TorControlPrototype::getNetworkStatus | ( | QString * | errmsg = 0 | ) |
Returns a RouterStatus object for every known router in the network. If the network status document cannot be parsed, then an empty NetworkStatus is returned.
Definition at line 358 of file TorControlPrototype.cpp.
References TorControl::getNetworkStatus().
RouterDescriptor TorControlPrototype::getRouterDescriptor | ( | const QString & | id, |
QString * | errmsg = 0 |
||
) |
Returns the descriptor for the router whose fingerprint matches id. If id is invalid or the router's descriptor cannot be parsed, then an invalid RouterDescriptor is returned.
Definition at line 338 of file TorControlPrototype.cpp.
References TorControl::getRouterDescriptor().
Q_INVOKABLE QStringList TorControlPrototype::getRouterDescriptorText | ( | const QString & | id, |
QString * | errmsg = 0 |
||
) |
Returns an unparsed router descriptor for the router whose fingerprint matches id. The returned text can later be parsed by the RouterDescriptor class. If id is invalid, then an empty QStringList is returned.
RouterStatus TorControlPrototype::getRouterStatus | ( | const QString & | id, |
QString * | errmsg = 0 |
||
) |
Returns the status of the router whose fingerprint matches id. If id is invalid or the router's status cannot be parsed, then an invalid RouterStatus is returned.
Definition at line 348 of file TorControlPrototype.cpp.
References TorControl::getRouterStatus().
Q_INVOKABLE QStringList TorControlPrototype::getSocksAddressList | ( | QString * | errmsg = 0 | ) |
Returns an address on which Tor is listening for application requests. If none are available, a null QHostAddress is returned. Returns a (possibly empty) list of all currently configured SocksListenAddress entries.
Q_INVOKABLE QVariant TorControlPrototype::getSocksPort | ( | ) |
Returns a valid SOCKS port for Tor, or 0 if Tor is not accepting application requests.
Q_INVOKABLE QList<quint16> TorControlPrototype::getSocksPortList | ( | QString * | errmsg = 0 | ) |
Returns a list of all currently configured SOCKS ports. If Tor is not accepting any application connections, an empty list will be returned.
StreamList TorControlPrototype::getStreams | ( | QString * | errmsg = 0 | ) |
Gets a list of current streams.
Definition at line 388 of file TorControlPrototype.cpp.
References TorControl::getStreams().
Q_INVOKABLE quint32 TorControlPrototype::getTorVersion | ( | ) |
Returns Tor's version as a numeric value.
Q_INVOKABLE QString TorControlPrototype::getTorVersionString | ( | ) |
Returns Tor's version as a string.
Referenced by DEF_TYPE1().
Q_INVOKABLE QVariant TorControlPrototype::ipToCountry | ( | const QHostAddress & | ip | ) |
Gets the ISO-3166 two-letter country code for ip from Tor. Returns a default-constructed QString on failure or if a country code is not known for ip. On failure, errmsg will be set if it's not NULL.
Q_INVOKABLE bool TorControlPrototype::isCircuitEstablished | ( | ) |
Sends a PROTOCOLINFO command to Tor and parses the response. Returns the Tor software's current bootstrap phase and status. Returns true if Tor either has an open circuit or (on Tor >= 0.2.0.1-alpha) has previously decided it's able to establish a circuit.
Q_INVOKABLE bool TorControlPrototype::isConnected | ( | ) |
Check if we're connected to Tor's control socket
Q_INVOKABLE bool TorControlPrototype::isRunning | ( | ) |
Detect if the Tor process is running
Q_INVOKABLE bool TorControlPrototype::isVidaliaRunningTor | ( | ) |
Detects if the Tor process is running under Vidalia.
|
signal |
Emitted when Tor writes the message msg to the control port with message severity level.
|
static |
Definition at line 72 of file TorControlPrototype.cpp.
|
static |
Definition at line 77 of file TorControlPrototype.cpp.
|
signal |
Emitted when Tor has received one or more new router descriptors. ids contains a list of digests of the new descriptors.
|
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.
Tells Tor to reset the given configuration keys back to defaults.
Definition at line 314 of file TorControlPrototype.cpp.
References TorControl::resetConf().
Q_INVOKABLE QVariant TorControlPrototype::resetConf | ( | QString | key | ) |
Tells Tor to reset a configuration key back to its default value.
Q_INVOKABLE QVariant TorControlPrototype::saveConf | ( | ) |
Asks Tor to save the current configuration to its torrc
Referenced by getConf().
|
signal |
Emitted when the directory authority with IP address ip and port port accepted the user's server descriptor.
|
signal |
Emitted when at least one directory authority has 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.).
Q_INVOKABLE QVariant TorControlPrototype::setConf | ( | QHash< QString, QString > | map | ) |
Sets each configuration key in map to the value associated with its key.
Q_INVOKABLE QVariant TorControlPrototype::setConf | ( | QString | key, |
QString | value | ||
) |
Sets a single configuration key to the given value.
Q_INVOKABLE QVariant TorControlPrototype::setConf | ( | QString | keyAndValue | ) |
Sets a single configuration string that is formatted <key=escaped value>.
Q_INVOKABLE QVariant TorControlPrototype::setEvent | ( | TorEvents::Event | e, |
bool | add = true , |
||
bool | set = true |
||
) |
Sets an event and its handler. If add is true, then the event is added, otherwise it is removed. If set is true, then the given event will be registered with Tor.
Q_INVOKABLE QVariant TorControlPrototype::setEvents | ( | ) |
Register events of interest with Tor
Q_INVOKABLE QVariant TorControlPrototype::signal | ( | TorSignal::Signal | sig | ) |
Sends a signal to Tor
|
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.
Q_INVOKABLE void TorControlPrototype::start | ( | const QString & | tor, |
const QStringList & | args | ||
) |
Start the Tor process
Referenced by name().
|
signal |
Emitted when the Tor process has started
|
signal |
Emitted when the Tor process fails to start.
Q_INVOKABLE QVariant TorControlPrototype::stop | ( | ) |
Stop the Tor process
|
signal |
Emitted when the Tor process has stopped
|
signal |
Emitted when the Tor process has stopped.
Emitted when the stream status of stream has changed.