anon.tor.cells
Class RelayCell

java.lang.Object
  extended by anon.tor.cells.Cell
      extended by anon.tor.cells.RelayCell
Direct Known Subclasses:
ExtendCell, ExtendedCell

public class RelayCell
extends Cell

Author:
stefan

Field Summary
private  boolean m_digestGenerated
           
private  byte m_relayCommand
           
private  java.lang.Integer m_streamID
           
static byte RELAY_BEGIN
           
static byte RELAY_CONNECTED
           
static byte RELAY_DATA
           
static byte RELAY_DROP
           
static byte RELAY_END
           
static byte RELAY_EXTEND
           
static byte RELAY_EXTENDED
           
static byte RELAY_RESOLVE
           
static byte RELAY_RESOLVED
           
static byte RELAY_SENDME
           
static byte RELAY_TRUNCATE
           
static byte RELAY_TRUNCATED
           
 
Fields inherited from class anon.tor.cells.Cell
CELL_PAYLOAD_SIZE, CELL_SIZE, m_payload
 
Constructor Summary
RelayCell()
          Constructor for a relay cell
RelayCell(int circID)
          Constructor for a relay cell
RelayCell(int circID, byte[] payload, int offset)
          Constructor for a relay cell
RelayCell(int circID, byte relaycommand, int streamid, byte[] data)
          Constructor
 
Method Summary
 void checkDigest(org.bouncycastle.crypto.digests.SHA1Digest digest)
          checks if the digest of the relay cell is correct
private static byte[] createPayload(byte relaycommand, int streamid, byte[] data)
           
 void doCryptography(MyAES engine)
          encode the cell
 void generateDigest(org.bouncycastle.crypto.digests.SHA1Digest digest)
          generates the digest for the relay cell
 byte[] getCellData()
          creates a fixed-sized cell

2 bytes - circID
1 byte - command
509 bytes - payload
 byte getRelayCommand()
          gets the command of the relay cell
 byte[] getRelayPayload()
          gets the payload of the relay cell
 java.lang.Integer getStreamID()
          gets the streamID of the relay cell
 
Methods inherited from class anon.tor.cells.Cell
createCell, getCircuitID, getCommand, getPayload, setPayload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RELAY_BEGIN

public static final byte RELAY_BEGIN
See Also:
Constant Field Values

RELAY_DATA

public static final byte RELAY_DATA
See Also:
Constant Field Values

RELAY_END

public static final byte RELAY_END
See Also:
Constant Field Values

RELAY_CONNECTED

public static final byte RELAY_CONNECTED
See Also:
Constant Field Values

RELAY_SENDME

public static final byte RELAY_SENDME
See Also:
Constant Field Values

RELAY_EXTEND

public static final byte RELAY_EXTEND
See Also:
Constant Field Values

RELAY_EXTENDED

public static final byte RELAY_EXTENDED
See Also:
Constant Field Values

RELAY_TRUNCATE

public static final byte RELAY_TRUNCATE
See Also:
Constant Field Values

RELAY_TRUNCATED

public static final byte RELAY_TRUNCATED
See Also:
Constant Field Values

RELAY_DROP

public static final byte RELAY_DROP
See Also:
Constant Field Values

RELAY_RESOLVE

public static final byte RELAY_RESOLVE
See Also:
Constant Field Values

RELAY_RESOLVED

public static final byte RELAY_RESOLVED
See Also:
Constant Field Values

m_relayCommand

private byte m_relayCommand

m_streamID

private java.lang.Integer m_streamID

m_digestGenerated

private boolean m_digestGenerated
Constructor Detail

RelayCell

public RelayCell()
Constructor for a relay cell


RelayCell

public RelayCell(int circID)
Constructor for a relay cell

Parameters:
circID - circID

RelayCell

public RelayCell(int circID,
                 byte[] payload,
                 int offset)
Constructor for a relay cell

Parameters:
circID - circID
payload - payload
offset - offset

RelayCell

public RelayCell(int circID,
                 byte relaycommand,
                 int streamid,
                 byte[] data)
Constructor

Parameters:
circID - circID
relaycommand - relaycommand
streamid - streamID
data - data
Method Detail

getRelayCommand

public byte getRelayCommand()
gets the command of the relay cell

Returns:
command

getStreamID

public java.lang.Integer getStreamID()
gets the streamID of the relay cell

Returns:
streamID

generateDigest

public void generateDigest(org.bouncycastle.crypto.digests.SHA1Digest digest)
generates the digest for the relay cell

Parameters:
digest - digest

checkDigest

public void checkDigest(org.bouncycastle.crypto.digests.SHA1Digest digest)
                 throws java.lang.Exception
checks if the digest of the relay cell is correct

Parameters:
digest - digest
Throws:
java.lang.Exception - if an error occurs

doCryptography

public void doCryptography(MyAES engine)
                    throws java.lang.Exception
encode the cell

Parameters:
engine - a cipher
Throws:
java.lang.Exception

createPayload

private static byte[] createPayload(byte relaycommand,
                                    int streamid,
                                    byte[] data)

getCellData

public byte[] getCellData()
Description copied from class: Cell
creates a fixed-sized cell

2 bytes - circID
1 byte - command
509 bytes - payload

Overrides:
getCellData in class Cell
Returns:
composed cell

getRelayPayload

public byte[] getRelayPayload()
gets the payload of the relay cell

Returns:
payload