ePOST API

rice.pastry.socket
Class SocketNATHandler

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

public class SocketNATHandler
extends StubNATHandler
implements NATHandler


Field Summary
static int ALWAYS
           
static int FAIL
           
static int MAX_PORT
           
static int NEVER
           
static int OVERWRITE
           
static int PREFIX_MATCH
           
static int USE_DIFFERENT_PORT
           
 
Constructor Summary
SocketNATHandler(Environment env, java.net.InetSocketAddress localAddress, java.net.InetSocketAddress proxyAddress)
           
 
Method Summary
 java.net.InetSocketAddress externalAddress()
           
 int findAvailableFireWallPort(int internal, int external)
           
 java.net.InetAddress findFireWall(java.net.InetAddress bindAddress)
           
 boolean findFireWallIfNecessary()
           
protected  int getFireWallPolicyVariable(java.lang.String key)
           
 boolean localAddressIsProbablyNatted()
           
 void openFireWallPort(int local, int external)
           
 boolean test()
           
 boolean usingNAT()
           
 
Methods inherited from class rice.pastry.socket.StubNATHandler
findExternalIPwithoutUPnP, randomSubset, verifyConnection
 
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

MAX_PORT

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

SocketNATHandler

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

findFireWall

public java.net.InetAddress findFireWall(java.net.InetAddress bindAddress)
                                  throws java.io.IOException
Throws:
java.io.IOException

findAvailableFireWallPort

public int findAvailableFireWallPort(int internal,
                                     int external)
                              throws java.io.IOException
Throws:
java.io.IOException

openFireWallPort

public void openFireWallPort(int local,
                             int external)
                      throws java.io.IOException
Throws:
java.io.IOException

getFireWallPolicyVariable

protected int getFireWallPolicyVariable(java.lang.String key)
Overrides:
getFireWallPolicyVariable in class StubNATHandler

localAddressIsProbablyNatted

public boolean localAddressIsProbablyNatted()
Overrides:
localAddressIsProbablyNatted in class StubNATHandler
Returns:
true if ip address matches firewall prefix

findFireWallIfNecessary

public boolean findFireWallIfNecessary()
                                throws java.io.IOException
Throws:
java.io.IOException

usingNAT

public boolean usingNAT()
Specified by:
usingNAT in interface NATHandler
Overrides:
usingNAT in class StubNATHandler

externalAddress

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

test

public boolean test()
Specified by:
test in interface NATHandler
Overrides:
test in class StubNATHandler

ePOST API

Copyright © 2001-2005 - Rice Pastry.