infoservice.japforwarding
Class JapForwardingTools

java.lang.Object
  extended by infoservice.japforwarding.JapForwardingTools

public class JapForwardingTools
extends java.lang.Object

This class provides some helper methods needed for the JAP forwarding system.


Field Summary
private static int FORWARDER_FETCH_ERROR_CODE
          This is the error code we send back to the blockee, if we could not find a forwarder entry.
private static java.lang.String FORWARDER_FETCH_ERROR_MESSAGE
          This is the error description, we send back to the blockee, if we could not find a forwarder entry.
private static int FORWARDER_RENEW_ERROR_CODE
          This is the error code we send back to the forwarder, if we don't know the forwarder ID the forwarder has sent to us for renewing the entry.
private static java.lang.String FORWARDER_RENEW_ERROR_MESSAGE
          This is the error description, we send back to the forwarder, if we don't know the forwarder ID the forwarder has sent to us for renewing the entry.
private static int FORWARDER_VERIFY_ERROR_CODE
          This is the error code we send back to the forwarder, if we couldn't reach him.
private static java.lang.String FORWARDER_VERIFY_ERROR_MESSAGE
          This is the error description, we send back to the forwarder, if we couldn't reach him.
 
Constructor Summary
JapForwardingTools()
           
 
Method Summary
static java.lang.String addForwarder(byte[] a_receivedData, java.net.InetAddress a_sourceAddress)
          Decodes the received data, check the connection to the forwarder and adds him to the JAP forwarder list.
static java.lang.String getForwarder()
          Gets a forwarder entry (encoded with a captcha) from the JAP forwarder database.
private static java.util.Vector getForwarderListInfoServices()
          Returns a snapshot of all infoservices with a primary forwarder list.
static java.lang.String renewForwarder(byte[] a_receivedData)
          Renews a forwarder in the JAP forwarder database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORWARDER_VERIFY_ERROR_CODE

private static final int FORWARDER_VERIFY_ERROR_CODE
This is the error code we send back to the forwarder, if we couldn't reach him.

See Also:
Constant Field Values

FORWARDER_VERIFY_ERROR_MESSAGE

private static final java.lang.String FORWARDER_VERIFY_ERROR_MESSAGE
This is the error description, we send back to the forwarder, if we couldn't reach him.

See Also:
Constant Field Values

FORWARDER_RENEW_ERROR_CODE

private static final int FORWARDER_RENEW_ERROR_CODE
This is the error code we send back to the forwarder, if we don't know the forwarder ID the forwarder has sent to us for renewing the entry.

See Also:
Constant Field Values

FORWARDER_RENEW_ERROR_MESSAGE

private static final java.lang.String FORWARDER_RENEW_ERROR_MESSAGE
This is the error description, we send back to the forwarder, if we don't know the forwarder ID the forwarder has sent to us for renewing the entry.

See Also:
Constant Field Values

FORWARDER_FETCH_ERROR_CODE

private static final int FORWARDER_FETCH_ERROR_CODE
This is the error code we send back to the blockee, if we could not find a forwarder entry.

See Also:
Constant Field Values

FORWARDER_FETCH_ERROR_MESSAGE

private static final java.lang.String FORWARDER_FETCH_ERROR_MESSAGE
This is the error description, we send back to the blockee, if we could not find a forwarder entry.

See Also:
Constant Field Values
Constructor Detail

JapForwardingTools

public JapForwardingTools()
Method Detail

getForwarderListInfoServices

private static java.util.Vector getForwarderListInfoServices()
Returns a snapshot of all infoservices with a primary forwarder list.

Returns:
all infoservices we know with a primary forwarder list.

addForwarder

public static java.lang.String addForwarder(byte[] a_receivedData,
                                            java.net.InetAddress a_sourceAddress)
Decodes the received data, check the connection to the forwarder and adds him to the JAP forwarder list.

Parameters:
a_receivedData - The data the JAP client has sent to us.
a_sourceAddress - The internet address where the request was coming from. We use this for checking the connection to the forwarder.
Returns:
XML encoded data with the answer to the addforwarder request, or null if the received data was malformed or if this infoservice doesn't have a primary forwarder list.

renewForwarder

public static java.lang.String renewForwarder(byte[] a_receivedData)
Renews a forwarder in the JAP forwarder database.

Parameters:
a_receivedData - The data the JAP client has sent to us.
Returns:
XML encoded data with the answer to the renewforwarder request, or null if the received data was malformed or if this infoservice doesn't have a primary forwarder list.

getForwarder

public static java.lang.String getForwarder()
Gets a forwarder entry (encoded with a captcha) from the JAP forwarder database. If we have such a database, but there is no data in it, we send back an answer with the error description. If this infoservice doesn't have a primary forwarder list, we aks all known infoservices with such a list for an entry, until we get an entry from one of them or we asked all and no one has an JAP forwarder entry. In this case we return also an answer with the error description.

Returns:
XML encoded data with the answer to the getforwarder request. This value can be null, but under normal circumstances, this can't happen.