jap.forward
Class JAPRoutingSettings

java.lang.Object
  extended by java.util.Observable
      extended by jap.forward.JAPRoutingSettings
All Implemented Interfaces:
IXMLEncodable

public final class JAPRoutingSettings
extends java.util.Observable
implements IXMLEncodable

This class stores all routing settings. Observers of this class are notified, if the settings are changed. They will get an instance of JapRoutingMessage with the detailed message of the notification.


Nested Class Summary
static class JAPRoutingSettings.TransportMode
          This Class holds all supported Ways to establish an forwarding Connection.
 
Field Summary
static java.lang.String DEFAULT_APP_NAME
          The default Application Name to use, when working in Server Mode over Skype.
private static java.lang.String DEFAULT_SKYPE_ADDRESS_URN
           
private  java.lang.String m_appName
          When acting as Server over Skype, this Field defines the Application Name where we listen for incoming Requests.
private  int m_bandwidth
          Stores the current bandwidth, which is provided for forwarding.
private  JAPRoutingConnectionClassSelector m_connectionClassSelector
          Stores the instance of the connection class selector.
private  int m_connections
          Stores the maximum number of simultaneously forwarded connections.
private  boolean m_connectViaForwarder
          Stores whether JAP shall connect to a forwarder when starting the anonymity mode.
private  java.lang.Object m_currentServerManagerId
          Stores the ID of the current ServerManager which manages the server socket of the forwarding server.
private  IAddress m_forwadingAddress
          Stores the Address of the forwarding Server.
private  IStreamConnection m_forwardedConnection
          Stores the forwarded client connection.
private  boolean m_forwardInfoService
          Stores, whether connections to the infoservice needs also forwarding.
private  int m_maxDummyTrafficInterval
          Stores the minimum dummy traffic rate, needed by the forwarded on the current forwarded client connection.
private  boolean m_propagandaStarted
          Stores, whether the propaganda for the local forwarding server is running (true) or not (false).
private  DefaultClientProtocolHandler m_protocolHandler
          Stores the protocol handling instance for the forwarded client connection.
private  JAPRoutingRegistrationInfoServices m_registrationInfoServicesStore
          Stores a structure, which contains information about the infoservices to register at forwarding server startup.
private  JAPRoutingRegistrationStatusObserver m_registrationStatusObserver
          Stores the instance of JAPRoutingRegistrationStatusObserver, which holds some information about the current registration status at the infoservices for the local forwarding server.
private  int m_routingMode
          This stores the current routing mode.
private  java.util.Vector m_runningPropagandists
          Stores a list of ServerSocketPropagandists, which are currently running.
private  int m_serverPort
          Stores the port, where the local forwarding server will listen for clients.
private  JAPRoutingServerStatisticsListener m_serverStatisticsListener
          Stores the instance of JAPForwardingServerStatisticsListener, which fetches the statistics from the running forwarding server.
private  java.lang.Thread m_startPropagandaThread
          Stores the instance of the startPropaganda Thread, if there is a currently running instance (else this value is null).
private  JAPRoutingSettings.TransportMode m_transportMode
          This Field determines the Transport to use by selecting one of the Constants of #SUPORTED_TRANSPORTMODES.
private  JAPRoutingUseableMixCascades m_useableMixCascadesStore
          Stores the structure, which manages the currently useable mixcascades.
private  IAddress m_userForwarder
          Stores the Address of an forwarding Server, directly provided by the User.
private  boolean m_waitForShutdownCall
          Needed for synchronization if we open a new forwarded connection and have to shutdown an old one.
static int REGISTRATION_INFOSERVICE_ERRORS
          This value means, that we could not reach any infoservice while the registration of the local forwarding server.
static int REGISTRATION_INTERRUPTED
          This value means, that the registration process was interrupted.
static int REGISTRATION_NO_INFOSERVICES
          This value means, that there were no known infoservices to register the local forwarding server.
static int REGISTRATION_SUCCESS
          This value means, that we have registrated the local forwarding server successful at least at one infoservice.
static int REGISTRATION_UNKNOWN_ERRORS
          This value means, that there occured unknown errors while the registration of the local forwarding server at every infoservice.
static int REGISTRATION_VERIFY_ERRORS
          This value means, that no infoservice could verify the local forwarding server.
static int ROUTING_MODE_CLIENT
          In this mode, we are a client and use a forwarder to connect to the JAP servers.
static int ROUTING_MODE_DISABLED
          In this mode routing is disabled.
static int ROUTING_MODE_SERVER
          This is the mode, when we are a server and provide forwarding for other clients.
 
Fields inherited from interface anon.util.IXMLEncodable
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
 
Constructor Summary
JAPRoutingSettings()
          This creates a new instance of JAPRoutingSettings.
 
Method Summary
 void addPropagandaInstance(InfoServiceDBEntry a_registrationInfoService)
          This method adds a new single propaganda instance for the forwarding server.
 void anonConnectionClosed()
          This method is always called, when a anon connection is closed.
 int getAllowedConnections()
          Returns the allowed number of simultaneously forwarded connections.
 AnonProxy getAnonProxyInstance(java.net.ServerSocket a_listener)
          Returns the anon proxy for the forwarded client connection.
 java.lang.String getApplicationName()
          Returns the currently configured Application Name for a forwarding Server listing over Skype.
 int getBandwidth()
          Returns the current bandwidth, which is provided for forwarding.
 int getBandwidthMaxConnections()
          Returns the maximum number of clients, which can be forwarded with the current forwarding bandwidth.
 JAPRoutingConnectionClassSelector getConnectionClassSelector()
          Returns the instance of the connection class selector of the forwarding server.
 ForwardConnectionDescriptor getConnectionDescriptor()
          Returns the connection offer from the forwarder.
 int getCurrentlyForwardedConnections()
          Returns the number of currently forwarded connections.
 IAddress getForwarderAddress()
          Returns the Address of the current forwarder.
 boolean getForwardInfoService()
          Returns whether connections to the infoservice needs forwarding too.
 JAPRoutingRegistrationInfoServices getRegistrationInfoServicesStore()
          Returns the structure, where the infoservices are stored, used for registration of the local forwarding server.
 JAPRoutingRegistrationStatusObserver getRegistrationStatusObserver()
          Returns the instance of JAPRoutingRegistrationStatusObserver, which holds some information about the current registration status at the infoservices for the local forwarding server.
 int getRoutingMode()
          Returns the current routing mode, see the constants in this class.
 java.util.Vector getRunningPropagandaInstances()
          Returns a snapshot of the list of currently running propaganda instances, which registrate the local forwarding server at the infoservices.
 ForwardSchedulerStatistics getSchedulerStatistics()
          Returns the statistics instance of the forwarding scheduler.
 int getServerPort()
          Returns the currently configured forwarding server port.
 JAPRoutingServerStatisticsListener getServerStatisticsListener()
          Returns the statistics listener of the forwarding servers.
 JAPRoutingSettings.TransportMode getTransportMode()
          Returns the currently used Transport Mode i.e.
 JAPRoutingUseableMixCascades getUseableMixCascadesStore()
          Returns the structure, which stores the currently useable mixcascades for the client connections and updates the ForwardCascadeDatabase of the forwarding server.
 IAddress getUserProvidetForwarder()
          Get the currently Address of an forwarding Server, as provided by the User
 void httpListenerPortChanged()
          This method updates the local proxy for the infoservice, if we are in client routing mode and the infoservice needs to be forwarded.
 boolean isConnectViaForwarder()
          Returns whether JAP shall connect to a forwarder when starting the anonymity mode.
 int loadSettingsFromXml(org.w3c.dom.Element a_japForwardingSettingsNode)
          This method loads all forwarding related settings from a prior created XML structure.
 void selectMixCascade(MixCascade a_mixCascade)
          This method must be called exactly once, after we have received the the connection offer from the forwarder.
 void setAllowedConnections(int a_connections)
          Changes the allowed number of simultaneously forwarded connections.
 boolean setApplicationName(java.lang.String a_value)
          Sets the Application Name to use when listening for request over Skype.
 void setBandwidth(int a_bandwidth)
          Changes the bandwidth, which is provided for forwarding.
 void setConnectViaForwarder(boolean a_connectViaForwarder)
          Sets whether JAP shall connect to a forwarder when starting the anonymity mode.
 void setForwarder(java.lang.String a_forwarderHost, int a_forwarderPort)
          Changes the forwarder for the client routing mode.
 void setForwarderAddress(IAddress a_address)
          Changes the forwarder for the client routing mode.
 void setForwardInfoService(boolean a_forwardInfoService)
          Changes whether connections to the infoservice needs forwarding too.
 void setNewProxySettings(ProxyInterface a_proxyInterface)
          This method sets new settings for the proxy server.
 boolean setRoutingMode(int a_routingMode)
          Changes the routing mode.
 boolean setServerPort(int a_serverPort)
          Configures the forwarding server port.
 boolean setTransportMode(JAPRoutingSettings.TransportMode a_value)
          Sets the Transport Mode i.e the Medium to use for transporting Data.
 void setUserProvidetForwarder(java.lang.String a_uri)
          Sets the Address of an forwarding Server to prefer when using Client Routing Mode.
 int startPropaganda(boolean a_blocking)
          Starts the propaganda instances, which register the local forwarding server at the specified infoservices.
 void stopPropaganda()
          Stops all running propaganda instances, which register the local forwarder at the specified infoservices.
 org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
          Returns the current routing settings for storage within an XML document.
