|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object forward.client.DefaultClientProtocolHandler
public class DefaultClientProtocolHandler
This is the implementation of the client side for the first version of the JAP routing protocol.
Field Summary | |
---|---|
private IStreamConnection |
m_connection
This stores the forwarded connection. |
private int |
m_minDummyTrafficInterval
This stores the minimal dummy traffic interval (in ms) for the forwarder. |
private MixCascade |
m_selectedMixCascade
This stores the selected MixCascade. |
private int |
m_state
This stores the internal protocol state. |
private static int |
MAXIMUM_PROTOCOLMESSAGE_SIZE
This is the maximum net size of a protocol message in bytes. |
private static byte[] |
MESSAGE_END_SIGNATURE
This is the end signature of every protocol message. |
private static byte[] |
MESSAGE_START_SIGNATURE
This is the start signature of every protocol message. |
private static int |
PROTOCOL_VERSION
This is the version of the current protocol implementation. |
private static int |
STATE_CASCADE_SELECTED
This is the state after we have sent our selected MixCascade to the forwarder. |
private static int |
STATE_CLOSED_AFTER_ERROR
This is the state after we have got an error and closed the connection. |
private static int |
STATE_FORWARDING
This is the state while forwarding is active. |
private static int |
STATE_INITIALIZE
This is the state after the physical connection to the forwarder is established and the protocol is initialized. |
private static int |
STATE_OFFER_RECEIVED
This is the state after receiving the forward connection offer from the forwarder. |
Constructor Summary | |
---|---|
DefaultClientProtocolHandler(IStreamConnection a_connection)
Creates a new instance of DefaultClientProtocol handler. |
Method Summary | |
---|---|
private boolean |
checkSignature(byte[] a_signature1,
byte[] a_signature2)
This method checks, whether to byte arrays have identical content or not. |
private byte[] |
createProtocolPacket(byte[] a_data)
Creates a protocol packet from byte array with data. |
private org.w3c.dom.Document |
generateConnectionRequest()
Creates the connection request message. |
ForwardConnectionDescriptor |
getConnectionDescriptor()
Returns the connection descriptor with the offer from the forwarder. |
private byte[] |
readProtocolMessage()
Reads a message from the associated network connection. |
void |
selectMixCascade(MixCascade a_mixCascade)
This method must be called exactly once, after we have received the the connection offer from the forwarder. |
private void |
sendProtocolMessage(byte[] a_message)
Sends a message to the associated network connection. |
private byte[] |
xmlToProtocolPacket(org.w3c.dom.Document a_doc)
Creates a protocol packet from an XML structure. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int PROTOCOL_VERSION
private static final int MAXIMUM_PROTOCOLMESSAGE_SIZE
private static final int STATE_INITIALIZE
private static final int STATE_OFFER_RECEIVED
private static final int STATE_CASCADE_SELECTED
private static final int STATE_FORWARDING
private static final int STATE_CLOSED_AFTER_ERROR
private static final byte[] MESSAGE_START_SIGNATURE
private static final byte[] MESSAGE_END_SIGNATURE
private IStreamConnection m_connection
private int m_state
private int m_minDummyTrafficInterval
private MixCascade m_selectedMixCascade
Constructor Detail |
---|
public DefaultClientProtocolHandler(IStreamConnection a_connection)
a_connection
- A active ProxyConnection to a forwarder.Method Detail |
---|
public ForwardConnectionDescriptor getConnectionDescriptor() throws ClientForwardException
ClientForwardException
public void selectMixCascade(MixCascade a_mixCascade) throws ClientForwardException
a_mixCascade
- The mixcascade from the connection offer we want to use.
ClientForwardException
private org.w3c.dom.Document generateConnectionRequest() throws ClientForwardException
ClientForwardException
private byte[] readProtocolMessage() throws ClientForwardException
ClientForwardException
private void sendProtocolMessage(byte[] a_message) throws ClientForwardException
a_message
- The message to send.
ClientForwardException
private boolean checkSignature(byte[] a_signature1, byte[] a_signature2)
a_signature1
- The first byte array.a_signature2
- The second byte array.
private byte[] xmlToProtocolPacket(org.w3c.dom.Document a_doc) throws java.lang.Exception
doc
- The XML structure which shall be transformed in a protocol packet.
java.lang.Exception
private byte[] createProtocolPacket(byte[] a_data)
a_data
- The bytes to put in the protocol packet.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |