infoservice.dynamic
Class DynamicNetworkingHelper

java.lang.Object
  extended by infoservice.dynamic.DynamicNetworkingHelper

public class DynamicNetworkingHelper
extends java.lang.Object


Constructor Summary
DynamicNetworkingHelper()
           
 
Method Summary
private  org.w3c.dom.Document constructAnswer(java.lang.String a_response)
          Constructs the answer for a connectivity request.
private  java.lang.String doPing(java.net.InetAddress a_Address, int a_port, long a_echoRequest)
          Actually executes the ping-like connectivity-test.
private  int extractPort(byte[] a_postData)
          Extracts the port from the POST data.
private  boolean isReachable(java.net.InetAddress a_Address, int a_port)
           
 HttpResponseStructure lastMixPostDynaCascade(byte[] a_postData)
          This method gets called when a last mix posts its cascade information to the InfoService Such a cascade is not yet established, so it is a temporary cascade an will be treated as such
 HttpResponseStructure mixPostConnectivityTest(java.net.InetAddress a_sourceAddress, byte[] a_postData)
          This method gets called when a mix asks the InfoService to verify its connectivity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicNetworkingHelper

public DynamicNetworkingHelper()
Method Detail

lastMixPostDynaCascade

public HttpResponseStructure lastMixPostDynaCascade(byte[] a_postData)
This method gets called when a last mix posts its cascade information to the InfoService Such a cascade is not yet established, so it is a temporary cascade an will be treated as such

Parameters:
a_postData - The data of the POST request
Returns:
HttpResponseStructure HTTP_RETURN_OK (no payload) or HTTP_RETURN_INTERNAL_SERVER_ERROR

mixPostConnectivityTest

public HttpResponseStructure mixPostConnectivityTest(java.net.InetAddress a_sourceAddress,
                                                     byte[] a_postData)
This method gets called when a mix asks the InfoService to verify its connectivity. Connectivity verification works as follows

Parameters:
a_sourceAddress - The source address of the request
a_postData - The POST data containing a XML structure with the port
Returns:
HttpResponseStructure HTTP_RETURN_OK (containing the answer XML structure) or HTTP_RETURN_INTERNAL_SERVER_ERROR

constructAnswer

private org.w3c.dom.Document constructAnswer(java.lang.String a_response)
Constructs the answer for a connectivity request. It is an XML structure of the following type:

Parameters:
a_response -
Returns:

isReachable

private boolean isReachable(java.net.InetAddress a_Address,
                            int a_port)

doPing

private java.lang.String doPing(java.net.InetAddress a_Address,
                                int a_port,
                                long a_echoRequest)
Actually executes the ping-like connectivity-test. Sends a echoRequest to the querying mix and waits for the same token to come back from the mix

Parameters:
a_Address - The target address
a_port - The target port
a_echoRequest - The echoRequest to send
Returns:
The echoResponse from the mix

extractPort

private int extractPort(byte[] a_postData)
Extracts the port from the POST data. Creates a XML-Document and returns the value of the Port element.

Parameters:
a_postData - The POST data to parse
Returns:
The port or -1 if there was an error