anon.proxy
Class AnonProxy

java.lang.Object
  extended by anon.proxy.AnonProxy
All Implemented Interfaces:
AnonServiceEventListener, java.lang.Runnable

public final class AnonProxy
extends java.lang.Object
implements java.lang.Runnable, AnonServiceEventListener

This calls implements a proxy one can use for convienient access to the provided anonymous communication primitives. Below you find an example which creates a proxy which uses the AN.ON mix cascade for anonymous web surfing. AnonProxy theProxy=new AnonProxy(serverSocket,null); theProxy.setMixCascade(new MixCascade(null, null, hostNameOfMixCascade, portNumberOfMixCascade)); theProxy.start();


Field Summary
static int E_BIND
           
static int E_MIX_PROTOCOL_NOT_SUPPORTED
           
static int E_SIGNATURE_CHECK_FIRSTMIX_FAILED
           
static int E_SIGNATURE_CHECK_OTHERMIX_FAILED
           
static int MIN_REQUESTS
           
static int UNLIMITED_REQUESTS
           
 
Constructor Summary
AnonProxy(java.net.ServerSocket a_listener, IMutableProxyInterface a_proxyInterface, anon.terms.TermsAndConditionConfirmation termsConfirmation)
          Creates a new AnonProxy.
AnonProxy(java.net.ServerSocket a_listener, anon.transport.connection.IStreamConnection a_proxyConnection, int a_maxDummyTrafficInterval, anon.terms.TermsAndConditionConfirmation termsConfirmation)
          Creates a new AnonProxy with an already active mix connection.
AnonProxy(java.net.ServerSocket a_listener, anon.terms.TermsAndConditionConfirmation termsConfirmation)
          Creates a new AnonProxy.
 
Method Summary
 void addEventListener(AnonServiceEventListener l)
           
 void addHTTPConnectionListener(AbstractHTTPConnectionListener listener)
           
 void connecting(AnonServerDescription a_serverDescription)
           
 void connectionError()
           
 void connectionEstablished(AnonServerDescription a_serverDescription)
           
 void dataChainErrorSignaled()
           
protected  void decNumChannels()
           
 void disableProxyCallback(ProxyCallback callback)
           
 void disconnected()
           
 void enableProxyCallback(ProxyCallback callback)
           
 int getMaxConcurrentRequests()
           
 MixCascade getMixCascade()
          Returns the current Mix cascade
 anon.mixminion.MixminionServiceDescription getMixminionParams()
           
 anon.tor.TorAnonServerDescription getTorParams()
           
protected  void incNumChannels()
           
 boolean isConnected()
           
 void packetMixed(long a_totalBytes)
           
 void removeEventListener(AnonServiceEventListener l)
           
 void removeHTTPConnectionListener(AbstractHTTPConnectionListener listener)
           
 void run()
           
 void setDummyTraffic(int a_interval)
          Changes the dummy traffic interval on the connection to the server.
 void setHTTPDecompressionEnabled(boolean enable)
           
 void setHTTPHeaderProcessingEnabled(boolean enable)
           
 void setMaxConcurrentRequests(int a_maxRequests)
           
 void setMixminionParams(anon.mixminion.MixminionServiceDescription newMixminionParams)
          Sets the parameter for Mixminion (anonymous remailer).
 void setProxyListener(IProxyListener l)
           
 void setTorParams(anon.tor.TorAnonServerDescription newTorParams)
          Sets the parameter for TOR (anonymous SOCKS).
 int start(AbstractMixCascadeContainer a_newMixCascade)
           
 void stop()
           
