anon.tor
Class TorChannel

java.lang.Object
  extended by anon.shared.AbstractChannel
      extended by anon.tor.TorChannel
All Implemented Interfaces:
AnonChannel
Direct Known Subclasses:
TorSocksChannel

public class TorChannel
extends AbstractChannel

Author:
stefan

Field Summary
protected  Circuit m_circuit
           
private  java.lang.Object m_oWaitForOpen
           
private  int m_recvcellcounter
           
private  int m_sendcellcounter
           
private static int MAX_CELL_DATA
           
 
Fields inherited from class anon.shared.AbstractChannel
m_bIsClosed, m_bIsClosedByPeer, m_id
 
Fields inherited from interface anon.AnonChannel
HTTP, SMTP, SOCKS
 
Constructor Summary
TorChannel()
           
 
Method Summary
protected  void close_impl()
           
 void close()
          Closes the channel and releases all resources used.
 void closedByPeer()
           
 boolean connect(java.lang.String addr, int port)
          connects to a host over the tor-network
 void dispatchCell(RelayCell cell)
          dispatches the cells to the outputstream
 int getOutputBlockSize()
          Returns a value that indicates the current optimum size of data to write..
 boolean isClosedByPeer()
          gets if the connection was closed by peer
protected  void send(byte[] arg0, int len)
           
protected  void setCircuit(Circuit c)
           
protected  void setStreamID(int id)
           
 
Methods inherited from class anon.shared.AbstractChannel
finalize, getInputStream, getOutputStream, hashCode, recv
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CELL_DATA

private static final int MAX_CELL_DATA
See Also:
Constant Field Values

m_circuit

protected Circuit m_circuit

m_recvcellcounter

private int m_recvcellcounter

m_sendcellcounter

private int m_sendcellcounter

m_oWaitForOpen

private java.lang.Object m_oWaitForOpen
Constructor Detail

TorChannel

public TorChannel()
Method Detail

setStreamID

protected void setStreamID(int id)

setCircuit

protected void setCircuit(Circuit c)

getOutputBlockSize

public int getOutputBlockSize()
Description copied from interface: AnonChannel
Returns a value that indicates the current optimum size of data to write.. Because often anon services transport the data splited into packets for optimum performance it may be good to send data according to the packet size to avoid unneccessary overheads.

Returns:
the current optimum size for output data. If 1 is returned the size does not matter.

send

protected void send(byte[] arg0,
                    int len)
             throws java.io.IOException
Specified by:
send in class AbstractChannel
Throws:
java.io.IOException

close

public void close()
Description copied from interface: AnonChannel
Closes the channel and releases all resources used.

Specified by:
close in interface AnonChannel
Overrides:
close in class AbstractChannel

closedByPeer

public void closedByPeer()
Overrides:
closedByPeer in class AbstractChannel

close_impl

protected void close_impl()
Specified by:
close_impl in class AbstractChannel

connect

public boolean connect(java.lang.String addr,
                       int port)
connects to a host over the tor-network

Parameters:
addr - address
port - port
Throws:
ConnectException

dispatchCell

public void dispatchCell(RelayCell cell)
dispatches the cells to the outputstream

Parameters:
cell - cell

isClosedByPeer

public boolean isClosedByPeer()
gets if the connection was closed by peer

Returns: