|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Observable jap.forward.JAPRoutingSettings
public final class JAPRoutingSettings
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 |
---|
public static final int ROUTING_MODE_DISABLED
public static final int ROUTING_MODE_CLIENT
public static final int ROUTING_MODE_SERVER
public static final int REGISTRATION_NO_INFOSERVICES
public static final int REGISTRATION_UNKNOWN_ERRORS
public static final int REGISTRATION_INFOSERVICE_ERRORS
public static final int REGISTRATION_VERIFY_ERRORS
public static final int REGISTRATION_INTERRUPTED
public static final int REGISTRATION_SUCCESS
public static final java.lang.String DEFAULT_APP_NAME
private int m_routingMode
private int m_serverPort
private java.lang.Object m_currentServerManagerId
private int m_bandwidth
private int m_connections
private IStreamConnection m_forwardedConnection
private boolean m_forwardInfoService
private boolean m_connectViaForwarder
private boolean m_waitForShutdownCall
private DefaultClientProtocolHandler m_protocolHandler
private int m_maxDummyTrafficInterval
private java.util.Vector m_runningPropagandists
private java.lang.Thread m_startPropagandaThread
private JAPRoutingConnectionClassSelector m_connectionClassSelector
private JAPRoutingRegistrationInfoServices m_registrationInfoServicesStore
private boolean m_propagandaStarted
private JAPRoutingUseableMixCascades m_useableMixCascadesStore
private JAPRoutingServerStatisticsListener m_serverStatisticsListener
private JAPRoutingRegistrationStatusObserver m_registrationStatusObserver
private IAddress m_forwadingAddress
private java.lang.String m_appName
private JAPRoutingSettings.TransportMode m_transportMode
#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.
private IAddress m_userForwarder
private static final java.lang.String DEFAULT_SKYPE_ADDRESS_URN
Constructor Detail |
---|
public JAPRoutingSettings()
Method Detail |
---|
public int getRoutingMode()
public boolean setRoutingMode(int a_routingMode)
a_routingMode
- The new routing mode. See the constants in this class.
public int getServerPort()
public java.lang.String getApplicationName()
public boolean setApplicationName(java.lang.String a_value)
The Method takes care of the currently running Server and tries to change it, when we already using Skype.
a_value
- The new Application Name to use
public boolean setServerPort(int a_serverPort)
a_serverPort
- The port number for the forwarding server. The value must be between 1 and
65535.
public int getBandwidth()
public void setBandwidth(int a_bandwidth)
a_bandwidth
- The bandwidth for forwarding in bytes/sec.public int getBandwidthMaxConnections()
JAPConstants.ROUTING_BANDWIDTH_PER_USER
public int getAllowedConnections()
public void setAllowedConnections(int a_connections)
a_connections
- The new allowed number of forwarded connections.getBandwidthMaxConnections()
public void setNewProxySettings(ProxyInterface a_proxyInterface)
a_proxyInterface
- the proxy interfacepublic void setForwarder(java.lang.String a_forwarderHost, int a_forwarderPort)
a_forwarderHost
- The hostname/IP of a forwarder.a_forwarderPort
- The port of a forwarder.public void setForwarderAddress(IAddress a_address)
a_address
- The Address of the Forwarderpublic IAddress getForwarderAddress()
public IAddress getUserProvidetForwarder()
public void setUserProvidetForwarder(java.lang.String a_uri) throws ConnectionException
a_uri
- The URI of the Forwarding Server or null when no spezial Forwader
should be used
ConnectionException
public JAPRoutingSettings.TransportMode getTransportMode()
public boolean setTransportMode(JAPRoutingSettings.TransportMode a_value)
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.
public void setForwardInfoService(boolean a_forwardInfoService)
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).public boolean getForwardInfoService()
public void setConnectViaForwarder(boolean a_connectViaForwarder)
a_connectViaForwarder
- True, if new anonymous connections shall use a forwarder, false
otherwise.public boolean isConnectViaForwarder()
public void httpListenerPortChanged()
public void anonConnectionClosed()
public AnonProxy getAnonProxyInstance(java.net.ServerSocket a_listener)
a_listener
- The ServerSocket listening for incoming requests e.g. the from the web
browser.
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
public ForwardSchedulerStatistics getSchedulerStatistics()
public int getCurrentlyForwardedConnections()
public int startPropaganda(boolean a_blocking)
a_blocking
- Whether to wait until all propaganda instances are started and have tried
to connect to the infoservice (true) or return immediately (false).
public void stopPropaganda()
public void addPropagandaInstance(InfoServiceDBEntry a_registrationInfoService)
a_registrationInfoService
- The infoservice where the new propaganda instance tries to
registrate at.public java.util.Vector getRunningPropagandaInstances()
public JAPRoutingConnectionClassSelector getConnectionClassSelector()
public JAPRoutingRegistrationInfoServices getRegistrationInfoServicesStore()
public JAPRoutingUseableMixCascades getUseableMixCascadesStore()
public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
toXmlElement
in interface IXMLEncodable
a_doc
- The context document for the routing settings.
public int loadSettingsFromXml(org.w3c.dom.Element a_japForwardingSettingsNode)
a_japForwardingSettingsNode
- The JapForwardingSettings XML node, which was created by
the getSettingsAsXml() method.public JAPRoutingServerStatisticsListener getServerStatisticsListener()
public JAPRoutingRegistrationStatusObserver getRegistrationStatusObserver()
private void updateInfoServiceProxySettings()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |