forward
Class ForwardUtils

java.lang.Object
  extended by forward.ForwardUtils

public class ForwardUtils
extends java.lang.Object

This is the implementation of some helper methods for the forwarding client and server. This class is a singleton.


Field Summary
(package private)  ImmutableProxyInterface m_proxyInterface
          The current proxy interface.
private static ForwardUtils ms_fuInstance
          Stores the instance of ForwardUtils (Singleton).
 
Constructor Summary
private ForwardUtils()
          This creates a new instance of ForwardUtils with disabled proxy settings.
 
Method Summary
 java.net.Socket createConnection(java.lang.String a_host, int a_port)
          Creates a new connection to the specified target using the current firewall settings.
 IStreamConnection createForwardingConnection(IAddress a_address)
          Creates a ForwardConnection according to the Type of the given Address.
 ProxyConnection createProxyConnection(java.lang.String a_host, int a_port)
          Creates a new connection to the specified target using the current firewall settings.
static ForwardUtils getInstance()
          Returns the instance of ForwardUtils (Singleton).
 void setProxySettings(ImmutableProxyInterface a_proxyInterface)
          This changes the proxy settings for all new forwarding connections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ms_fuInstance

private static ForwardUtils ms_fuInstance
Stores the instance of ForwardUtils (Singleton).


m_proxyInterface

ImmutableProxyInterface m_proxyInterface
The current proxy interface.

Constructor Detail

ForwardUtils

private ForwardUtils()
This creates a new instance of ForwardUtils with disabled proxy settings.

Method Detail

getInstance

public static ForwardUtils getInstance()
Returns the instance of ForwardUtils (Singleton). If there is no instance, there is a new one created.

Returns:
The ForwardUtils instance.

setProxySettings

public void setProxySettings(ImmutableProxyInterface a_proxyInterface)
This changes the proxy settings for all new forwarding connections. Currently active forwarding connections are not concerned.

Parameters:
a_proxyInterface - the proxy interface

createProxyConnection

public ProxyConnection createProxyConnection(java.lang.String a_host,
                                             int a_port)
Creates a new connection to the specified target using the current firewall settings.

Parameters:
a_host - The hostname or IP address of the target.
a_port - The port number of the connection target.
Returns:
The new connection or null, if there was an error connecting to that target.

createForwardingConnection

public IStreamConnection createForwardingConnection(IAddress a_address)
Creates a ForwardConnection according to the Type of the given Address. Unified the creating of Connection to different Forwarder.


createConnection

public java.net.Socket createConnection(java.lang.String a_host,
                                        int a_port)
Creates a new connection to the specified target using the current firewall settings.

Parameters:
a_host - The hostname or IP address of the target.
a_port - The port number of the connection target.
Returns:
The new connection or null, if there was an error connecting to that target.