Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rice.pastry.socket.internet
Class InternetPastryNodeFactory

    java.lang.Object
      rice.pastry.PastryNodeFactory
          rice.pastry.transport.TransportPastryNodeFactory
              rice.pastry.socket.SocketPastryNodeFactory
                  rice.pastry.socket.nat.rendezvous.RendezvousSocketPastryNodeFactory
                      rice.pastry.socket.internet.InternetPastryNodeFactory

    public class InternetPastryNodeFactory

extends RendezvousSocketPastryNodeFactory

This Factory is designed for real deployments (with NATs). Optimized for the following use cases (in order) 1) Internet Routable, No firewall 2) Internet Routable, Firewall (not NAT) 3) NAT: User Configured Port Forwarding 4) NAT: UPnP 5) NAT: No port forwarding

Author:
  Jeff Hoye

Nested Class Summary

Nested classes/interfaces inherited from class rice.pastry.socket.SocketPastryNodeFactory
`SocketPastryNodeFactory.TLBootstrapper, SocketPastryNodeFactory.TransLiveness<Identifier,MessageType>, SocketPastryNodeFactory.TransLivenessProximity<Identifier,MessageType>`

Field Summary
`static int` | `ALWAYS` NAT policy variables
`static int` | `BOOT` Don't check bootstrap nodes
`static int` | `FAIL`
`static int` | `NEVER`
`static int` | `OVERWRITE`
`static int` | `PREFIX_MATCH`
`static int` | `RENDEZVOUS`
`static int` | `USE_DIFFERENT_PORT`

Fields inherited from class rice.pastry.socket.nat.rendezvous.RendezvousSocketPastryNodeFactory
`CONTACT_STATE, random, RENDEZVOUS_CONTACT_DIRECT_STRATEGY, RENDEZVOUS_STRATEGY, RENDEZVOUS_TL, SIMULATE_FIREWALL`

Fields inherited from class rice.pastry.socket.SocketPastryNodeFactory
`findFireWallPolicy, IP_SERVICE, localAddress, MULTI_ADDRESS_STRATEGY, MULTI_INET_TL, nidFactory, PASTRY_MAGIC_NUMBER, PRIORITY_TL, PROXY_ADDRESS, testFireWallPolicy`

Fields inherited from class rice.pastry.transport.TransportPastryNodeFactory
`leafSetMaintFreq, routeSetMaintFreq`

Fields inherited from class rice.pastry.PastryNodeFactory
`environment, logger, lSetSize, rtBase, rtMax`

Constructor Summary
`InternetPastryNodeFactory(NodeIdFactory nf, java.net.InetAddress bindAddress, int startPort, Environment env, NATHandler handler, java.util.Collection<java.net.InetSocketAddress> probeAddresses, java.net.InetAddress[] externalAddresses)`
`InternetPastryNodeFactory(NodeIdFactory nf, int startPort, Environment env)`