private  void updateInfoServiceProxySettings()
          If the infoservice needs forwarding, this changes the infoservice proxy settings to the JAP HTTP listener port (where JAP accept requests from browsers).
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROUTING_MODE_DISABLED

public static final int ROUTING_MODE_DISABLED
In this mode routing is disabled.

See Also:
Constant Field Values

ROUTING_MODE_CLIENT

public static final int ROUTING_MODE_CLIENT
In this mode, we are a client and use a forwarder to connect to the JAP servers.

See Also:
Constant Field Values

ROUTING_MODE_SERVER

public static final int ROUTING_MODE_SERVER
This is the mode, when we are a server and provide forwarding for other clients.

See Also:
Constant Field Values

REGISTRATION_NO_INFOSERVICES

public static final int REGISTRATION_NO_INFOSERVICES
This value means, that there were no known infoservices to register the local forwarding server.

See Also:
Constant Field Values

REGISTRATION_UNKNOWN_ERRORS

public static final int REGISTRATION_UNKNOWN_ERRORS
This value means, that there occured unknown errors while the registration of the local forwarding server at every infoservice.

See Also:
Constant Field Values

REGISTRATION_INFOSERVICE_ERRORS

public static final int REGISTRATION_INFOSERVICE_ERRORS
This value means, that we could not reach any infoservice while the registration of the local forwarding server.

See Also:
Constant Field Values

REGISTRATION_VERIFY_ERRORS

public static final int REGISTRATION_VERIFY_ERRORS
This value means, that no infoservice could verify the local forwarding server.

See Also:
Constant Field Values

REGISTRATION_INTERRUPTED

public static final int REGISTRATION_INTERRUPTED
This value means, that the registration process was interrupted.

See Also:
Constant Field Values

REGISTRATION_SUCCESS

public static final int REGISTRATION_SUCCESS
This value means, that we have registrated the local forwarding server successful at least at one infoservice.

See Also:
Constant Field Values

DEFAULT_APP_NAME

public static final java.lang.String DEFAULT_APP_NAME
The default Application Name to use, when working in Server Mode over Skype.

See Also:
Constant Field Values

m_routingMode

private int m_routingMode
This stores the current routing mode. See the constants in this class.


m_serverPort

private int m_serverPort
Stores the port, where the local forwarding server will listen for clients.


m_currentServerManagerId

private java.lang.Object m_currentServerManagerId
Stores the ID of the current ServerManager which manages the server socket of the forwarding server. If the forwarding server is not running, this value is always null.


m_bandwidth

private int m_bandwidth
Stores the current bandwidth, which is provided for forwarding.


m_connections

private int m_connections
Stores the maximum number of simultaneously forwarded connections.


m_forwardedConnection

private IStreamConnection m_forwardedConnection
Stores the forwarded client connection.


m_forwardInfoService

private boolean m_forwardInfoService
Stores, whether connections to the infoservice needs also forwarding. Also the instance fetching the information about a forwarder should use this to decide, whether it is possible to obtain the information about the forwarder directly from the InfoServices or the mail-gateway has to be used in order to obtain that information.


m_connectViaForwarder

private boolean m_connectViaForwarder
Stores whether JAP shall connect to a forwarder when starting the anonymity mode. This value doesn't have any meaning within JAPRoutingSettings, so it is still possible to enable the client forwarding mode, if this value is false. Anybody who is starting the anonymity mode should check this value and do the necessary things.


