anon.tor
Class FirstOnionRouterConnection

java.lang.Object
  extended by anon.tor.FirstOnionRouterConnection
All Implemented Interfaces:
java.lang.Runnable

public class FirstOnionRouterConnection
extends java.lang.Object
implements java.lang.Runnable


Field Summary
private  boolean m_bIsClosed
           
private  boolean m_bRun
           
private  java.util.Hashtable m_Circuits
           
private  ORDescriptor m_description
           
private  long m_inittimeout
           
private  java.io.InputStream m_istream
           
private  RSAKeyPair m_keypairIdentityKey
           
private  java.lang.Object m_oSendSync
           
private  java.io.OutputStream m_ostream
           
private  MyRandom m_rand
           
private  java.lang.Thread m_readDataLoop
           
private  TinyTLS m_tinyTLS
           
private  Tor m_Tor
           
private static java.lang.String OP_NAME
           
 
Constructor Summary
FirstOnionRouterConnection(ORDescriptor d, Tor a_Tor)
          constructor creates a FOR from the description
 
Method Summary
 void close()
          closes the connection to the onionrouter
private  void closedByPeer()
          connection was closed by peer
 void connect()
          connects to the FOR
 Circuit createCircuit(java.util.Vector onionRouters)
          Creates a circuit with the given onion routers
private  boolean dispatchCell(Cell cell)
          dispatches a cell to the circuits if one is recieved
 ORDescriptor getORDescription()
          returns the description of the onion router
 boolean isClosed()
          check if the connection to the first onion router is closed
protected  void notifyCircuitClosed(Circuit circ)
           
 void run()
          dispatches cells while the thread, started with start is running
 void send(Cell cell)
          sends a cell
private  void start()
          starts the thread that reads from the inputstream and dispatches the cells
private  void stop()
          stops the thread that dispatches cells
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OP_NAME

private static java.lang.String OP_NAME

m_tinyTLS

private TinyTLS m_tinyTLS

m_description

private ORDescriptor m_description

m_readDataLoop

private java.lang.Thread m_readDataLoop

m_istream

private java.io.InputStream m_istream

m_ostream

private java.io.OutputStream m_ostream

m_Circuits

private java.util.Hashtable m_Circuits

m_bRun

private volatile boolean m_bRun

m_bIsClosed

private boolean m_bIsClosed

m_rand

private MyRandom m_rand

m_oSendSync

private java.lang.Object m_oSendSync

m_inittimeout

private long m_inittimeout

m_Tor

private Tor m_Tor

m_keypairIdentityKey

private RSAKeyPair m_keypairIdentityKey
Constructor Detail

FirstOnionRouterConnection

public FirstOnionRouterConnection(ORDescriptor d,
                                  Tor a_Tor)
constructor creates a FOR from the description

Parameters:
d - description of the onion router
a_Tor - a tor instance
Method Detail

getORDescription

public ORDescriptor getORDescription()
returns the description of the onion router

Returns:
OR description

isClosed

public boolean isClosed()
check if the connection to the first onion router is closed

Returns:

send

public void send(Cell cell)
          throws java.io.IOException
sends a cell

Parameters:
cell - cell with data
Throws:
java.io.IOException

dispatchCell

private boolean dispatchCell(Cell cell)
dispatches a cell to the circuits if one is recieved

Parameters:
cell - Cell to dispatch

connect

public void connect()
             throws java.lang.Exception
connects to the FOR

Throws:
java.lang.Exception

createCircuit

public Circuit createCircuit(java.util.Vector onionRouters)
Creates a circuit with the given onion routers

Parameters:
onionRouters - vector that contains a list of onion routers
Returns:
on succes : the created circuit else : null

start

private void start()
starts the thread that reads from the inputstream and dispatches the cells


run

public void run()
dispatches cells while the thread, started with start is running

Specified by:
run in interface java.lang.Runnable

stop

private void stop()
           throws java.io.IOException
stops the thread that dispatches cells

Throws:
java.io.IOException

close

public void close()
closes the connection to the onionrouter


closedByPeer

private void closedByPeer()
connection was closed by peer


notifyCircuitClosed

protected void notifyCircuitClosed(Circuit circ)