Method Summary
`protected void` | `findExternalAddress(Id nodeId, java.net.InetSocketAddress bindAddress, Continuation<PastryNode,java.io.IOException> deliverResultToMe)` Finds the external address, calls openFirewallPort()
`protected void` | `findExternalAddressHelper(Id nodeId, java.net.InetSocketAddress bindAddress, Continuation<PastryNode,java.io.IOException> deliverResultToMe, java.util.Collection<java.net.InetSocketAddress> myProbeAddresses)`
`protected boolean` | `findExternalAddressIfNecessary(java.net.InetAddress address)` Sets/Verifies externalAddresses Return true if all is well.
`protected void` | `findExternalNodes(Id nodeId, java.net.InetSocketAddress bindAddress, java.util.Collection<java.net.InetSocketAddress> nonInternetRoutable, Continuation<PastryNode,java.io.IOException> deliverResultToMe)` Probe the internalAddresses to get more externalAddresses, then call findExternalAddressHelper
`protected NATHandler` | `getDefaultNatHandler(Environment env, java.net.InetAddress localAddress)` Return a NATHandler
`protected int` | `getFireWallPolicyVariable(java.lang.String key)`
`protected boolean` | `isInternetRoutable(MultiInetSocketAddress proxyAddress)`
`protected void` | `newNodeSelector(Id nodeId, MultiInetSocketAddress proxyAddress, Continuation<PastryNode,java.io.IOException> deliverResultToMe, java.util.Map<java.lang.String,java.lang.Object> initialVars)` This is where the action takes place.
`protected void` | `openFirewallPort(Id nodeId, java.net.InetSocketAddress bindAddress, Continuation<PastryNode,java.io.IOException> deliverResultToMe, java.net.InetAddress externalAddress, int requestedPort)` Attempt to open the firewall on the specified port if it doesn't work, uses Rendezvous
`protected boolean` | `shouldCheckConnectivity(MultiInetSocketAddress proxyAddress, java.util.Collection<java.net.InetSocketAddress> bootstraps)`
`protected boolean` | `shouldFindExternalAddress(java.net.InetAddress address)`
`protected void` | `verifyConnectivityThenMakeNewNode(Id nodeId, MultiInetSocketAddress proxyAddress, Continuation<PastryNode,java.io.IOException> deliverResultToMe)` Verifies the connectivity (if necessary), then calls super.newNodeSelector() if connectivity fails, then uses Rendezvous

Methods inherited from class rice.pastry.socket.nat.rendezvous.RendezvousSocketPastryNodeFactory
`generatePilotStrategy, getBootstrapper, getContactDeserializer, getContactDirectStrategy, getIdentiySerializer, getIpServiceTransportLayer, getJoinProtocol, getLocalHandle, getNextHopStrategy, getNodeHandleFactory, getPilotFinder, getPriorityTransportLayer, getProximityNeighborSelector, getRendezvousGenerator, getRendezvousStrategy, getRendezvousStrategyHelper, getRendezvousTransportLayer, getResponseStrategy, getWireTransportLayer, isInternetRoutablePrefix, newNodeSelector, newNodeSelector, registerApps, setContactState`

Methods inherited from class rice.pastry.socket.SocketPastryNodeFactory
`cloneEnvironment, cloneLogManager, cloneProcessor, cloneRandomSource, cloneSelectorManager, getBindAddress, getBottomLayers, getCommonAPITransportLayer, getIdentityImpl, getLimitSocketsTransportLayer, getLivenessTransportLayer, getLowerIdentityLayer, getMagicNumberTransportLayer, getMultiAddressSourceRouteFactory, getMultiAddressSourceRouteTransportLayer, getNextInetSocketAddress, getNodeHandle, getNodeHandle, getNodeHandle, getNodeHandle, getNodeHandleAdapter, getProbeStrategy, getSocketCountListener, getSourceRouteForwardStrategy, getSourceRouteManagerLayer, getSourceRouteStrategy, getSourceRouteTransportLayer, getUpperIdentityLayer, newNode, newNode, newNode, newNode, newNode, newNode, newNode, newNode, newNode, verifyConnection`

Methods inherited from class rice.pastry.transport.TransportPastryNodeFactory
`getLeafSetProtocol, getRouterStrategy, getRouteSetProtocol, getTLDeserializer, nodeHandleHelper`

Methods inherited from class rice.pastry.PastryNodeFactory
`getEnvironment`

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

  NAT policy variables

  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

### BOOT

    public static final int BOOT

  Don't check bootstrap nodes

  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

### RENDEZVOUS

    public static final int RENDEZVOUS

See Also:
  Constant Field Values

Constructor Detail

### InternetPastryNodeFactory

    public InternetPastryNodeFactory(NodeIdFactory nf,
                                     int startPort,
                                     Environment env)
                              throws java.io.IOException

Throws:
  `java.io.IOException`

### InternetPastryNodeFactory

    public InternetPastryNodeFactory(NodeIdFactory nf,
                                     java.net.InetAddress bindAddress,
                                     int startPort,
                                     Environment env,
                                     NATHandler handler,
                                     java.util.Collection<java.net.InetSocketAddress> probeAddresses,
                                     java.net.InetAddress[] externalAddresses)
                              throws java.io.IOException