m_waitForShutdownCall

private boolean m_waitForShutdownCall
Needed for synchronization if we open a new forwarded connection and have to shutdown an old one.


m_protocolHandler

private DefaultClientProtocolHandler m_protocolHandler
Stores the protocol handling instance for the forwarded client connection.


m_maxDummyTrafficInterval

private int m_maxDummyTrafficInterval
Stores the minimum dummy traffic rate, needed by the forwarded on the current forwarded client connection.


m_runningPropagandists

private java.util.Vector m_runningPropagandists
Stores a list of ServerSocketPropagandists, which are currently running.


m_startPropagandaThread

private java.lang.Thread m_startPropagandaThread
Stores the instance of the startPropaganda Thread, if there is a currently running instance (else this value is null).


m_connectionClassSelector

private JAPRoutingConnectionClassSelector m_connectionClassSelector
Stores the instance of the connection class selector. This is only needed for some more comfort, to make it easier for a user running a forwarding server to choose the correct values for the bandwidth.


m_registrationInfoServicesStore

private JAPRoutingRegistrationInfoServices m_registrationInfoServicesStore
Stores a structure, which contains information about the infoservices to register at forwarding server startup.


m_propagandaStarted

private boolean m_propagandaStarted
Stores, whether the propaganda for the local forwarding server is running (true) or not (false).


m_useableMixCascadesStore

private JAPRoutingUseableMixCascades m_useableMixCascadesStore
Stores the structure, which manages the currently useable mixcascades. So the forwarding clients will always get an up-to-date list of usebale mixcascades.


m_serverStatisticsListener

private JAPRoutingServerStatisticsListener m_serverStatisticsListener
Stores the instance of JAPForwardingServerStatisticsListener, which fetches the statistics from the running forwarding server.


m_registrationStatusObserver

private JAPRoutingRegistrationStatusObserver m_registrationStatusObserver
Stores the instance of JAPRoutingRegistrationStatusObserver, which holds some information about the current registration status at the infoservices for the local forwarding server.


m_forwadingAddress

private IAddress m_forwadingAddress
Stores the Address of the forwarding Server. This Address define the Transport Mode to use and all the necessary Informations to determinate the unique Endpoint based on this Medium of Transport.


m_appName

private java.lang.String m_appName
When acting as Server over Skype, this Field defines the Application Name where we listen for incoming Requests.


m_transportMode

private JAPRoutingSettings.TransportMode m_transportMode
This Field determines the Transport to use by selecting one of the Constants of #SUPORTED_TRANSPORTMODES. When acting as Server, this Field defines the Medium of Transport where we want to listen for incoming Request. When acting as Client, it has no use at the moment, as the InfoService only propagate TCP/IP Forwarding Server and directly provided Addresses already determinate the Transport Mode.


m_userForwarder

private IAddress m_userForwarder
Stores the Address of an forwarding Server, directly provided by the User.


DEFAULT_SKYPE_ADDRESS_URN

private static final java.lang.String DEFAULT_SKYPE_ADDRESS_URN
See Also:
Constant Field Values
Constructor Detail

JAPRoutingSettings

public JAPRoutingSettings()
This creates a new instance of JAPRoutingSettings. We are doing some initialization here.

Method Detail

getRoutingMode

public int getRoutingMode()
Returns the current routing mode, see the constants in this class.

Returns:
The current routing mode.

setRoutingMode

public boolean setRoutingMode(int a_routingMode)
Changes the routing mode. This method also does everything necessary to change the routing mode, like starting or shutting down the forwarding server, infoservice registrations or a forwarded connection. Attention: The infoservice registration services are not started automatically with the server. You have to call startPropaganda() explicitly.

Parameters:
a_routingMode - The new routing mode. See the constants in this class.
Returns:
True, if the change of the routing mode was successful, else false.

getServerPort

public int getServerPort()
Returns the currently configured forwarding server port.

Returns:
The currently configured forwarding server port.

getApplicationName

public java.lang.String getApplicationName()
Returns the currently configured Application Name for a forwarding Server listing over Skype.


setApplicationName

public boolean setApplicationName(java.lang.String a_value)
Sets the Application Name to use when listening for request over Skype.

The Method takes care of the currently running Server and tries to change it, when we already using Skype.

Parameters:
a_value - The new Application Name to use
Returns:
true if the changing was successful. Otherwise false.

