public abstract class CircuitImpl extends Object implements Circuit, DashboardRenderable
| Modifier and Type | Field and Description |
|---|---|
protected static Logger |
logger |
protected List<Router> |
prechosenPath |
DASHBOARD_CIRCUITS, DASHBOARD_CONNECTIONS, DASHBOARD_CONNECTIONS_VERBOSE, DASHBOARD_PREDICTED_PORTS, DASHBOARD_STREAMS| Modifier | Constructor and Description |
|---|---|
protected |
CircuitImpl(CircuitManagerImpl circuitManager) |
protected |
CircuitImpl(CircuitManagerImpl circuitManager,
List<Router> prechosenPath) |
| Modifier and Type | Method and Description |
|---|---|
void |
appendNode(CircuitNode node) |
protected abstract List<Router> |
choosePathForCircuit(CircuitPathChooser pathChooser) |
protected StreamImpl |
createNewStream() |
protected StreamImpl |
createNewStream(boolean autoclose) |
RelayCell |
createRelayCell(int relayCommand,
int streamId,
CircuitNode targetNode)
Create a new relay cell which is configured for delivery to the specified
circuit
targetNode with command value relayCommand
and a stream id value of streamId. |
void |
dashboardRender(DashboardRenderer renderer,
PrintWriter writer,
int flags) |
void |
deliverControlCell(Cell cell) |
void |
deliverRelayCell(Cell cell) |
void |
destroyCircuit() |
List<Stream> |
getActiveStreams() |
int |
getCircuitId()
Returns the curcuit id value for this circuit.
|
protected abstract String |
getCircuitTypeLabel() |
Connection |
getConnection()
Returns the entry router
Connection object of this Circuit. |
CircuitNode |
getFinalCircuitNode()
Return the last node or 'hop' in this circuit.
|
int |
getSecondsDirty() |
boolean |
isClean() |
boolean |
isConnected()
Return
true if the circuit is presently in the connected state or
false otherwise. |
boolean |
isMarkedForClose() |
boolean |
isPending() |
void |
markForClose() |
protected String |
pathToString() |
protected Stream |
processStreamOpenException(Exception e) |
RelayCell |
receiveRelayCell()
Returns the next relay response cell received on this circuit.
|
void |
removeStream(StreamImpl stream) |
void |
sendRelayCell(RelayCell cell)
Encrypt and deliver the relay cell
cell. |
void |
sendRelayCellToFinalNode(RelayCell cell) |
String |
toString() |
protected static final Logger logger
protected CircuitImpl(CircuitManagerImpl circuitManager)
protected CircuitImpl(CircuitManagerImpl circuitManager, List<Router> prechosenPath)
protected abstract List<Router> choosePathForCircuit(CircuitPathChooser pathChooser) throws InterruptedException, PathSelectionFailedException
public void markForClose()
markForClose in interface Circuitpublic boolean isMarkedForClose()
isMarkedForClose in interface Circuitpublic boolean isConnected()
Circuittrue if the circuit is presently in the connected state or
false otherwise.isConnected in interface Circuittrue if the circuit is presently connected, or
false otherwise.public int getSecondsDirty()
getSecondsDirty in interface Circuitpublic Connection getConnection()
CircuitConnection object of this Circuit. Throws
a TorException if the circuit is not currently open.getConnection in interface Circuitpublic int getCircuitId()
CircuitgetCircuitId in interface Circuitpublic void sendRelayCell(RelayCell cell)
Circuitcell.sendRelayCell in interface Circuitcell - The relay cell to deliver over this circuit.public void sendRelayCellToFinalNode(RelayCell cell)
public void appendNode(CircuitNode node)
appendNode in interface Circuitpublic CircuitNode getFinalCircuitNode()
CircuitgetFinalCircuitNode in interface Circuitpublic RelayCell createRelayCell(int relayCommand, int streamId, CircuitNode targetNode)
CircuittargetNode with command value relayCommand
and a stream id value of streamId. The returned RelayCell
can then be used to populate the payload of the cell before delivering it.createRelayCell in interface CircuitrelayCommand - The command value to send in the relay cell header.streamId - The stream id value to send in the relay cell header.targetNode - The target circuit node to encrypt this cell for.public RelayCell receiveRelayCell()
CircuitCIRCUIT_RELAY_RESPONSE_TIMEOUT milliseconds, null
is returned.receiveRelayCell in interface Circuitnull if
a timeout is reached before the next relay cell arrives.public void deliverControlCell(Cell cell)
deliverControlCell in interface Circuitpublic void deliverRelayCell(Cell cell)
deliverRelayCell in interface Circuitprotected StreamImpl createNewStream(boolean autoclose)
protected StreamImpl createNewStream()
public void destroyCircuit()
destroyCircuit in interface Circuitpublic void removeStream(StreamImpl stream)
protected Stream processStreamOpenException(Exception e) throws InterruptedException, TimeoutException, StreamConnectFailedException
protected abstract String getCircuitTypeLabel()
protected String pathToString()
public List<Stream> getActiveStreams()
getActiveStreams in interface Circuitpublic void dashboardRender(DashboardRenderer renderer, PrintWriter writer, int flags) throws IOException
dashboardRender in interface DashboardRenderableIOExceptionCopyright © 2015. All rights reserved.