Throws:
  `java.io.IOException`

Method Detail

### getDefaultNatHandler

    protected NATHandler getDefaultNatHandler(Environment env,
                                              java.net.InetAddress localAddress)

  Return a NATHandler

  Parameters:
    `env` -
    `localAddress` - the address of the interface we should search for a NAT on
  Returns:

### shouldFindExternalAddress

    protected boolean shouldFindExternalAddress(java.net.InetAddress address)

### findExternalAddressIfNecessary

    protected boolean findExternalAddressIfNecessary(java.net.InetAddress address)
                                              throws java.io.IOException

  Sets/Verifies externalAddresses Return true if all is well. Return false if a firewall should be found but couldn't. Throws an exception if firewall was found and disagrees with the existing externalAddress (if it's not null).

  Parameters:
    `address` -
  Returns:
  Throws:
    `java.io.IOException`

### newNodeSelector

    protected void newNodeSelector(Id nodeId,
                                   MultiInetSocketAddress proxyAddress,
                                   Continuation<PastryNode,java.io.IOException> deliverResultToMe,
                                   java.util.Map<java.lang.String,java.lang.Object> initialVars)

  This is where the action takes place. 1) Make sure the proxyAddress is valid and good a) add the external address/port if needed 2) Try to configure the firewall 3) call newNodeSelectorHelper

  Overrides:
    `newNodeSelector` in class `SocketPastryNodeFactory`

### findExternalAddress

    protected void findExternalAddress(Id nodeId,
                                       java.net.InetSocketAddress bindAddress,
                                       Continuation<PastryNode,java.io.IOException> deliverResultToMe)

  Finds the external address, calls openFirewallPort()

### findExternalNodes

    protected void findExternalNodes(Id nodeId,
                                     java.net.InetSocketAddress bindAddress,
                                     java.util.Collection<java.net.InetSocketAddress> nonInternetRoutable,
                                     Continuation<PastryNode,java.io.IOException> deliverResultToMe)

  Probe the internalAddresses to get more externalAddresses, then call findExternalAddressHelper

### findExternalAddressHelper

    protected void findExternalAddressHelper(Id nodeId,
                                             java.net.InetSocketAddress bindAddress,
                                             Continuation<PastryNode,java.io.IOException> deliverResultToMe,
                                             java.util.Collection<java.net.InetSocketAddress> myProbeAddresses)

### openFirewallPort

    protected void openFirewallPort(Id nodeId,
                                    java.net.InetSocketAddress bindAddress,
                                    Continuation<PastryNode,java.io.IOException> deliverResultToMe,
                                    java.net.InetAddress externalAddress,
                                    int requestedPort)

  Attempt to open the firewall on the specified port if it doesn't work, uses Rendezvous

  Parameters:
    `port` - the external firewall port to (attempt to) use, -1 to use anything

### verifyConnectivityThenMakeNewNode

    protected void verifyConnectivityThenMakeNewNode(Id nodeId,
                                                     MultiInetSocketAddress proxyAddress,
                                                     Continuation<PastryNode,java.io.IOException> deliverResultToMe)

  Verifies the connectivity (if necessary), then calls super.newNodeSelector() if connectivity fails, then uses Rendezvous

  Parameters:
    `nodeId` -
    `proxyAddress` -
    `deliverResultToMe` -

### isInternetRoutable

    protected boolean isInternetRoutable(MultiInetSocketAddress proxyAddress)

### getFireWallPolicyVariable

    protected int getFireWallPolicyVariable(java.lang.String key)

### shouldCheckConnectivity

    protected boolean shouldCheckConnectivity(MultiInetSocketAddress proxyAddress,
                                              java.util.Collection<java.net.InetSocketAddress> bootstraps)

  Parameters:
    `proxyAddress` -
  Returns:

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.