inputOutputHandler
Class PreviousMixConnectionHandler

java.lang.Object
  extended by java.lang.Thread
      extended by inputOutputHandler.PreviousMixConnectionHandler
All Implemented Interfaces:
java.lang.Runnable

final class PreviousMixConnectionHandler
extends java.lang.Thread

Handles communication with a previous mix (in the same cascade as this one). Waits for the previous mix to establish a permanent (TCP) connection, which is used to transmit the messages (Requests and Replyies) of all users connected to the cascade's fist mix (multiplex channel). (De-)multiplexes Requests/Replyies using an (encrypted) header (see addInterMixHeader()).

Note: Authentication is NOT implemented!

Author:
Karl-Peter Fuchs

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected PreviousMixConnectionHandler(InputOutputHandlerController inputOutputHandler, UserDatabaseController userDatabase, OutputStrategyController outputStrategy, ExternalInformationPortController externalInformationPort)
          Constructs a new PreviousMixConnectionHandler which handles communication with a previous mix (in the same cascade as this one).
 
Method Summary
protected  void acceptConnection()
          Makes this PreviousMixConnectionHandler wait for its predecessor to connect.
 void run()
          Receives messages from previous mix and passes them to the InputOutputHandler.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PreviousMixConnectionHandler

protected PreviousMixConnectionHandler(InputOutputHandlerController inputOutputHandler,
                                       UserDatabaseController userDatabase,
                                       OutputStrategyController outputStrategy,
                                       ExternalInformationPortController externalInformationPort)
Constructs a new PreviousMixConnectionHandler which handles communication with a previous mix (in the same cascade as this one). Waits for the previous mix to establish a permanent (TCP) connection, which is used to transmit the messages (Requests and Replyies) of all users connected to the cascade's fist mix (multiplex channel). (De-)multiplexes Requests/Replyies using an (encrypted) header (see addInterMixHeader()).

Requests are put in the InputOutputHandlerController's requestInputQueue (see InputOutputHandlerController.addUnprocessedRequest()). Replyies are taken from the InputOutputHandlerController's replyOutputQueue (see InputOutputHandlerController.getProcessedReply()).

Adds/removes user to/from UserDatabase.

Note: Authentication is NOT implemented!

Parameters:
inputOutputHandler - Reference on InputOutputHandlerController (Used to add messages).
userDatabase - Reference on component UserDatabase (Used to add/remove User)s.
outputStrategy - Reference on component OutputStrategy (Used to add ChannelReleaseMessages).
externalInformationPort - Reference on component ExternalInformationPort (Used to provide the cryptographic key used to encrypt/decrypt multiplex-headers to the previous mix.
Method Detail

acceptConnection

protected void acceptConnection()
Makes this PreviousMixConnectionHandler wait for its predecessor to connect.


run

public void run()
Receives messages from previous mix and passes them to the InputOutputHandler.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
See Also:
InputOutputHandlerController.addUnprocessedRequest(message.Request)