Stream Class Reference

#include <stream.h>

List of all members.

Public Types

enum  Status {
  Unknown, New, NewResolve, SentConnect,
  SentResolve, Succeeded, Failed, Closed,
  Detached, Remap
}

Public Member Functions

 Stream ()
 Stream (quint64 streamId, Status status, quint64 circuitId, QString target)
 Stream (quint64 streamId, Status status, quint64 circuitId, QString address, quint16 port)
bool isEmpty () const
quint64 id () const
Status status () const
QString statusString () const
quint64 circuitId () const
QString target () const
QString targetAddress () const
quint16 targetPort () const

Static Public Member Functions

static Stream fromString (QString stream)
static Status toStatus (QString strStatus)

Private Attributes

quint64 _streamId
Status _status
quint64 _circuitId
QString _address
quint16 _port


Detailed Description

Definition at line 26 of file stream.h.


Member Enumeration Documentation

Stream status values

Enumerator:
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

Definition at line 32 of file stream.h.


Constructor & Destructor Documentation

Stream::Stream (  ) 

Default constructor

Default constructor.

Definition at line 23 of file stream.cpp.

References _circuitId, _port, _status, _streamId, and Unknown.

Referenced by fromString().

Stream::Stream ( quint64  streamId,
Status  status,
quint64  circuitId,
QString  target 
)

Constructor

Definition at line 43 of file stream.cpp.

References _address, _circuitId, _port, _status, _streamId, and i().

Stream::Stream ( quint64  streamId,
Status  status,
quint64  circuitId,
QString  address,
quint16  port 
)

Constructor

Definition at line 32 of file stream.cpp.

References _address, _circuitId, _port, _status, and _streamId.


Member Function Documentation

Stream Stream::fromString ( 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 63 of file stream.cpp.

References status(), Stream(), target(), and toStatus().

Referenced by TorControl::getStreams(), and TorEvents::handleStreamStatus().

Stream::Status Stream::toStatus ( QString  strStatus  )  [static]

Converts a string description of a stream's status to its enum value

Definition at line 83 of file stream.cpp.

References Closed, Detached, Failed, New, NewResolve, Remap, SentConnect, SentResolve, status(), Succeeded, and Unknown.

Referenced by fromString().

bool Stream::isEmpty (  )  const

Returns true if the Stream object's fields are all empty.

Returns true if all fields in this Stream object are empty.

Definition at line 134 of file stream.cpp.

References _address, _circuitId, _port, _status, _streamId, and Unknown.

Referenced by TorControl::getStreams().

quint64 Stream::id (  )  const [inline]

Returns the ID for this stream.

Definition at line 62 of file stream.h.

References _streamId.

Referenced by NetViewer::addStream(), CircuitListWidget::addStream(), StreamEvent::id(), and StreamItem::StreamItem().

Status Stream::status (  )  const [inline]

Returns the status for this stream.

Definition at line 64 of file stream.h.

References _status.

Referenced by NetViewer::addStream(), CircuitListWidget::addStream(), fromString(), StreamEvent::status(), statusString(), and toStatus().

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 114 of file stream.cpp.

References _status, Closed, Detached, Failed, New, NewResolve, Remap, SentConnect, SentResolve, status(), and Succeeded.

Referenced by StreamItem::update().

quint64 Stream::circuitId (  )  const [inline]

Returns the ID of the circuit to which this stream is assigned.

Definition at line 68 of file stream.h.

References _circuitId.

Referenced by NetViewer::addStream(), CircuitListWidget::addStream(), and StreamEvent::circuitId().

QString Stream::target (  )  const [inline]

Returns the target address and port for this stream.

Definition at line 70 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 72 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 74 of file stream.h.

References _port.

Referenced by NetViewer::addStream().


Member Data Documentation

quint64 Stream::_streamId [private]

Unique ID associated with this stream.

Definition at line 77 of file stream.h.

Referenced by id(), isEmpty(), and Stream().

Stream status value.

Definition at line 78 of file stream.h.

Referenced by isEmpty(), status(), statusString(), and Stream().

quint64 Stream::_circuitId [private]

ID of the circuit carrying this stream.

Definition at line 79 of file stream.h.

Referenced by circuitId(), isEmpty(), and Stream().

QString Stream::_address [private]

Stream target address.

Definition at line 80 of file stream.h.

Referenced by isEmpty(), Stream(), target(), and targetAddress().

quint16 Stream::_port [private]

Stream target port.

Definition at line 81 of file stream.h.

Referenced by isEmpty(), Stream(), target(), and targetPort().


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

Generated on Sat Aug 16 17:38:37 2008 for Vidalia by  doxygen 1.5.6