Class TUNNEL


public class TUNNEL extends TP
Replacement for UDP. Instead of sending packets via UDP, a TCP connection is opened to a Router (using the RouterStub client-side stub), the IP address/port of which was given using channel properties router_host and router_port. All outgoing traffic is sent via this TCP socket to the Router which distributes it to all connected TUNNELs in this group. Incoming traffic received from Router will simply be passed up the stack.

A TUNNEL layer can be used to penetrate a firewall, most firewalls allow creating TCP connections to the outside world, however, they do not permit outside hosts to initiate a TCP connection to a host inside the firewall. Therefore, the connection created by the inside host is reused by Router to send traffic from an outside host to a host inside the firewall.

Author:
Bela Ban, Vladimir Blagojevic
  • Constructor Details

    • TUNNEL

      public TUNNEL()
  • Method Details

    • supportsMulticasting

      public boolean supportsMulticasting()
      Description copied from class: TP
      Whether or not hardware multicasting is supported
      Specified by:
      supportsMulticasting in class TP
    • setGossipRouterHosts

      public void setGossipRouterHosts(String hosts) throws UnknownHostException
      Throws:
      UnknownHostException
    • toString

      public String toString()
      Overrides:
      toString in class TP
    • getRouterHost

      @Deprecated public String getRouterHost()
      Deprecated.
    • setRouterHost

      @Deprecated public void setRouterHost(String router_host)
      Deprecated.
    • getRouterPort

      @Deprecated public int getRouterPort()
      Deprecated.
    • setRouterPort

      @Deprecated public void setRouterPort(int router_port)
      Deprecated.
    • getReconnectInterval

      public long getReconnectInterval()
    • setReconnectInterval

      public void setReconnectInterval(long reconnect_interval)
    • setTUNNELPolicy

      public void setTUNNELPolicy(TUNNEL.TUNNELPolicy policy)
    • init

      public void init() throws Exception
      Description copied from class: Protocol
      Called after instance has been created (null constructor) and before protocol is started. Properties are already set. Other protocols are not yet connected and events cannot yet be sent.
      Overrides:
      init in class TP
      Throws:
      Exception - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the channel constructor will throw an exception
    • destroy

      public void destroy()
      Description copied from class: Protocol
      This method is called on a Channel.close(). Does some cleanup; after the call the VM will terminate
      Overrides:
      destroy in class TP
    • handleDownEvent

      public Object handleDownEvent(Event evt)
      Overrides:
      handleDownEvent in class TP
    • send

      protected void send(Message msg, Address dest, boolean multicast) throws Exception
      Description copied from class: TP
      Serializes and sends a message. This method is not reentrant
      Overrides:
      send in class TP
      Throws:
      Exception
    • sendMulticast

      public void sendMulticast(byte[] data, int offset, int length) throws Exception
      Description copied from class: TP
      Send to all members in the group. UDP would use an IP multicast message, whereas TCP would send N messages, one for each member
      Specified by:
      sendMulticast in class TP
      Parameters:
      data - The data to be sent. This is not a copy, so don't modify it
      offset -
      length -
      Throws:
      Exception
    • sendUnicast

      public void sendUnicast(PhysicalAddress dest, byte[] data, int offset, int length) throws Exception
      Description copied from class: TP
      Send a unicast to 1 member. Note that the destination address is a *physical*, not a logical address
      Specified by:
      sendUnicast in class TP
      Parameters:
      dest - Must be a non-null unicast address
      data - The data to be sent. This is not a copy, so don't modify it
      offset -
      length -
      Throws:
      Exception
    • getInfo

      public String getInfo()
      Specified by:
      getInfo in class TP
    • getPhysicalAddress

      protected PhysicalAddress getPhysicalAddress()
      Specified by:
      getPhysicalAddress in class TP