setServerPort

public boolean setServerPort(int a_serverPort)
Configures the forwarding server port. If the forwarding server is currently running, we will open the new port and the old one is closed. If there is an error while setting the new port, nothing is changed, the old port keeps active. Attention: Any active client connection are not influenced by the change of the forwarding port. They keep connected to the old port even though the old port is closed. If the forwarding server isn't running at the moment, only the configuration for the server port is changed.

Parameters:
a_serverPort - The port number for the forwarding server. The value must be between 1 and 65535.
Returns:
True, if the change of the port was successful or false, if not.

getBandwidth

public int getBandwidth()
Returns the current bandwidth, which is provided for forwarding.

Returns:
The current bandwidth for forwarding in bytes/sec.

setBandwidth

public void setBandwidth(int a_bandwidth)
Changes the bandwidth, which is provided for forwarding. Also the allowed connection number is altered, if necessary (more connections than the bandwidth can support).

Parameters:
a_bandwidth - The bandwidth for forwarding in bytes/sec.

getBandwidthMaxConnections

public int getBandwidthMaxConnections()
Returns the maximum number of clients, which can be forwarded with the current forwarding bandwidth. This number depends on the bandwidth per user constant in JAPConstants.The number of allowed forwarding connections can be smaller than this value.

Returns:
The maximum number of connections which can be forwarded with the current bandwidth.
See Also:
JAPConstants.ROUTING_BANDWIDTH_PER_USER

getAllowedConnections

public int getAllowedConnections()
Returns the allowed number of simultaneously forwarded connections.

Returns:
The allowed number of forwarded connections.

setAllowedConnections

public void setAllowedConnections(int a_connections)
Changes the allowed number of simultaneously forwarded connections. If the new value is bigger than the maximum number of possible connections because of the bandwidth limit, the number is set to the maximum number of possible connections.

Parameters:
a_connections - The new allowed number of forwarded connections.
See Also:
getBandwidthMaxConnections()

setNewProxySettings

public void setNewProxySettings(ProxyInterface a_proxyInterface)
This method sets new settings for the proxy server. All new connections created by the routing server or the routing client after the call of this method will use them. Connections which already exist are not influenced by that call. The default after creating the instance of JAPRoutingSettings is to use no proxy for all new connections.

Parameters:
a_proxyInterface - the proxy interface

setForwarder

public void setForwarder(java.lang.String a_forwarderHost,
                         int a_forwarderPort)
Changes the forwarder for the client routing mode. If the routing mode is changed to the client routing mode, we use this settings to connect to the forwarder. This settings can only be changed, if the routing mode is not ROUTING_MODE_CLIENT, so this is only possible when there is no connection to a forwarder.

Parameters:
a_forwarderHost - The hostname/IP of a forwarder.
a_forwarderPort - The port of a forwarder.

setForwarderAddress

public void setForwarderAddress(IAddress a_address)
Changes the forwarder for the client routing mode. If the routing mode is changed to the client routing mode, we use this settings to connect to the forwarder. This settings can only be changed, if the routing mode is not ROUTING_MODE_CLIENT, so this is only possible when there is no connection to a forwarder.

Parameters:
a_address - The Address of the Forwarder

getForwarderAddress

public IAddress getForwarderAddress()
Returns the Address of the current forwarder. If there is no forwarder set (or an invalid one), null is returned.

Returns:
The Address of the current Forwarder.

getUserProvidetForwarder

public IAddress getUserProvidetForwarder()
Get the currently Address of an forwarding Server, as provided by the User

Returns:
The Address to an forwarding Server or null when no one was declared.

setUserProvidetForwarder

public void setUserProvidetForwarder(java.lang.String a_uri)
                              throws ConnectionException
Sets the Address of an forwarding Server to prefer when using Client Routing Mode.

Parameters:
a_uri - The URI of the Forwarding Server or null when no spezial Forwader should be used
Throws:
ConnectionException

getTransportMode

public JAPRoutingSettings.TransportMode getTransportMode()
Returns the currently used Transport Mode i.e. the Medium to use for transporting the Data.


setTransportMode

public boolean setTransportMode(JAPRoutingSettings.TransportMode a_value)
Sets the Transport Mode i.e the Medium to use for transporting Data.

