#include <stream.h>
Public Types | |
enum | Status { Unknown, New, NewResolve, SentConnect, SentResolve, Succeeded, Failed, Closed, Detached, Remap } |
Public Member Functions | |
Stream () | |
Stream (const StreamId &streamId, Status status, const CircuitId &circuitId, const QString &target) | |
Stream (const StreamId &streamId, Status status, const CircuitId &circuitId, const QString &address, quint16 port) | |
bool | isValid () const |
StreamId | id () const |
Status | status () const |
QString | statusString () const |
CircuitId | circuitId () const |
QString | target () const |
QString | targetAddress () const |
quint16 | targetPort () const |
Static Public Member Functions | |
static Stream | fromString (const QString &stream) |
static Status | toStatus (const QString &strStatus) |
static bool | isValidStreamId (const StreamId &streamId) |
Private Attributes | |
StreamId | _streamId |
CircuitId | _circuitId |
QString | _address |
Status | _status |
quint16 | _port |
Definition at line 31 of file stream.h.
enum Stream::Status |
Stream status values
Unknown | Unknown status type given |
New | New request to connect |
NewResolve | New request to resolve an address |
SentConnect | Sent a connect cell |
SentResolve | Sent a resolve cell |
Succeeded | Stream established |
Failed | Stream failed |
Closed | Stream closed |
Detached | Detached from circuit |
Remap | Address re-mapped to another |
Stream::Stream | ( | ) |
Default constructor
Default constructor.
Definition at line 24 of file stream.cpp.
References _port, _status, and Unknown.
Referenced by fromString().
Stream::Stream | ( | const StreamId & | streamId, | |
Status | status, | |||
const CircuitId & | circuitId, | |||
const QString & | target | |||
) |
Constructor
Definition at line 43 of file stream.cpp.
References _address, _circuitId, _port, _status, _streamId, and i().
Stream::Stream | ( | const StreamId & | streamId, | |
Status | status, | |||
const CircuitId & | circuitId, | |||
const QString & | address, | |||
quint16 | port | |||
) |
Constructor
Definition at line 31 of file stream.cpp.
References _address, _circuitId, _port, _status, and _streamId.
CircuitId Stream::circuitId | ( | ) | const [inline] |
Returns the ID of the circuit to which this stream is assigned.
Definition at line 74 of file stream.h.
References _circuitId.
Referenced by NetViewer::addStream(), CircuitListWidget::addStream(), and StreamEvent::circuitId().
Stream Stream::fromString | ( | const QString & | stream | ) | [static] |
Parses the given string for a stream, in Tor control protocol format.
Parses the given string for stream information, given in Tor control protocol format. The format is:
StreamID SP StreamStatus SP CircID SP Target
Definition at line 64 of file stream.cpp.
References status(), Stream(), target(), and toStatus().
Referenced by TorControl::getStreams(), and TorEvents::handleStreamStatus().
StreamId Stream::id | ( | ) | const [inline] |
Returns the ID for this stream.
Definition at line 68 of file stream.h.
References _streamId.
Referenced by NetViewer::addStream(), CircuitListWidget::addStream(), StreamEvent::id(), and StreamItem::StreamItem().
bool Stream::isValid | ( | ) | const |
Returns true iff the Stream object's fields are all valid.
Returns true if all fields in this Stream object are valid.
Definition at line 147 of file stream.cpp.
References _address, _circuitId, _status, _streamId, Circuit::isValidCircuitId(), isValidStreamId(), and Unknown.
Referenced by TorControl::getStreams().
bool Stream::isValidStreamId | ( | const StreamId & | streamId | ) | [static] |
Returns true iff streamId consists of only between 1 and 16 (inclusive) ASCII-encoded letters and numbers.
Definition at line 85 of file stream.cpp.
References i().
Referenced by isValid().
Status Stream::status | ( | ) | const [inline] |
Returns the status for this stream.
Definition at line 70 of file stream.h.
References _status.
Referenced by NetViewer::addStream(), CircuitListWidget::addStream(), fromString(), StreamEvent::status(), and statusString().
QString Stream::statusString | ( | ) | const |
Returns a string representation of this stream's status.
Returns a human-understandable string representation of this stream's status.
Definition at line 127 of file stream.cpp.
References _status, Closed, Detached, Failed, New, NewResolve, Remap, SentConnect, SentResolve, status(), and Succeeded.
Referenced by StreamItem::update().
QString Stream::target | ( | ) | const [inline] |
Returns the target address and port for this stream.
Definition at line 76 of file stream.h.
References _address, and _port.
Referenced by fromString(), StreamEvent::target(), and StreamItem::update().
QString Stream::targetAddress | ( | ) | const [inline] |
Returns the target address for this stream.
Definition at line 78 of file stream.h.
References _address.
Referenced by NetViewer::addStream().
quint16 Stream::targetPort | ( | ) | const [inline] |
Returns the target port for this stream.
Definition at line 80 of file stream.h.
References _port.
Referenced by NetViewer::addStream().
Stream::Status Stream::toStatus | ( | const QString & | strStatus | ) | [static] |
Converts a string description of a stream's status to its enum value
Definition at line 101 of file stream.cpp.
References Closed, Detached, Failed, New, NewResolve, Remap, SentConnect, SentResolve, Succeeded, and Unknown.
Referenced by fromString().
QString Stream::_address [private] |
CircuitId Stream::_circuitId [private] |
ID of the circuit carrying this stream.
Definition at line 88 of file stream.h.
Referenced by circuitId(), isValid(), and Stream().
quint16 Stream::_port [private] |
Status Stream::_status [private] |
StreamId Stream::_streamId [private] |