protected  void transferredBytes(long bytes, int protocolType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNLIMITED_REQUESTS

public static final int UNLIMITED_REQUESTS
See Also:
Constant Field Values

MIN_REQUESTS

public static final int MIN_REQUESTS
See Also:
Constant Field Values

E_BIND

public static final int E_BIND
See Also:
Constant Field Values

E_MIX_PROTOCOL_NOT_SUPPORTED

public static final int E_MIX_PROTOCOL_NOT_SUPPORTED
See Also:
Constant Field Values

E_SIGNATURE_CHECK_FIRSTMIX_FAILED

public static final int E_SIGNATURE_CHECK_FIRSTMIX_FAILED
See Also:
Constant Field Values

E_SIGNATURE_CHECK_OTHERMIX_FAILED

public static final int E_SIGNATURE_CHECK_OTHERMIX_FAILED
See Also:
Constant Field Values
Constructor Detail

AnonProxy

public AnonProxy(java.net.ServerSocket a_listener,
                 anon.terms.TermsAndConditionConfirmation termsConfirmation)
Creates a new AnonProxy. This proxy uses as default only the AN.ON service. If you also want to use TOR and Mixminion you have to enable them by calling setTorParams() and setMixmininoParams().

Parameters:
a_listener - A ServerSocket, where the AnonProxy listens for new requests (e.g. from a web browser).
See Also:
setTorParams(), setMixminionParams()

AnonProxy

public AnonProxy(java.net.ServerSocket a_listener,
                 IMutableProxyInterface a_proxyInterface,
                 anon.terms.TermsAndConditionConfirmation termsConfirmation)
Creates a new AnonProxy. This proxy uses as default only the AN.ON service. If you also want to use TOR and Mixminion you have to enable them by calling setTorParams() and setMixmininoParams().

Parameters:
a_listener - A ServerSocket, where the AnonProxy listens for new requests (e.g. from a web browser).
a_proxyInterface - describes a proxy the AnonProxy should use to establish connections to the anon servers (e.g. if you are behind some firewall etc.)
See Also:
setTorParams(), setMixminionParams()

AnonProxy

public AnonProxy(java.net.ServerSocket a_listener,
                 anon.transport.connection.IStreamConnection a_proxyConnection,
                 int a_maxDummyTrafficInterval,
                 anon.terms.TermsAndConditionConfirmation termsConfirmation)
Creates a new AnonProxy with an already active mix connection.

Parameters:
a_listener - A ServerSocket, where the AnonProxy listens for new requests (e.g. from a web browser).
a_proxyConnection - An already open connection to a mix (but not initialized, like keys exchanged, ...).
a_maxDummyTrafficInterval - The minimum dummy traffic rate the connection needs. The value is the maximum dummy traffic interval in milliseconds. Any call of setDummyTraffic(), will respect this maximum interval value -> bigger values set with setDummyTraffic (especially -1) result in that maximum dummy traffic interval value. If this value is -1, there is no need for dummy traffic on that connection on the server side.
Method Detail

enableProxyCallback

public void enableProxyCallback(ProxyCallback callback)

disableProxyCallback

public void disableProxyCallback(ProxyCallback callback)

setHTTPHeaderProcessingEnabled

public void setHTTPHeaderProcessingEnabled(boolean enable)

setHTTPDecompressionEnabled

public void setHTTPDecompressionEnabled(boolean enable)

removeHTTPConnectionListener

public void removeHTTPConnectionListener(AbstractHTTPConnectionListener listener)

addHTTPConnectionListener

public void addHTTPConnectionListener(AbstractHTTPConnectionListener listener)

getMixCascade

public MixCascade getMixCascade()
Returns the current Mix cascade


setTorParams

public void setTorParams(anon.tor.TorAnonServerDescription newTorParams)
Sets the parameter for TOR (anonymous SOCKS). If NULL TOR proxy is disabled.

Parameters:
newTorParams - The new parameters for TOR.
See Also:
TorAnonServerDescription

getTorParams

public anon.tor.TorAnonServerDescription getTorParams()

setMixminionParams

public void setMixminionParams(anon.mixminion.MixminionServiceDescription newMixminionParams)
Sets the parameter for Mixminion (anonymous remailer). If NULL Mixminion proxy is disabled.

Parameters:
newMixminionParams - The new parameters for Mixminion. If NULL the Mixminion proxy is disabled.
See Also:
MixminionServiceDescription

getMixminionParams

public anon.mixminion.MixminionServiceDescription getMixminionParams()

setMaxConcurrentRequests

public void setMaxConcurrentRequests(int a_maxRequests)

getMaxConcurrentRequests

public int getMaxConcurrentRequests()

setDummyTraffic

public void setDummyTraffic(int a_interval)
Changes the dummy traffic interval on the connection to the server. This method respects dummy traffic restrictions on a forwarded connection. If there is a minimum dummy traffic rate needed by the server, the dummy traffic interval gets never bigger than that needed rate on a forwarded connection (especially a interval value of -1 is ignored).

Parameters:
a_interval - The interval for dummy traffic on the connection to the server in milliseconds.

stop

public void stop()

run

public void run()
Specified by:
run in interface java.lang.Runnable

setProxyListener

public void setProxyListener(IProxyListener l)

start

public int start(AbstractMixCascadeContainer a_newMixCascade)

decNumChannels

protected void decNumChannels()

incNumChannels

protected void incNumChannels()

transferredBytes

protected void transferredBytes(long bytes,
                                int protocolType)

connecting

public void connecting(AnonServerDescription a_serverDescription)
Specified by:
connecting in interface AnonServiceEventListener

connectionEstablished

public void connectionEstablished(AnonServerDescription a_serverDescription)
Specified by:
connectionEstablished in interface AnonServiceEventListener

disconnected

public void disconnected()
Specified by:
disconnected in interface AnonServiceEventListener

connectionError

public void connectionError()
Specified by:
connectionError in interface AnonServiceEventListener

addEventListener

public void addEventListener(AnonServiceEventListener l)

removeEventListener

public void removeEventListener(AnonServiceEventListener l)

isConnected

public boolean isConnected()

packetMixed

public void packetMixed(long a_totalBytes)
Specified by:
packetMixed in interface AnonServiceEventListener

dataChainErrorSignaled

public void dataChainErrorSignaled()
Specified by:
dataChainErrorSignaled in interface AnonServiceEventListener