The Method will take care of the currently Routing Mode while updating the value. This means that when acting as Server, we will try to add a new Listener for the selected Transport Mode and when successful, remove the old one.

When in Client Mode, there no changes, as the Transport mode is determinate by the Address.

Returns:
True when changing the Transport Mode was successful. Otherwise false.

setForwardInfoService

public void setForwardInfoService(boolean a_forwardInfoService)
Changes whether connections to the infoservice needs forwarding too. Also the instance fetching the information about a forwarder uses this to decide, whether it is possible to obtain the information about the forwarder directly from the InfoServices or the mail-gateway has to be used in order to obtain that information.

Parameters:
a_forwardInfoService - True, if connections to the infoservice must be forwarded and the mail-gateway is used in order to obtain the forwarder-address, else false (no InfoService forwarding and direct requests to the InfoService when fetching a forwarder address).

getForwardInfoService

public boolean getForwardInfoService()
Returns whether connections to the infoservice needs forwarding too. Also the instance fetching the information about a forwarder should use this to decide, whether it is possible to obtain the information about the forwarder directly from the InfoServices or the mail-gateway has to be used in order to obtain that information.

Returns:
True, if connections to the infoservice must be forwarded and the mail-gateway is used in order to obtain the forwarder-address, else false (no InfoService forwarding and direct requests to the InfoService when fetching a forwarder address).

setConnectViaForwarder

public void setConnectViaForwarder(boolean a_connectViaForwarder)
Sets whether JAP shall connect to a forwarder when starting the anonymity mode. This value doesn't have any meaning within JAPRoutingSettings, so it is still possible to enable the client forwarding mode, if this value is false. Anybody who is starting the anonymity mode should check this value and do the necessary things.

Parameters:
a_connectViaForwarder - True, if new anonymous connections shall use a forwarder, false otherwise.

isConnectViaForwarder

public boolean isConnectViaForwarder()
Returns whether JAP shall connect to a forwarder when starting the anonymity mode. This value doesn't have any meaning within JAPRoutingSettings, so it is still possible to enable the client forwarding mode, if this value is false. Anybody who is starting the anonymity mode should check this value and do the necessary things.

Returns:
True, if new anonymous connections shall use a forwarder, false otherwise.

httpListenerPortChanged

public void httpListenerPortChanged()
This method updates the local proxy for the infoservice, if we are in client routing mode and the infoservice needs to be forwarded. This method must be called, if the old HTTP listener port is closed and a new one is opened. At the moment, we don't need this method because changing the HTTP listener requires a restart of JAP.


anonConnectionClosed

public void anonConnectionClosed()
This method is always called, when a anon connection is closed. If it is a forwarded connection, we update the internal status like the routing mode.


getAnonProxyInstance

public AnonProxy getAnonProxyInstance(java.net.ServerSocket a_listener)
Returns the anon proxy for the forwarded client connection.

Parameters:
a_listener - The ServerSocket listening for incoming requests e.g. the from the web browser.
Returns:
The anon proxy for the forwarded connection or null, if we are not in the client routing mode.

getConnectionDescriptor

public ForwardConnectionDescriptor getConnectionDescriptor()
                                                    throws ClientForwardException
Returns the connection offer from the forwarder. This method must be called exactly once, after the connection to the forwarder is created. If there was an error or we are not in client routing mode, an exception is thrown.

Returns:
The connection descriptor with the connection offer from the forwarder.
Throws:
ClientForwardException

selectMixCascade

public void selectMixCascade(MixCascade a_mixCascade)
                      throws ClientForwardException
This method must be called exactly once, after we have received the the connection offer from the forwarder. If the call of this method doesn't throw an exception, everything is ready for starting the anonymous connection. This method throws an exception, if there is something wrong while sending our decision to the forwarder. At the moment this method must be called within the forwarder dummy traffic interval, because dummy traffic is not implemented within the used protocol -> dummy traffic is available after starting the JAP AnonProxy on the forwarded connection.

Parameters:
a_mixCascade - The mixcascade from the connection offer we want to use.
Throws:
ClientForwardException

getSchedulerStatistics

public ForwardSchedulerStatistics getSchedulerStatistics()
Returns the statistics instance of the forwarding scheduler. If we are not in server routing mode, null is returned.

Returns:
The statistics instance of the scheduler or null, if no scheduler is running.

getCurrentlyForwardedConnections

