anon.mixminion
Class FirstMMRConnection

java.lang.Object
  extended by anon.mixminion.FirstMMRConnection

public class FirstMMRConnection
extends java.lang.Object

Author:
Christin Wolfram

Field Summary
private  boolean m_bIsClosed
           
private  int m_blocksize
           
private  MMRDescription m_description
           
private  long m_inittimeout
           
private  java.io.InputStream m_istream
           
private  Mixminion m_Mixminion
           
private  java.io.OutputStream m_ostream
           
private  java.lang.String m_protocol
           
private  TinyTLS m_tinyTLS
           
private static java.lang.String OP_NAME
           
 
Constructor Summary
FirstMMRConnection(MMRDescription d, Mixminion a_Mixminion)
          constructor creates a FOR from the description
 
Method Summary
 void close()
          closes the connection to the router
 void connect()
          connects to the First MixminionRouter (MMR)
private  void createClientCert()
          create client certificate for TinyTLS-connection
 MMRDescription getMMRDescription()
          returns the description of the onion router
 boolean isClosed()
          check if the connection to the first onion router is closed
private  boolean receive(byte[] message, java.lang.String type)
          check answer from server and message-hash possibel answers: RECEIVE, REJECTED
 boolean send(byte[] message)
          connects to first MMR, sends a Message-packet and closes the connection
private  boolean sending(byte[] send, java.lang.String sendtype)
          sends a packet
 boolean sendJunk()
          sends a Junk-packet
 boolean sendMessage(byte[] message)
          sends a Message-packet
 
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 MMRDescription m_description

m_istream

private java.io.InputStream m_istream

m_ostream

private java.io.OutputStream m_ostream

m_protocol

private java.lang.String m_protocol

m_bIsClosed

private boolean m_bIsClosed

m_inittimeout

private long m_inittimeout

m_Mixminion

private Mixminion m_Mixminion

m_blocksize

private int m_blocksize
Constructor Detail

FirstMMRConnection

public FirstMMRConnection(MMRDescription d,
                          Mixminion a_Mixminion)
constructor creates a FOR from the description

Parameters:
d - description of the mixminion router
a_Mixminion - a Mixminion instance
Method Detail

getMMRDescription

public MMRDescription getMMRDescription()
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:

sending

private boolean sending(byte[] send,
                        java.lang.String sendtype)
                 throws java.io.IOException
sends a packet

Parameters:
send - 32k message as byte array
sendtype - type of Packet - "Junk" or normal "SEND"
Returns:
success of packet-transmission
Throws:
java.io.IOException

send

public boolean send(byte[] message)
             throws java.io.IOException
connects to first MMR, sends a Message-packet and closes the connection

Parameters:
send - 32k message as byte array
Returns:
success of packet-transmission
Throws:
java.io.IOException

sendMessage

public boolean sendMessage(byte[] message)
                    throws java.io.IOException
sends a Message-packet

Parameters:
send - 32k message as byte array
Returns:
success of packet-transmission
Throws:
java.io.IOException

sendJunk

public boolean sendJunk()
                 throws java.io.IOException
sends a Junk-packet

Returns:
success of packet-transmission
Throws:
java.io.IOException

receive

private boolean receive(byte[] message,
                        java.lang.String type)
check answer from server and message-hash possibel answers: RECEIVE, REJECTED

Parameters:
message - 32k Message
type - "RECEIVED JUNK" or "RECEIVED"
Returns:
success of packet-transmission

createClientCert

private void createClientCert()
create client certificate for TinyTLS-connection


connect

public void connect()
             throws java.lang.Exception
connects to the First MixminionRouter (MMR)

Throws:
java.lang.Exception

close

public void close()
closes the connection to the router