net.i2p.router.tunnel
Class TunnelCreatorConfig

java.lang.Object
  extended by net.i2p.router.tunnel.TunnelCreatorConfig
All Implemented Interfaces:
TunnelInfo
Direct Known Subclasses:
PooledTunnelCreatorConfig

public class TunnelCreatorConfig
extends java.lang.Object
implements TunnelInfo

Coordinate the info that the tunnel creator keeps track of, including what peers are in the tunnel and what their configuration is


Field Summary
protected  RouterContext _context
           
 
Constructor Summary
TunnelCreatorConfig(RouterContext ctx, int length, boolean isInbound)
           
TunnelCreatorConfig(RouterContext ctx, int length, boolean isInbound, Hash destination)
           
 
Method Summary
(package private) static java.lang.String format(long date)
           
 HopConfig getConfig(int hop)
          retrieve the config for the given hop.
 Hash getDestination()
          if this is a client tunnel, what destination is it for?
 long getExpiration()
           
 int getLength()
          How many hops are there in the tunnel?
 java.util.Properties getOptions()
           
 double getPeakThroughputKBps()
           
 Hash getPeer(int hop)
          retrieve the peer at the given hop.
 long getProcessedMessagesCount()
           
 TunnelId getReceiveTunnelId(int hop)
          retrieve the tunnelId that the given hop receives messages on.
 long getReplyMessageId()
          new style reply message id
 java.util.List<java.lang.Integer> getReplyOrder()
          component ordering in the new style request
 TunnelId getSendTunnelId(int hop)
          retrieve the tunnelId that the given hop sends messages on.
 boolean getTunnelFailed()
           
 int getTunnelFailures()
           
 long getVerifiedBytesTransferred()
          we know for sure that this many bytes travelled through the tunnel in its lifetime
 void incrementProcessedMessages()
          take note of a message being pumped through this tunnel
 void incrementVerifiedBytesTransferred(int bytes)
          we know for sure that the given number of bytes were sent down the tunnel fully
 boolean isInbound()
          is this an inbound tunnel?
 void setExpiration(long when)
           
 void setPeakThroughputKBps(double kBps)
           
 void setPeer(int hop, Hash peer)
           
 void setReplyMessageId(long id)
           
 void setReplyOrder(java.util.List<java.lang.Integer> order)
           
 void testSuccessful(int ms)
          take note that the tunnel was able to measurably Do Good in the given time
 java.lang.String toString()
           
 boolean tunnelFailed()
          The tunnel failed a test, so (maybe) stop using it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_context

protected RouterContext _context
Constructor Detail

TunnelCreatorConfig

public TunnelCreatorConfig(RouterContext ctx,
                           int length,
                           boolean isInbound)

TunnelCreatorConfig

public TunnelCreatorConfig(RouterContext ctx,
                           int length,
                           boolean isInbound,
                           Hash destination)
Method Detail

getLength

public int getLength()
How many hops are there in the tunnel? INCLUDING US. i.e. one more than the TunnelCreatorConfig length.

Specified by:
getLength in interface TunnelInfo

getOptions

public java.util.Properties getOptions()

getConfig

public HopConfig getConfig(int hop)
retrieve the config for the given hop. the gateway is hop 0.


getReceiveTunnelId

public TunnelId getReceiveTunnelId(int hop)
retrieve the tunnelId that the given hop receives messages on. the gateway is hop 0.

Specified by:
getReceiveTunnelId in interface TunnelInfo

getSendTunnelId

public TunnelId getSendTunnelId(int hop)
retrieve the tunnelId that the given hop sends messages on. the gateway is hop 0.

Specified by:
getSendTunnelId in interface TunnelInfo

getPeer

public Hash getPeer(int hop)
retrieve the peer at the given hop. the gateway is hop 0

Specified by:
getPeer in interface TunnelInfo

setPeer

public void setPeer(int hop,
                    Hash peer)

isInbound

public boolean isInbound()
is this an inbound tunnel?

Specified by:
isInbound in interface TunnelInfo

getDestination

public Hash getDestination()
if this is a client tunnel, what destination is it for?

Specified by:
getDestination in interface TunnelInfo

getExpiration

public long getExpiration()
Specified by:
getExpiration in interface TunnelInfo

setExpiration

public void setExpiration(long when)

getReplyOrder

public java.util.List<java.lang.Integer> getReplyOrder()
component ordering in the new style request


setReplyOrder

public void setReplyOrder(java.util.List<java.lang.Integer> order)

getReplyMessageId

public long getReplyMessageId()
new style reply message id


setReplyMessageId

public void setReplyMessageId(long id)

incrementProcessedMessages

public void incrementProcessedMessages()
take note of a message being pumped through this tunnel


getProcessedMessagesCount

public long getProcessedMessagesCount()
Specified by:
getProcessedMessagesCount in interface TunnelInfo

incrementVerifiedBytesTransferred

public void incrementVerifiedBytesTransferred(int bytes)
Description copied from interface: TunnelInfo
we know for sure that the given number of bytes were sent down the tunnel fully

Specified by:
incrementVerifiedBytesTransferred in interface TunnelInfo

getVerifiedBytesTransferred

public long getVerifiedBytesTransferred()
Description copied from interface: TunnelInfo
we know for sure that this many bytes travelled through the tunnel in its lifetime

Specified by:
getVerifiedBytesTransferred in interface TunnelInfo

getPeakThroughputKBps

public double getPeakThroughputKBps()

setPeakThroughputKBps

public void setPeakThroughputKBps(double kBps)

tunnelFailed

public boolean tunnelFailed()
The tunnel failed a test, so (maybe) stop using it


getTunnelFailed

public boolean getTunnelFailed()

getTunnelFailures

public int getTunnelFailures()

testSuccessful

public void testSuccessful(int ms)
Description copied from interface: TunnelInfo
take note that the tunnel was able to measurably Do Good in the given time

Specified by:
testSuccessful in interface TunnelInfo

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

format

static java.lang.String format(long date)