ePOST API

rice.pastry.socket
Class StubNATHandler

java.lang.Object
  extended by rice.pastry.socket.StubNATHandler
All Implemented Interfaces:
NATHandler
Direct Known Subclasses:
SocketNATHandler

public class StubNATHandler
extends java.lang.Object
implements NATHandler


Field Summary
static int ALWAYS
           
static int FAIL
           
static int NEVER
           
static int OVERWRITE
           
static int PREFIX_MATCH
           
static int USE_DIFFERENT_PORT
           
 
Constructor Summary
StubNATHandler(Environment env, java.net.InetSocketAddress localAddress, java.net.InetSocketAddress proxyAddress)
           
 
Method Summary
 java.net.InetSocketAddress externalAddress()
           
 java.net.InetSocketAddress findExternalIPwithoutUPnP()
           
protected  int getFireWallPolicyVariable(java.lang.String key)
           
 boolean localAddressIsProbablyNatted()
           
protected  java.net.InetSocketAddress[] randomSubset(java.net.InetSocketAddress[] array, int num)
          Internal method which returns a random subset of the address to ping in parallel
 boolean test()
           
 boolean usingNAT()
           
static java.net.InetSocketAddress verifyConnection(int timeout, java.net.InetSocketAddress local, java.net.InetSocketAddress[] existing, Environment env, Logger logger)
          Method which can be used to test the connectivity contstrains of the local node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALWAYS

public static final int ALWAYS
See Also:
Constant Field Values

PREFIX_MATCH

public static final int PREFIX_MATCH
See Also:
Constant Field Values

NEVER

public static final int NEVER
See Also:
Constant Field Values

OVERWRITE

public static final int OVERWRITE
See Also:
Constant Field Values

USE_DIFFERENT_PORT

public static final int USE_DIFFERENT_PORT
See Also:
Constant Field Values

FAIL

public static final int FAIL
See Also:
Constant Field Values
Constructor Detail

StubNATHandler

public StubNATHandler(Environment env,
                      java.net.InetSocketAddress localAddress,
                      java.net.InetSocketAddress proxyAddress)
Method Detail

verifyConnection

public static java.net.InetSocketAddress verifyConnection(int timeout,
                                                          java.net.InetSocketAddress local,
                                                          java.net.InetSocketAddress[] existing,
                                                          Environment env,
                                                          Logger logger)
                                                   throws java.io.IOException
Method which can be used to test the connectivity contstrains of the local node. This (optional) method is designed to be called by applications to ensure that the local node is able to connect through the network - checks can be done to check TCP/UDP connectivity, firewall setup, etc... If the method works, then nothing should be done and the method should return. If an error condition is detected, an exception should be thrown.

Throws:
java.io.IOException

randomSubset

protected java.net.InetSocketAddress[] randomSubset(java.net.InetSocketAddress[] array,
                                                    int num)
Internal method which returns a random subset of the address to ping in parallel

Parameters:
array - The list of all hosts
num - The number of hosts to return
Returns:
A subset of the specified length

localAddressIsProbablyNatted

public boolean localAddressIsProbablyNatted()
Returns:
true if ip address matches firewall prefix

getFireWallPolicyVariable

protected int getFireWallPolicyVariable(java.lang.String key)

findExternalIPwithoutUPnP

public java.net.InetSocketAddress findExternalIPwithoutUPnP()

usingNAT

public boolean usingNAT()
Specified by:
usingNAT in interface NATHandler

externalAddress

public java.net.InetSocketAddress externalAddress()
                                           throws java.io.IOException
Specified by:
externalAddress in interface NATHandler
Throws:
java.io.IOException

test

public boolean test()
Specified by:
test in interface NATHandler

ePOST API

Copyright © 2001-2005 - Rice Pastry.