public int getCurrentlyForwardedConnections()
Returns the number of currently forwarded connections. If we are not in server routing mode, 0 is returned.

Returns:
The number of currently forwarded connections.

startPropaganda

public int startPropaganda(boolean a_blocking)
Starts the propaganda instances, which register the local forwarding server at the specified infoservices. Any running propaganda instances are stopped. If we are not in the server routing mode, nothing is done.

Parameters:
a_blocking - Whether to wait until all propaganda instances are started and have tried to connect to the infoservice (true) or return immediately (false).
Returns:
The status of the registration process. See the REGISTRATION constants in this class. If we are not in blocking mode (a_blocking == false), always 0 is returned.

stopPropaganda

public void stopPropaganda()
Stops all running propaganda instances, which register the local forwarder at the specified infoservices.


addPropagandaInstance

public void addPropagandaInstance(InfoServiceDBEntry a_registrationInfoService)
This method adds a new single propaganda instance for the forwarding server. It should only be called from JAPRoutingRegistrationInfoServices because the instance is only added to the temporarly propaganda instances list, which is only valid until stopPropaganda() is called. It is not added to the permanent list, which is stored in JAPRoutingRegistrationInfoServices. If the propaganda doesn't run at the moment, is stopped while the new propaganda instance is started or the server port is changed while the new propaganda instance is started, nothing is done. This method only starts a thread, which creates the propagandist and returns immediately.

Parameters:
a_registrationInfoService - The infoservice where the new propaganda instance tries to registrate at.

getRunningPropagandaInstances

public java.util.Vector getRunningPropagandaInstances()
Returns a snapshot of the list of currently running propaganda instances, which registrate the local forwarding server at the infoservices. If there are no running propaganda instances (maybe because we are not in server routing mode), an empty Vector is returned.

Returns:
A Vector with all currently running propaganda instances.

getConnectionClassSelector

public JAPRoutingConnectionClassSelector getConnectionClassSelector()
Returns the instance of the connection class selector of the forwarding server. This is only needed because of some comfort reasons. It makes it easier for a user to configure the correct values for the forwarding server bandwidth.

Returns:
The forwarding server connection class selector.

getRegistrationInfoServicesStore

public JAPRoutingRegistrationInfoServices getRegistrationInfoServicesStore()
Returns the structure, where the infoservices are stored, used for registration of the local forwarding server.

Returns:
The forwarding server registration infoservices store.

getUseableMixCascadesStore

public JAPRoutingUseableMixCascades getUseableMixCascadesStore()
Returns the structure, which stores the currently useable mixcascades for the client connections and updates the ForwardCascadeDatabase of the forwarding server.

Returns:
The structure, which manages the currently useable mixcascades for the forwarding server.

toXmlElement

public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
Returns the current routing settings for storage within an XML document.

Specified by:
toXmlElement in interface IXMLEncodable
Parameters:
a_doc - The context document for the routing settings.
Returns:
An XML node (JapForwardingSettings) with all routing related settings.

loadSettingsFromXml

public int loadSettingsFromXml(org.w3c.dom.Element a_japForwardingSettingsNode)
This method loads all forwarding related settings from a prior created XML structure. If there is an error while loading the server settings, it is still tried to load as much settings as possible, but the server is never started in that case, because of security reasons.

Parameters:
a_japForwardingSettingsNode - The JapForwardingSettings XML node, which was created by the getSettingsAsXml() method.

getServerStatisticsListener

public JAPRoutingServerStatisticsListener getServerStatisticsListener()
Returns the statistics listener of the forwarding servers. So it's easy to get always the current server statistics.

Returns:
The statistics listener for the forwarding servers (this is always the same instance, nevertheless a forwarding server is running or not).

getRegistrationStatusObserver

public JAPRoutingRegistrationStatusObserver getRegistrationStatusObserver()
Returns the instance of JAPRoutingRegistrationStatusObserver, which holds some information about the current registration status at the infoservices for the local forwarding server.

Returns:
The registration status observer for the infoservice registrations (this is always the same instance, nevertheless a forwarding server is running or not).

updateInfoServiceProxySettings

private void updateInfoServiceProxySettings()
If the infoservice needs forwarding, this changes the infoservice proxy settings to the JAP HTTP listener port (where JAP accept requests from browsers). So all infoservice requests are forwarded by JAP to the forwarder, from there through the mixcascade and then to the infoservice.